Skip to content

Commit

Permalink
car
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabib committed Jan 9, 2025
1 parent 70bdbef commit 1088d3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 6 additions & 7 deletions frontend/src/lib/pages/Portfolio.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
let totalStakedInUsd: number;
$: totalStakedInUsd = getTotalStakeInUsd(tableProjects);
let hasUnpricedNeurons: boolean;
$: hasUnpricedNeurons = tableProjects.some(
let hasUnpricedStake: boolean;
$: hasUnpricedStake = tableProjects.some(
(project) =>
project.stake instanceof TokenAmountV2 &&
project.stake.toUlps() > 0n &&
(!("stakeInUsd" in project) || isNullish(project.stakeInUsd))
);
let hasUnpricedTokensOrNeurons: boolean;
$: hasUnpricedTokensOrNeurons = hasUnpricedTokens || hasUnpricedNeurons;
let hasUnpricedTokensOrStake: boolean;
$: hasUnpricedTokensOrStake = hasUnpricedTokens || hasUnpricedStake;
let totalUsdAmount: number | undefined;
$: totalUsdAmount = $authSignedInStore
Expand All @@ -48,8 +48,7 @@
let showNoNeuronsCard: boolean;
$: showNoNeuronsCard = !$authSignedInStore || totalStakedInUsd === 0;
let hasNoNeuronsCardAPrimaryAction: boolean;
$: hasNoNeuronsCardAPrimaryAction =
$authSignedInStore && totalTokensBalanceInUsd > 0;
$: hasNoNeuronsCardAPrimaryAction = !showNoTokensCard;
</script>

<main data-tid="portfolio-page-component">
Expand All @@ -59,7 +58,7 @@
{/if}
<UsdValueBanner
usdAmount={totalUsdAmount}
hasUnpricedTokens={hasUnpricedTokensOrNeurons}
hasUnpricedTokens={hasUnpricedTokensOrStake}
/>
</div>
<div class="content">
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/tests/lib/pages/Portfolio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,11 @@ describe("Portfolio page", () => {
tableProjects: [tableProject1, tableProject2],
});

// There are three tokens with a balance of 5$ and 7$ and two projects with a staked balance of 2$ and 10.5$ -> 24.5$
expect(await po.getUsdValueBannerPo().getPrimaryAmount()).toBe(
"$24.50"
);
// 1ICP == 10$
expect(await po.getUsdValueBannerPo().getSecondaryAmount()).toBe(
"2.45 ICP"
);
Expand Down

0 comments on commit 1088d3f

Please sign in to comment.