diff --git a/src/lib.rs b/src/lib.rs
index 6a2e14f..9f166a8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,6 +16,7 @@ pub mod pages {
pub mod middlewares {
pub mod is_chain_available;
pub mod is_dao_owner;
+ pub mod is_signer_ready;
}
pub mod layouts {
pub mod authenticated;
@@ -34,8 +35,8 @@ pub mod hooks {
pub mod use_notification;
pub mod use_onboard;
pub mod use_our_navigator;
- pub mod use_session;
pub mod use_paginator;
+ pub mod use_session;
pub mod use_spaces_client;
pub mod use_startup;
pub mod use_theme;
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index 19b4ab0..0832336 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -477,7 +477,8 @@
"title": "鈿狅笍Attention: This information is for you",
"middleware": {
"has_dao": "We're sorry! 馃槥 You cannot create more organizations associated with this account.",
- "chain_unavailable": "At this time, it is not possible to complete this action."
+ "chain_unavailable": "At this time, it is not possible to complete this action.",
+ "signer_not_found": "We're sorry! 馃槥 You cannot perform this action, you must authenticate first."
}
},
"utils": {
diff --git a/src/locales/es-ES.json b/src/locales/es-ES.json
index a89d091..b5bff4b 100644
--- a/src/locales/es-ES.json
+++ b/src/locales/es-ES.json
@@ -491,7 +491,8 @@
"title": "鈿狅笍Atenci贸n: Est谩 informaci贸n es para ti",
"middleware": {
"has_dao": "隆Lo sentimos! 馃槥 No puedes crear m谩s organizaciones asociadas a esta cuenta.",
- "chain_unavailable": "En este momento no es posible completar est谩 acci贸n."
+ "chain_unavailable": "En este momento no es posible completar est谩 acci贸n.",
+ "signer_not_found": "隆Lo sentimos! 馃槥 No puedes realizar esta acci贸n, primero debes autenticarte."
}
},
"errors": {
diff --git a/src/middlewares/is_signer_ready.rs b/src/middlewares/is_signer_ready.rs
new file mode 100644
index 0000000..11b6971
--- /dev/null
+++ b/src/middlewares/is_signer_ready.rs
@@ -0,0 +1,17 @@
+use crate::hooks::{use_accounts::UseAccountsState, use_notification::UseNotificationState};
+use dioxus_std::{i18n::UseI18, translate};
+pub fn is_signer_ready(
+ i18: UseI18,
+ accounts: UseAccountsState,
+ mut notification: UseNotificationState,
+) -> impl FnOnce() -> Result<(), &'static str> {
+ move || {
+ if accounts.get_account().is_none() {
+ notification.handle_warning(&translate!(i18, "warnings.middleware.signer_not_found"));
+ Err("Failed to get account to sign")
+ } else {
+ log::debug!("Signer is ready");
+ Ok(())
+ }
+ }
+}
diff --git a/src/pages/deposit.rs b/src/pages/deposit.rs
index a712c38..8892149 100644
--- a/src/pages/deposit.rs
+++ b/src/pages/deposit.rs
@@ -7,16 +7,14 @@ use crate::{
dropdown::{DropdownItem, ElementSize},
AccountButton, BankCardLine, Button, CheckboxCard, Dropdown, Icon, Input, KusamaLogo,
PaymentMethod, PaypalLogo, PolygonLogo, Tab, Title,
- },
- hooks::{
+ }, hooks::{
use_accounts::use_accounts,
use_communities::use_communities,
use_deposit::{use_deposit, DepositError, DepositTo},
use_notification::use_notification,
use_our_navigator::use_our_navigator,
use_tooltip::{use_tooltip, TooltipItem},
- },
- pages::onboarding::convert_to_jsvalue,
+ }, middlewares::is_signer_ready::is_signer_ready, pages::onboarding::convert_to_jsvalue
};
use wasm_bindgen::prelude::*;
@@ -62,6 +60,12 @@ pub fn Deposit() -> Element {
let mut dropdown_value = use_signal::