Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabib committed Jan 8, 2025
1 parent da465f3 commit d421811
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions frontend/src/lib/pages/Portfolio.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,32 @@
import NoNeuronsCard from "$lib/components/portfolio/NoNeuronsCard.svelte";
import NoTokensCard from "$lib/components/portfolio/NoTokensCard.svelte";
import { authSignedInStore } from "$lib/derived/auth.derived";
import type { UserToken } from "$lib/types/tokens-page";
import { getTotalBalanceInUsd } from "$lib/utils/token.utils";
import { TokenAmountV2, isNullish } from "@dfinity/utils";
export let userTokensData: UserToken[];
let totalTokensBalanceInUsd: number;
$: totalTokensBalanceInUsd = getTotalBalanceInUsd(userTokensData);
let hasUnpricedTokens: boolean;
$: hasUnpricedTokens = userTokensData.some(
(token) =>
token.balance instanceof TokenAmountV2 &&
token.balance.toUlps() > 0n &&
(!("balanceInUsd" in token) || isNullish(token.balanceInUsd))
);
let totalUsdAmount: number;
$: totalUsdAmount = $authSignedInStore ? totalTokensBalanceInUsd : undefined;
let isNotSignedIn: boolean;
$: isNotSignedIn = !$authSignedInStore;
let showNoTokensCard: boolean;
$: showNoTokensCard = isNotSignedIn || totalTokenBalanceInUsd === 0;
let showNoNeuronsCard: boolean;
$: showNoNeuronsCard = isNotSignedIn || totalStakedInUsd === 0;
</script>

<main data-tid="portfolio-page-component">
Expand Down

0 comments on commit d421811

Please sign in to comment.