fix: #401 improve bounty payout display clarity#412
Conversation
Change formatBountyPayout to show "(COIN)" instead of "(paid in COIN)" so readers don't misread "$1.00 USD (SOL)" as "1 SOL". Before: "$1.00 USD (paid in SOL)" After: "$1.00 USD (SOL)"
Greptile SummaryThis PR narrows the bounty/gig payout label from
Confidence Score: 4/5Safe to merge — the format change is correct and the only defect is a cosmetic double-space invisible to end users. The src/components/gigs/GigCard.tsx — the min === max return path and the stale comment both warrant a quick look. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[getBudgetDisplay] --> B{budget_type == revenue_share?}
B -- yes --> C[Return rev share string]
B -- no --> D{min && max && min != max?}
D -- yes --> E["Return 'fmt(min) - fmt(max) + suffix + coinNote'"]
D -- no --> F{min && max?}
F -- yes --> G["Return 'fmt(min) + suffix + coinNote'\n⚠️ Extra space added here only"]
F -- no --> H{min only?}
H -- yes --> I["Return 'fmt(min)+ + suffix + coinNote'"]
H -- no --> J{max only?}
J -- yes --> K["Return 'up to fmt(max) + suffix + coinNote'"]
J -- no --> L[Return Budget/Rate TBD]
style G fill:#ffe0b2,stroke:#ff9800
Reviews (1): Last reviewed commit: "fix: #401 improve bounty payout display ..." | Re-trigger Greptile |
|
|
||
| if (min && max && min !== max) return `${fmt(min)} - ${fmt(max)}${suffix}${!isSats ? coinNote : ""}`; | ||
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? coinNote : ""}`; | ||
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? " " + coinNote : ""}`; |
There was a problem hiding this comment.
The
coinNote variable is already constructed with a leading space ( (${coin})), so prepending an additional " " in this branch produces a double-space — "$1.00 USD (SOL)" — while all other return statements in the same function use coinNote directly without the extra space. Browsers and React Testing Library's whitespace normalizer both collapse consecutive spaces, so this is invisible in the UI and the test still passes, but the raw string is inconsistent with every other code path in getBudgetDisplay.
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? " " + coinNote : ""}`; | |
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? coinNote : ""}`; |
| // Use ~ prefix when paying in crypto so readers don't mistake USD value for coin amount | ||
| // e.g. "$1.00 USD (~SOL)" not "$1.00 USD (paid in SOL)" — ~ makes it clear it's an equivalent | ||
| const coinNote = coin ? ` (${coin})` : ""; |
There was a problem hiding this comment.
The code comment says "Use ~ prefix" and gives
"$1.00 USD (~SOL)" as an example, but the actual implementation produces "$1.00 USD (SOL)" — no ~ anywhere. The contradicting comment will mislead the next person reading this code into thinking the ~ is intentionally present or that the implementation is unfinished.
| // Use ~ prefix when paying in crypto so readers don't mistake USD value for coin amount | |
| // e.g. "$1.00 USD (~SOL)" not "$1.00 USD (paid in SOL)" — ~ makes it clear it's an equivalent | |
| const coinNote = coin ? ` (${coin})` : ""; | |
| // Use (COIN) suffix so readers don't mistake the USD value for a coin amount | |
| // e.g. "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)" | |
| const coinNote = coin ? ` (${coin})` : ""; |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Bounty Claim: #401
Amount: $1
Repo: profullstack/ugig.net
Problem
When a bounty is created with
payout_usd: 1, payment_coin: SOL, the display reads$1.00 USD (paid in SOL). Readers easily misread this as "1 SOL" instead of "$1 USD paid in SOL".Fix
Changed
formatBountyPayoutto output(COIN)format instead of(paid in COIN):$1.00 USD (paid in SOL)$1.00 USD (SOL)This matches the GigCard component style and removes the ambiguity.
Files Changed
src/lib/bounties.ts- core format function fixsrc/lib/bounties.test.ts- new unit tests/bounty