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 2 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
19 changes: 19 additions & 0 deletions src/components/fb/CreateFidelityBond.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
padding: 1.25rem;
}

.containerWhenBondAlreadyExists {
border: 1px solid var(--bs-gray-200);
border-radius: 0.3rem;
display: block;
margin-left: 41rem;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of positioning with margins, what do think about using flexbox?
e.g. you could use d-flex justify-content-end on the parent element to position the button to the "right".

}

:root[data-theme='dark'] .container {
border-color: var(--bs-gray-700);
}
Expand Down Expand Up @@ -43,6 +50,18 @@
display: none;
}

.headerWhenBondAlreadyExists {
display: flex;
flex-direction: column;
padding: 0.4rem;
cursor: pointer;
}

.headerWhenBondAlreadyExists .title {
font-size: 0.8rem;
color: var(--bs-body-color);
}

.successCheckmark {
width: '2rem';
height: '2rem';
Expand Down
58 changes: 33 additions & 25 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>
{alert && <Alert {...alert} className="mt-0" onClose={() => setAlert(undefined)} />}
{lockDate && timelockedAddress && selectedJar !== undefined && (
<PaymentConfirmModal
Expand Down Expand Up @@ -645,34 +645,42 @@ const CreateFidelityBond = ({ otherFidelityBondExists, wallet, walletInfo, onDon
</PaymentConfirmModal>
)}

<div className={styles.header} onClick={() => setIsExpanded(!isExpanded)}>
<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={isExpanded ? 'caret-up' : 'plus'} width="20" height="20" />
</div>
<div className={styles.subtitle}>
{otherFidelityBondExists ? (
<Trans i18nKey="earn.fidelity_bond.subtitle_fidelity_bond_exists">
<a
onClick={(e) => e.stopPropagation()}
{otherFidelityBondExists ? (
<div className={styles.containerWhenBondAlreadyExists}>
Copy link
Collaborator

@theborakompanioni theborakompanioni May 16, 2024

Choose a reason for hiding this comment

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

I think it can be achieved without (or with less) new css classes:

<div className="d-flex justify-content-end">
  <rb.Button size="sm" variant="outline-dark" onClick={() => setIsExpanded(it => !it)}>
    <div className="d-flex justify-content-center align-items-center">
      {t('earn.fidelity_bond.title_fidelity_bond_exists')}
      <Sprite className="ms-1" symbol={isExpanded ? 'caret-up' : 'plus'} width="16" height="16" />
    </div>
  </rb.Button>
</div>

What do you think?

<div className={styles.headerWhenBondAlreadyExists} onClick={() => setIsExpanded(!isExpanded)}>
<div className="d-flex justify-content-around align-items-center">
<div className={styles.title}>{t('earn.fidelity_bond.title_fidelity_bond_exists')}</div>
<Sprite symbol={isExpanded ? 'caret-up' : 'plus'} width="15" height="15" />
</div>
{/* <div className={styles.subtitle}>
<Trans i18nKey="earn.fidelity_bond.subtitle_fidelity_bond_exists">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you have an idea where we can display the message? Maybe after the users actively clicks the button?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can show this message at the top of the form when user clicks the button, only in the case when active bonds exist.

<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')}
>
</a>
</Trans>
</div> */}
</div>
</div>
) : (
<div className={styles.container}>
<div className={styles.header} onClick={() => setIsExpanded(!isExpanded)}>
<div className="d-flex justify-content-between align-items-center">
<div className={styles.title}>{t('earn.fidelity_bond.title')}</div>
<Sprite symbol={isExpanded ? 'caret-up' : '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.Collapse in={isExpanded}>
<div>
<hr />
Expand Down
Loading