Skip to content

Commit

Permalink
fix(fb): correctly display success screen after unlocking fb (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
theborakompanioni authored Feb 1, 2023
1 parent d9b0415 commit 0eb6649
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 49 deletions.
92 changes: 44 additions & 48 deletions src/components/Earn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,55 +400,51 @@ export default function Earn({ wallet }) {
subtitle={t('earn.subtitle_fidelity_bonds')}
/>
<div className="d-flex flex-column gap-3">
{currentWalletInfo && fidelityBonds.length > 0 && (
<>
{moveToJarFidelityBondId && (
<SpendFidelityBondModal
show={true}
fidelityBondId={moveToJarFidelityBondId}
wallet={wallet}
walletInfo={currentWalletInfo}
destinationJarIndex={0}
onClose={({ mustReload }) => {
setMoveToJarFidelityBondId(undefined)
if (mustReload) {
reloadFidelityBonds({ delay: 0 })
}
}}
/>
)}
{fidelityBonds.map((fidelityBond, index) => {
const isExpired = !fb.utxo.isLocked(fidelityBond)
const actionsEnabled =
isExpired &&
serviceInfo &&
!serviceInfo.coinjoinInProgress &&
!serviceInfo.makerRunning &&
!isWaitingMakerStart &&
!isWaitingMakerStop &&
!isLoading
return (
<ExistingFidelityBond key={index} fidelityBond={fidelityBond}>
{actionsEnabled && (
<div className="mt-4">
<div className="">
<rb.Button
variant={settings.theme === 'dark' ? 'light' : 'dark'}
className="w-50 d-flex justify-content-center align-items-center"
disabled={moveToJarFidelityBondId !== undefined}
onClick={() => setMoveToJarFidelityBondId(fidelityBond.utxo)}
>
<Sprite className="me-1 mb-1" symbol="unlock" width="24" height="24" />
{t('earn.fidelity_bond.existing.button_spend')}
</rb.Button>
</div>
</div>
)}
</ExistingFidelityBond>
)
})}
</>
{currentWalletInfo && moveToJarFidelityBondId && (
<SpendFidelityBondModal
show={true}
fidelityBondId={moveToJarFidelityBondId}
wallet={wallet}
walletInfo={currentWalletInfo}
destinationJarIndex={0}
onClose={({ mustReload }) => {
setMoveToJarFidelityBondId(undefined)
if (mustReload) {
reloadFidelityBonds({ delay: 0 })
}
}}
/>
)}
{fidelityBonds.map((fidelityBond, index) => {
const isExpired = !fb.utxo.isLocked(fidelityBond)
const actionsEnabled =
isExpired &&
serviceInfo &&
!serviceInfo.coinjoinInProgress &&
!serviceInfo.makerRunning &&
!isWaitingMakerStart &&
!isWaitingMakerStop &&
!isLoading
return (
<ExistingFidelityBond key={index} fidelityBond={fidelityBond}>
{actionsEnabled && (
<div className="mt-4">
<div className="">
<rb.Button
variant={settings.theme === 'dark' ? 'light' : 'dark'}
className="w-50 d-flex justify-content-center align-items-center"
disabled={moveToJarFidelityBondId !== undefined}
onClick={() => setMoveToJarFidelityBondId(fidelityBond.utxo)}
>
<Sprite className="me-1 mb-1" symbol="unlock" width="24" height="24" />
{t('earn.fidelity_bond.existing.button_spend')}
</rb.Button>
</div>
</div>
)}
</ExistingFidelityBond>
)
})}
<>
{!serviceInfo?.makerRunning &&
!isWaitingMakerStart &&
Expand Down
2 changes: 1 addition & 1 deletion src/components/fb/SpendFidelityBondModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ const SpendFidelityBondModal = ({
<div className="w-100 d-flex gap-4 justify-content-center align-items-center">
<rb.Button
variant="light"
disabled={isSending}
disabled={isLoading}
onClick={() => onClose({ txInfo, mustReload: parentMustReload })}
className="flex-1 d-flex justify-content-center align-items-center"
>
Expand Down

0 comments on commit 0eb6649

Please sign in to comment.