Skip to content

Commit

Permalink
fix: flip the balances
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 20, 2024
1 parent 1f81cc0 commit 00baf47
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Box position="absolute" top="space.01" right="space.01">
<BasicTooltip label="This inscription has loads of BTC on it, remove protections? Click">
Expand Down
46 changes: 25 additions & 21 deletions src/app/features/collectibles/components/bitcoin/inscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import { useHover } from 'use-events';

import { type Inscription } from '@leather.io/models';
import {
ArrowRotateClockwiseIcon,

Check failure on line 9 in src/app/features/collectibles/components/bitcoin/inscription.tsx

View workflow job for this annotation

GitHub Actions / typecheck

'ArrowRotateClockwiseIcon' is declared but its value is never read.
CircleIcon,

Check failure on line 10 in src/app/features/collectibles/components/bitcoin/inscription.tsx

View workflow job for this annotation

GitHub Actions / typecheck

'CircleIcon' is declared but its value is never read.
DropdownMenu,
EllipsisVIcon,
ExternalLinkIcon,
Flag,
IconButton,
LockIcon,
OrdinalAvatarIcon,
TrashIcon,
UnlockIcon,
} from '@leather.io/ui';

import { ORD_IO_URL } from '@shared/constants';
Expand Down Expand Up @@ -120,8 +124,8 @@ export function Inscription({ inscription }: InscriptionProps) {
]);

return (
<Box position="relative" {...bind} opacity={hasInscriptionBeenDiscarded(inscription) ? 0.5 : 1}>
{content}
<Box position="relative" {...bind}>
<Box opacity={hasInscriptionBeenDiscarded(inscription) ? 0.5 : 1}>{content}</Box>
<Box
bg="ink.background-primary"
position="absolute"
Expand All @@ -146,34 +150,34 @@ export function Inscription({ inscription }: InscriptionProps) {
</DropdownMenu.Item>
{hasInscriptionBeenDiscarded(inscription) ? (
<DropdownMenu.Item onClick={() => recoverInscription(inscription)}>
<Flag img={<TrashIcon variant="small" />}>Protect</Flag>
<Flag img={<LockIcon variant="small" />}>Protect</Flag>
</DropdownMenu.Item>
) : (
<DropdownMenu.Item onClick={() => discardInscription(inscription)}>
<Flag img={<TrashIcon variant="small" />}>Unprotect</Flag>
<Flag img={<UnlockIcon variant="small" />}>Unprotect</Flag>
</DropdownMenu.Item>
)}
</DropdownMenu.Content>
</DropdownMenu.Root>
</Box>
<HighSatValueUtxoWarning inscription={inscription} />
IsDiscarded: {String(hasInscriptionBeenDiscarded(inscription))}
<br />
is hovered: {String(isHovered)}
<br />
value: {inscription.value}
<br />
<button
onClick={() => {
// change api to use txid and output obj
hasInscriptionBeenDiscarded(inscription)
? recoverInscription(inscription)
: discardInscription(inscription);
}}
>
toggle safe to spend
</button>
<br />

{hasInscriptionBeenDiscarded(inscription) && (
<Box
p="space.02"
borderRadius="xs"
border="1px solid"
borderColor="ink.border-transparent"
background="ink.background-secondary"
position="absolute"
bottom="134px"
left="18px"
>
<Flag opacity={0.5} spacing="space.01" img={<TrashIcon variant="small" />}>
Unprotected
</Flag>
</Box>
)}
</Box>
);
}
6 changes: 3 additions & 3 deletions src/app/ui/components/account/account.card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ export function AccountCard({
display="inline-block"
overflow="hidden"
>
{availableBalance}
{totalBalance}
</PrivateTextLayout>
</styled.h1>
<styled.h2 textStyle="label.02" color="ink.text-subdued" mt="space.01">
Full balance:
Available balance:
<styled.span ml="space.01">
<BasicTooltip
side="right"
Expand All @@ -115,7 +115,7 @@ export function AccountCard({
spacing="space.01"
img={<InfoCircleIcon display="inline" variant="small" />}
>
{totalBalance}
{availableBalance}
</Flag>
</BasicTooltip>
</styled.span>
Expand Down

0 comments on commit 00baf47

Please sign in to comment.