From 57bb153e81189ab895c9ad5fd5199f0f7b691192 Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Fri, 20 Dec 2024 11:28:11 +0000 Subject: [PATCH] fix: flip the balances --- .../bitcoin/high-sat-value-utxo.tsx | 3 ++ .../components/bitcoin/inscription.tsx | 49 +++++++++---------- src/app/pages/home/home.tsx | 1 + .../btc-balance-native-segwit.hooks.ts | 1 + .../account/account.card.stories.tsx | 12 +++-- .../ui/components/account/account.card.tsx | 6 +-- 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/app/features/collectibles/components/bitcoin/high-sat-value-utxo.tsx b/src/app/features/collectibles/components/bitcoin/high-sat-value-utxo.tsx index c84cc370be..b600e2cedb 100644 --- a/src/app/features/collectibles/components/bitcoin/high-sat-value-utxo.tsx +++ b/src/app/features/collectibles/components/bitcoin/high-sat-value-utxo.tsx @@ -4,12 +4,15 @@ import type { Inscription } from '@leather.io/models'; import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip'; +const featureBuilt = false; + interface HighSatValueUtxoProps { inscription: Inscription; } export function HighSatValueUtxoWarning({ inscription }: HighSatValueUtxoProps) { if (Number(inscription.value) < 5_000) return null; + if (!featureBuilt) return null; return ( diff --git a/src/app/features/collectibles/components/bitcoin/inscription.tsx b/src/app/features/collectibles/components/bitcoin/inscription.tsx index 21c04f501a..856b41fe06 100644 --- a/src/app/features/collectibles/components/bitcoin/inscription.tsx +++ b/src/app/features/collectibles/components/bitcoin/inscription.tsx @@ -1,8 +1,7 @@ -import { useCallback, useMemo, useState } from 'react'; +import { useCallback, useMemo } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { Box } from 'leather-styles/jsx'; -import { useHover } from 'use-events'; import { type Inscription } from '@leather.io/models'; import { @@ -11,8 +10,10 @@ import { ExternalLinkIcon, Flag, IconButton, + LockIcon, OrdinalAvatarIcon, TrashIcon, + UnlockIcon, } from '@leather.io/ui'; import { ORD_IO_URL } from '@shared/constants'; @@ -49,8 +50,6 @@ export function Inscription({ inscription }: InscriptionProps) { }); }, [navigate, inscription, location]); - const [isHovered, bind] = useHover(); - const content = useMemo(() => { const sharedProps = { onClickSend: () => openSendInscriptionModal() }; switch (inscription.mimeType) { @@ -120,8 +119,8 @@ export function Inscription({ inscription }: InscriptionProps) { ]); return ( - - {content} + + {content} {hasInscriptionBeenDiscarded(inscription) ? ( recoverInscription(inscription)}> - }>Protect + }>Protect ) : ( discardInscription(inscription)}> - }>Unprotect + }>Unprotect )} - IsDiscarded: {String(hasInscriptionBeenDiscarded(inscription))} -
- is hovered: {String(isHovered)} -
- value: {inscription.value} -
- -
+ + {hasInscriptionBeenDiscarded(inscription) && ( + + }> + Unprotected + + + )}
); } diff --git a/src/app/pages/home/home.tsx b/src/app/pages/home/home.tsx index 2114d4d979..19dd6db7a3 100644 --- a/src/app/pages/home/home.tsx +++ b/src/app/pages/home/home.tsx @@ -42,6 +42,7 @@ export function Home() { }); const inscriptions = useInscribedSpendableUtxos(); + // eslint-disable-next-line no-console console.log(inscriptions); const btcAddress = useCurrentAccountNativeSegwitAddressIndexZero(); diff --git a/src/app/query/bitcoin/balance/btc-balance-native-segwit.hooks.ts b/src/app/query/bitcoin/balance/btc-balance-native-segwit.hooks.ts index 0fca7698b4..249fcf07d8 100644 --- a/src/app/query/bitcoin/balance/btc-balance-native-segwit.hooks.ts +++ b/src/app/query/bitcoin/balance/btc-balance-native-segwit.hooks.ts @@ -17,6 +17,7 @@ export function useBtcCryptoAssetBalanceNativeSegwit(address: string) { const runesEnabled = useRunesEnabled(); const spendableInscriptionUtxos = useInscribedSpendableUtxos(); + console.log('spendable utxos', spendableInscriptionUtxos); const availableUtxosQuery = useNativeSegwitUtxosByAddress({ address, diff --git a/src/app/ui/components/account/account.card.stories.tsx b/src/app/ui/components/account/account.card.stories.tsx index 3c9f4631f8..b85e9e863b 100644 --- a/src/app/ui/components/account/account.card.stories.tsx +++ b/src/app/ui/components/account/account.card.stories.tsx @@ -33,7 +33,8 @@ export function AccountCard() { return ( null} isLoadingBalance={false} isFetchingBnsName={false} @@ -52,7 +53,8 @@ export function AccountCardLoading() { return ( null} isLoadingBalance isFetchingBnsName={false} @@ -71,7 +73,8 @@ export function AccountCardBnsNameLoading() { return ( null} isLoadingBalance={false} isFetchingBnsName @@ -91,7 +94,8 @@ export function AccountCardPrivateBalance() { return ( null} isLoadingBalance={false} isFetchingBnsName={false} diff --git a/src/app/ui/components/account/account.card.tsx b/src/app/ui/components/account/account.card.tsx index 85edf561e8..b8af6ae1d0 100644 --- a/src/app/ui/components/account/account.card.tsx +++ b/src/app/ui/components/account/account.card.tsx @@ -100,11 +100,11 @@ export function AccountCard({ display="inline-block" overflow="hidden" > - {availableBalance} + {totalBalance} - Full balance: + Available balance: } > - {totalBalance} + {availableBalance}