Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deemphasise additional bond when one already exists #758

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/fb/CreateFidelityBond.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
color: var(--bs-gray-600);
}

.header .subtitle a {
.formMessageWhenBondAlreadyExists {
flex-shrink: 1;
font-size: 0.8rem;
color: var(--bs-gray-600);
}

.formMessageWhenBondAlreadyExists a {
color: inherit;
}

Expand Down
65 changes: 39 additions & 26 deletions src/components/fb/CreateFidelityBond.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon
}

return (
<div className={styles.container}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On first glance, it seems the design has slightly changed, since the container css class moved away from here.

Before

After

Dropdown content is not within the surrounding area border anymore (no FB present).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the code changes will make this issue. I kinda knew it. But If I try to fix then <rb.collapse> section will have to be repeated twice for both the cases ( active bond exists and no active bond). This will just increase the code length.
One solution is that eventually it will be a modal so this issue shouldn't be there after we do that. So we can possibly fix that issue(modal instead of dropdown for the form) first and then there will be nothing to talk about this.

<div>
{lockDate && timelockedAddress && selectedJar !== undefined && (
<PaymentConfirmModal
isShown={showConfirmInputsModal}
Expand All @@ -644,34 +644,34 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon
</PaymentConfirmModal>
)}

<div className={styles.header} onClick={() => setShowCreateFidelityBondModal(!showCreateFidelityBondModal)}>
<div className="d-flex justify-content-between align-items-center">
<div className={styles.title}>
{otherFidelityBondExists
? t('earn.fidelity_bond.title_fidelity_bond_exists')
: t('earn.fidelity_bond.title')}
</div>
<Sprite symbol={'plus'} width="20" height="20" />
{otherFidelityBondExists ? (
<div className="d-flex justify-content-center">
<rb.Button
size="sm"
variant="outline-dark"
className="border-0 d-inline-flex align-items-center"
onClick={() => setShowCreateFidelityBondModal(!showCreateFidelityBondModal)}
>
<Sprite symbol="plus" width="20" height="20" className="me-2" />
{t('earn.fidelity_bond.title_fidelity_bond_exists')}
</rb.Button>
</div>
<div className={styles.subtitle}>
{otherFidelityBondExists ? (
<Trans i18nKey="earn.fidelity_bond.subtitle_fidelity_bond_exists">
<a
onClick={(e) => e.stopPropagation()}
rel="noopener noreferrer"
href="https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/fidelity-bonds.md#what-amount-of-bitcoins-to-lock-up-and-for-how-long"
>
{/* i18n placeholder */}
</a>
</Trans>
) : (
<div className="d-flex align-items-center justify-content-center gap-4 px-3 mt-3">
<Sprite className={styles.subtitleJar} symbol="fb-clock" width="46px" height="74px" />
{t('earn.fidelity_bond.subtitle')}
) : (
<div className={styles.container}>
<div className={styles.header} onClick={() => setShowCreateFidelityBondModal(!showCreateFidelityBondModal)}>
<div className="d-flex justify-content-between align-items-center">
<div className={styles.title}>{t('earn.fidelity_bond.title')}</div>
<Sprite symbol={'plus'} width="20" height="20" />
</div>
)}
<div className={styles.subtitle}>
<div className="d-flex align-items-center justify-content-center gap-4 px-3 mt-3">
<Sprite className={styles.subtitleJar} symbol="fb-clock" width="46px" height="74px" />
{t('earn.fidelity_bond.subtitle')}
</div>
</div>
</div>
</div>
</div>
)}
<rb.Modal
show={showCreateFidelityBondModal}
animation={true}
Expand All @@ -685,6 +685,19 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon
</rb.Modal.Header>
<rb.Modal.Body>
{alert && <Alert {...alert} className="mt-0" onClose={() => setAlert(undefined)} />}
{otherFidelityBondExists && (
<div className={styles.formMessageWhenBondAlreadyExists}>
<Trans i18nKey="earn.fidelity_bond.subtitle_fidelity_bond_exists">
<a
onClick={(e) => e.stopPropagation()}
rel="noopener noreferrer"
href="https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/fidelity-bonds.md#what-amount-of-bitcoins-to-lock-up-and-for-how-long"
>
{/* i18n placeholder */}
</a>
</Trans>
</div>
)}
<div className="mb-5">{stepComponent(step)}</div>
<div className="d-flex flex-column gap-2">
{!isLoading && primaryButtonText(step) !== null && (
Expand Down