From 4e89da1a443dcba8a592cd0e1cfc1331fb662970 Mon Sep 17 00:00:00 2001 From: barrytra Date: Wed, 22 May 2024 12:23:26 +0530 Subject: [PATCH 1/2] modal instead of dropdown for new FB form --- .../fb/CreateFidelityBond.module.css | 21 +++++++++++++++++++ src/components/fb/CreateFidelityBond.tsx | 10 ++++++--- src/i18n/locales/en/translation.json | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/components/fb/CreateFidelityBond.module.css b/src/components/fb/CreateFidelityBond.module.css index 2b4545daf..2499f5d88 100644 --- a/src/components/fb/CreateFidelityBond.module.css +++ b/src/components/fb/CreateFidelityBond.module.css @@ -50,3 +50,24 @@ color: 'white'; border-radius: '50%'; } + +.form { + padding: 0.5rem; +} + +.formHeader { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0.5rem 1rem 0 1rem; +} + +.formHeader .title { + width: 100%; + font-size: 1.2rem; + color: var(--bs-body-color); +} + +.formHeader .svg { + color: var(--bs-body-color); +} diff --git a/src/components/fb/CreateFidelityBond.tsx b/src/components/fb/CreateFidelityBond.tsx index 8d6f3353e..6de23deb3 100644 --- a/src/components/fb/CreateFidelityBond.tsx +++ b/src/components/fb/CreateFidelityBond.tsx @@ -673,8 +673,12 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon )} - -
+ +
+ +
{t('earn.fidelity_bond.create_fidelity_bond.title')}
+ +

{stepComponent(step)}
@@ -698,7 +702,7 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon )}
- +
) } diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index fe6ce3794..273d0a004 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -494,6 +494,7 @@ "label_selected_utxos": "UTXOs that will be time-locked:" }, "create_fidelity_bond": { + "title": "Create Fidelity Bond", "success_text": "Fidelity bond created!", "text_primary_button": "Done", "text_primary_button_unfreeze": "Unfreeze UTXOs", From e980bab567fc3906000b10ffed457e2a2e751c9d Mon Sep 17 00:00:00 2001 From: barrytra Date: Wed, 22 May 2024 15:10:41 +0530 Subject: [PATCH 2/2] modal instead of dropdown for new FB form --- .../fb/CreateFidelityBond.module.css | 21 ------------ src/components/fb/CreateFidelityBond.tsx | 33 +++++++++++-------- 2 files changed, 19 insertions(+), 35 deletions(-) diff --git a/src/components/fb/CreateFidelityBond.module.css b/src/components/fb/CreateFidelityBond.module.css index 2499f5d88..2b4545daf 100644 --- a/src/components/fb/CreateFidelityBond.module.css +++ b/src/components/fb/CreateFidelityBond.module.css @@ -50,24 +50,3 @@ color: 'white'; border-radius: '50%'; } - -.form { - padding: 0.5rem; -} - -.formHeader { - display: flex; - justify-content: space-between; - align-items: center; - padding: 0.5rem 1rem 0 1rem; -} - -.formHeader .title { - width: 100%; - font-size: 1.2rem; - color: var(--bs-body-color); -} - -.formHeader .svg { - color: var(--bs-body-color); -} diff --git a/src/components/fb/CreateFidelityBond.tsx b/src/components/fb/CreateFidelityBond.tsx index 6de23deb3..12576bb2d 100644 --- a/src/components/fb/CreateFidelityBond.tsx +++ b/src/components/fb/CreateFidelityBond.tsx @@ -75,7 +75,7 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon const reloadCurrentWalletInfo = useReloadCurrentWalletInfo() const feeConfigValues = useFeeConfigValues()[0] - const [isExpanded, setIsExpanded] = useState(false) + const [showCreateFidelityBondModal, setShowCreateFidelityBondModal] = useState(false) const [isLoading, setIsLoading] = useState(false) const [alert, setAlert] = useState() const [step, setStep] = useState(steps.selectDate) @@ -107,7 +107,7 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon const reset = () => { setIsLoading(false) - setIsExpanded(false) + setShowCreateFidelityBondModal(false) setStep(steps.selectDate) setSelectedJar(undefined) setSelectedUtxos([]) @@ -129,7 +129,7 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon }, [fidelityBonds, lockDate]) useEffect(() => { - if (!isExpanded) { + if (!showCreateFidelityBondModal) { reset() } else { setIsLoading(true) @@ -146,7 +146,7 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon }) return () => abortCtrl.abort() } - }, [isExpanded, reloadCurrentWalletInfo, t]) + }, [showCreateFidelityBondModal, reloadCurrentWalletInfo, t]) const freezeUtxos = (utxos: Utxos) => { changeUtxoFreeze(utxos, true) @@ -645,14 +645,14 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon )} -
setIsExpanded(!isExpanded)}> +
setShowCreateFidelityBondModal(!showCreateFidelityBondModal)}>
{otherFidelityBondExists ? t('earn.fidelity_bond.title_fidelity_bond_exists') : t('earn.fidelity_bond.title')}
- +
{otherFidelityBondExists ? ( @@ -673,13 +673,18 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon )}
- -
- -
{t('earn.fidelity_bond.create_fidelity_bond.title')}
- -
-
+ setShowCreateFidelityBondModal(false)} + > + + {t('earn.fidelity_bond.create_fidelity_bond.title')} + +
{stepComponent(step)}
{!isLoading && primaryButtonText(step) !== null && ( @@ -701,7 +706,7 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon )}
-
+
)