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() {