Skip to content

Commit

Permalink
fix logic to display primary button
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabib committed Jan 23, 2025
1 parent 366292a commit db3c501
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/lib/pages/Portfolio.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
// This helps guide users to stake their tokens when possible
let hasNoStakedTokensCardAPrimaryAction: boolean;
$: hasNoStakedTokensCardAPrimaryAction =
stakedTokensCard === "empty" && heldTokensCard !== "empty";
stakedTokensCard === "empty" && heldTokensCard === "full";
// Global loading state that tracks if either held or staked tokens are loading
// TotalAssetsCard will show this if either held or staked are loading
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/tests/lib/pages/Portfolio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,20 @@ describe("Portfolio page", () => {
"$0.00"
);
});

it("should not display a primary action when the staked tokens card loads before the held tokens card", async () => {
const loadingToken = createUserTokenLoading({});

const po = renderPage({
userTokens: [loadingToken],
tableProjects: [],
});

expect(await po.getNoStakedTokensCarPo().isPresent()).toEqual(true);
expect(await po.getNoStakedTokensCarPo().hasPrimaryAction()).toEqual(
false
);
});
});

describe("TotalAssetsCard", () => {
Expand Down

0 comments on commit db3c501

Please sign in to comment.