Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: detailed balance for web, user view #2342

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dianasavvatina
Copy link
Contributor

@dianasavvatina dianasavvatina commented Jan 27, 2025

Proposed changes

UMA-1037

Added detailed balance view:

  • spendable is not shown if equal to the main balance
  • staked is shown if not 0
  • pending unstaked is shown if not 0
  • finalizable is shown if not 0

Types of changes

  • Bugfix
  • New feature
  • Refactor
  • Breaking change
  • UI fix

Steps to reproduce

Open main screen.
Play with stake/delegate/unstake

Screenshots

Add the screenshots of how the app used to look like and how it looks now

Status Before Now
.No staking image image
Staking image image
Delegation ended after staking image image

Checklist

  • Tests that prove my fix is effective or that my feature works have been added
  • Documentation has been added (if appropriate)
  • Screenshots are added (if any UI changes have been made)
  • All TODOs have a corresponding task created (and the link is attached to it)

Copy link

vercel bot commented Jan 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umami-embed-iframe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 0:19am
umami-embed-iframe-ghostnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 0:19am
umami-v2-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 0:19am
umami-v2-web-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 0:19am

@@ -129,6 +129,12 @@ export const useGetDollarBalance = () => {
};
};

export const useBalanceToUsd = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this wrapper around useTezToDollar?

@@ -13,7 +13,7 @@ const tabs = [
to: "/nfts",
},
{
label: "Earn",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep as Earn and give user a choice to delegate or stake

});

describe("Delegation and staking", () => {
// beforeEach(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is commented?

import { IconButtonWithText } from "../IconButtonWithText";
import { useIsAccountVerified } from "../Onboarding/VerificationFlow";

const RoundStatusDot = ({ background }: { background: string }) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move all the staking/delegating related code to the separate component <AccountSpendableInfo /> or something like this and put it close to <AccountBalance /> component

const balance = useGetAccountBalance()(address);
const usdBalance = useGetDollarBalance()(address);
const buyTezUrl = useBuyTezUrl(address);
const spendableBalance = BigNumber(useGetAccountBalance()(address) ?? 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move all the code related to spendable into separate hook like useSpendableBalance and export all that you need

</Flex>
</Flex>
{delegate && <AddressPill address={delegate} data-testid="current-baker" />}
{!spendableBalance.isEqualTo(totalBalance) && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the code below looks the same, except data-testid, balance and label so we can make a reusable generic component which take appropriate props

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants