Skip to content

Commit

Permalink
refactor: use displayNotEnoughBalance prop
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarkhanzadian committed Jan 25, 2024
1 parent 68ce41e commit fda0531
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function Brc20TokenAssetList(props: { brc20Tokens?: Brc20Token[] }) {
token={token}
isPressable={hasPositiveBtcBalanceForFees}
onClick={hasPositiveBtcBalanceForFees ? () => navigateToBrc20SendForm(token) : noop}
notEnoughBalanceTooltipDisabled={hasPositiveBtcBalanceForFees}
displayNotEnoughBalance={!hasPositiveBtcBalanceForFees}
key={token.tick}
/>
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ interface Brc20TokenAssetItemLayoutProps extends BoxProps {
isPressable?: boolean;
onClick?(): void;
title: string;
notEnoughBalanceTooltipDisabled: boolean;
displayNotEnoughBalance?: boolean;
}
export function Brc20TokenAssetItemLayout({
balance,
caption,
isPressable,
onClick,
title,
notEnoughBalanceTooltipDisabled,
displayNotEnoughBalance,
}: Brc20TokenAssetItemLayoutProps) {
const [component, bind] = usePressable(isPressable);

const formattedBalance = formatBalance(balance.amount.toString());

return (
<BasicTooltip
disabled={notEnoughBalanceTooltipDisabled}
disabled={!displayNotEnoughBalance}
side="top"
label={'Not enough BTC in balance'}
asChild
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ interface Brc20TokenAssetItemProps {
token: Brc20Token;
isPressable?: boolean;
onClick?(): void;
notEnoughBalanceTooltipDisabled: boolean;
displayNotEnoughBalance?: boolean;
}
export function Brc20TokenAssetItem({
token,
isPressable,
onClick,
notEnoughBalanceTooltipDisabled,
displayNotEnoughBalance,
}: Brc20TokenAssetItemProps) {
return (
<Brc20TokenAssetItemLayout
Expand All @@ -23,7 +23,7 @@ export function Brc20TokenAssetItem({
title={token.tick}
isPressable={isPressable}
onClick={onClick}
notEnoughBalanceTooltipDisabled={notEnoughBalanceTooltipDisabled}
displayNotEnoughBalance={displayNotEnoughBalance}
/>
);
}

0 comments on commit fda0531

Please sign in to comment.