Skip to content

Commit

Permalink
fb:(refactor): warnings fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
barrytra committed Nov 10, 2024
1 parent 6849d8c commit 6d2f52b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
7 changes: 6 additions & 1 deletion src/components/Earn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,14 @@ export default function Earn({ wallet }: EarnProps) {
return currentWalletInfo?.fidelityBondSummary.fbOutputs || []
}, [currentWalletInfo])

console.log(fidelityBonds)
const [moveToJarFidelityBondId, setMoveToJarFidelityBondId] = useState<Api.UtxoId>()
const [renewFidelityBondId, setRenewFidelityBondId] = useState<Api.UtxoId>()

const reset = () => {
setTimelockedAddress(undefined)
setLockDate(null)
}

const isSufficientFundsAvailable = useMemo(
() => (currentWalletInfo?.balanceSummary.calculatedAvailableBalanceInSats ?? 0) > 0,
[currentWalletInfo],
Expand Down Expand Up @@ -741,6 +745,7 @@ export default function Earn({ wallet }: EarnProps) {
setLockDate={(date) => setLockDate(date)}
setAmount={(amount) => setAmount(amount)}
setIsCreatingFB={(input) => setIsCreatingFB(input)}
resetThisAsWell={() => reset()}
/>
</>
) : (
Expand Down
31 changes: 8 additions & 23 deletions src/components/fb2/CreateFidelityBond.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ interface CreateFidelityBondProps {
setLockDate: (date: Api.Lockdate | null) => void
setAmount: (amount: Api.AmountSats) => void
setIsCreatingFB: (input: boolean) => void
resetThisAsWell: () => void
}

const CreateFidelityBond2 = ({
Expand All @@ -76,6 +77,7 @@ const CreateFidelityBond2 = ({
setLockDate,
setAmount,
setIsCreatingFB,
resetThisAsWell,
}: CreateFidelityBondProps) => {
const { t } = useTranslation()
const reloadCurrentWalletInfo = useReloadCurrentWalletInfo()
Expand Down Expand Up @@ -115,8 +117,8 @@ const CreateFidelityBond2 = ({
setStep(steps.selectDate)
setSelectedJar(undefined)
setSelectedUtxos([])
setLockDate(null)
setTimelockedAddress(undefined)
// setLockDate(null)
// setTimelockedAddress(undefined)
setAlert(undefined)
}

Expand Down Expand Up @@ -281,13 +283,15 @@ const CreateFidelityBond2 = ({

if (nextStep(step) === steps.failed) {
reset()
resetThisAsWell()
return
}

if (nextStep(step) === steps.done) {
const abortCtrl = new AbortController()
const requestContext = { ...wallet, signal: abortCtrl.signal }
reset()
resetThisAsWell()
setIsCreatingFB(true)
await spendUtxosWithDirectSend(
requestContext,
Expand Down Expand Up @@ -317,6 +321,7 @@ const CreateFidelityBond2 = ({
setStep(next)
} else {
reset()
resetThisAsWell()
setStep(0)
}
}
Expand Down Expand Up @@ -383,26 +388,6 @@ const CreateFidelityBond2 = ({
</div>
</div>
)}
{/* {
<rb.Modal
show={creatingFidelityBond}
animation={true}
backdrop="static"
centered={true}
keyboard={false}
onHide={() => setCreatingFidelityBond(false)}
>
<rb.Modal.Header closeButton>
<rb.Modal.Title>{t('earn.fidelity_bond.create_fidelity_bond.title')}</rb.Modal.Title>
</rb.Modal.Header>
<rb.Modal.Body>
<div className="d-flex justify-content-center align-items-center m-5">
<rb.Spinner as="span" animation="border" size="sm" role="status" aria-hidden="true" className="me-2" />
<div>{t('earn.fidelity_bond.text_creating')}</div>
</div>
</rb.Modal.Body>
</rb.Modal>
} */}
<rb.Modal
show={showCreateFidelityBondModal}
animation={true}
Expand Down Expand Up @@ -469,7 +454,7 @@ const CreateFidelityBond2 = ({
<div className="d-flex align-items-center gap-4">
<div className={styles.circle}>
<div className={styles.step}>
{index === 3 ? <Sprite symbol="checkmark" width="20" height="20" /> : index + 1}
{index === 3 ? <Sprite symbol="checkmark" width="20" height="30" /> : index + 1}
</div>
</div>
<div className={styles.stepHeader}>{tab}</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/fb2/ExistingFidelityBond.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ interface CreatingFidelityBondProps {

const CreatingFidelityBond = ({ timelockedAddress, lockDate, amount }: CreatingFidelityBondProps) => {
const settings = useSettings()
const { t, i18n } = useTranslation()
const { t } = useTranslation()

// const humanReadableLockDuration = useMemo(() => {
// const locktime = fb.utxo.getLocktime(fidelityBond)
Expand Down

0 comments on commit 6d2f52b

Please sign in to comment.