Skip to content

Commit

Permalink
feat: add stacks balance loader
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo committed Apr 4, 2024
1 parent 5c1c284 commit 20418ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/components/account-total-balance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const AccountTotalBalance = memo(({ btcAddress, stxAddress }: AccountTota
if (!totalUsdBalance) return null;

return (
<SkeletonLoader width="200px" height="38px" isLoading={isInitialLoading}>
<SkeletonLoader height="20px" isLoading={isInitialLoading}>
<styled.span
className={css(shimmerStyles)}
textStyle="label.02"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface StacksBalanceListItemLayoutProps {
stxEffectiveUsdBalance?: string;
stxLockedBalance?: Money;
stxUsdLockedBalance?: string;
isInitialLoading?: boolean;
}
export function StacksBalanceListItemLayout(props: StacksBalanceListItemLayoutProps) {
const {
Expand All @@ -23,6 +24,7 @@ export function StacksBalanceListItemLayout(props: StacksBalanceListItemLayoutPr
stxEffectiveUsdBalance,
stxLockedBalance,
stxUsdLockedBalance,
isInitialLoading,
} = props;

const stxAdditionalBalanceInfo = stxLockedBalance?.amount.isGreaterThan(0) ? (
Expand All @@ -44,6 +46,7 @@ export function StacksBalanceListItemLayout(props: StacksBalanceListItemLayoutPr
additionalBalanceInfo={stxAdditionalBalanceInfo}
additionalUsdBalanceInfo={stxAdditionalUsdBalanceInfo}
icon={<StxAvatarIcon />}
isLoading={isInitialLoading}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ interface StacksBalanceListItemProps {
}
export function StacksBalanceListItem({ address }: StacksBalanceListItemProps) {
const balaceDetails = useStxBalance();
return <StacksBalanceListItemLayout address={address} {...balaceDetails} />;
return (
<StacksBalanceListItemLayout
address={address}
isInitialLoading={balaceDetails.stxBalanceQuery.isInitialLoading}
{...balaceDetails}
/>
);
}

0 comments on commit 20418ab

Please sign in to comment.