8000 chore: display prices as full number on sales page by rajk93 · Pull Request #11554 · polkadot-js/apps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: display prices as full number on sales page #11554

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

Merged
merged 3 commits into from
May 20, 2025

Conversation

rajk93
Copy link
Contributor
@rajk93 rajk93 commented May 14, 2025

fixes #11465

Previous behaviour

Screenshot 2025-05-14 at 6 34 51 PM

Current behaviour (updated)

Screenshot 2025-05-19 at 2 07 45 PM

@TarikGul
Copy link
Member

cc: @piggydoughnut @ap211unitech

Copy link
Member
@ap211unitech ap211unitech left a comment

Choose a reason for hiding this comment

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

I would suggest creating a new helper function outside the component and making use of it.

const helper = (num: BN) => `${(num.toNumber() / 10 ** formatBalance.getDefaults().decimals)} ${formatBalance.getDefaults().unit}`;

and use it like:

const formattedCoretimePrice = useMemo(() => {
    return !coretimePrice ? null : helper(coretimePrice);
  }, [coretimePrice])

Similarly, use it with startPrice and endPrice as well. This makes the code cleaner and more readable.

@rajk93
Copy link
Contributor Author
rajk93 commented May 15, 2025

I would suggest creating a new helper function outside the component and making use of it.

const helper = (num: BN) => `${(num.toNumber() / 10 ** formatBalance.getDefaults().decimals)} ${formatBalance.getDefaults().unit}`;

and use it like:

const formattedCoretimePrice = useMemo(() => {
    return !coretimePrice ? null : helper(coretimePrice);
  }, [coretimePrice])

Similarly, use it with startPrice and endPrice as well. This makes the code cleaner and more readable.

That makes sense. I'll make the requested changes.

@rajk93
Copy link
Contributor Author
rajk93 commented May 15, 2025

@ap211unitech I’ve made the suggested change in 404698b.

Also, the Sale Timeline box looked cluttered when the price value was large on smaller screens, so I updated the layout to a 2×3 grid to improve readability.

Here’s how it looks now on smaller screens:
Screenshot 2025-05-15 at 2 22 05 PM

Copy link
Member
@ap211unitech ap211unitech left a comment

Choose a reason for hiding this comment

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

Nice 🚀

@ap211unitech ap211unitech merged commit 27b729b into polkadot-js:master May 20, 2025
5 checks passed
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators May 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coretime: Sales Page: Display prices as full numbers instead of using nano or micro notation.
5 participants
0