From 15ea2e0b777b927cc7794be024428aefac898dec Mon Sep 17 00:00:00 2001 From: Sarvesh Kolte Date: Sun, 26 Oct 2025 18:35:29 +0530 Subject: [PATCH] chore/trim-long-prices --- packages/nextjs/app/bounties/[id]/page.tsx | 30 +++-- packages/nextjs/app/bounties/create/page.tsx | 2 +- packages/nextjs/app/bounties/page.tsx | 44 +++++-- packages/nextjs/app/leaderboard/page.tsx | 4 +- packages/nextjs/app/reports/[bounty]/page.tsx | 26 ++++- packages/nextjs/app/reports/page.tsx | 109 ++++++++++-------- packages/nextjs/components/Footer.tsx | 3 +- .../nextjs/public/icons/github-mark-white.svg | 1 + packages/nextjs/utils/format.ts | 13 +++ 9 files changed, 157 insertions(+), 75 deletions(-) create mode 100644 packages/nextjs/public/icons/github-mark-white.svg create mode 100644 packages/nextjs/utils/format.ts diff --git a/packages/nextjs/app/bounties/[id]/page.tsx b/packages/nextjs/app/bounties/[id]/page.tsx index 7c63ab8..b012ced 100644 --- a/packages/nextjs/app/bounties/[id]/page.tsx +++ b/packages/nextjs/app/bounties/[id]/page.tsx @@ -18,6 +18,7 @@ import { Address } from "~~/components/scaffold-eth"; import { BountyStatus, bountyABI } from "~~/contracts/BountyABI"; import deployedContracts from "~~/contracts/deployedContracts"; import { useTargetNetwork } from "~~/hooks/scaffold-eth"; +import { formatEthShort } from "~~/utils/format"; import { notification } from "~~/utils/scaffold-eth"; export default function BountyDetailsPage() { @@ -244,6 +245,14 @@ export default function BountyDetailsPage() { const isOwner = connectedAddress === owner?.result; const currentStatus = status?.result !== undefined ? BountyStatus[status.result] : "Loading..."; + // Compute display reward + const rewardWei = ( + committedAmount && committedAmount > 0n ? committedAmount : (amount?.result as bigint) || 0n + ) as bigint; + const fullEth = formatEther(rewardWei); + const shortEth = formatEthShort(rewardWei, 6); + const isTrimmed = (fullEth.split(".")[1]?.length || 0) > 6; + return (
@@ -261,13 +270,18 @@ export default function BountyDetailsPage() {

Reward

-

- {formatEther( - (committedAmount && committedAmount > 0n - ? committedAmount - : (amount?.result as bigint) || 0n) as bigint, - )}{" "} - ETH +

+ + {shortEth} ETH + {isTrimmed && ( + <> + + + {fullEth} ETH + + + )} +

@@ -320,7 +334,7 @@ export default function BountyDetailsPage() { {hasMySubmission && connectedAddress && ( My Submission diff --git a/packages/nextjs/app/bounties/create/page.tsx b/packages/nextjs/app/bounties/create/page.tsx index 0afcd34..e83cc32 100644 --- a/packages/nextjs/app/bounties/create/page.tsx +++ b/packages/nextjs/app/bounties/create/page.tsx @@ -218,7 +218,7 @@ export default function CreateBountyPage() {