fix: clarify coin-paid bounty payout labels#405
Conversation
Greptile SummaryThis PR updates the bounty payout label for coin-paid USD bounties from
Confidence Score: 5/5Safe to merge — the change is a two-line label update with a whitespace guard and matching unit tests. The logic is minimal and well-tested. The only callsites (bounties/page.tsx, bounties/[id]/page.tsx, dashboard/bounties/page.tsx) all pass payment_coin from the database, and the new .trim() path is strictly more defensive than before. Gig-card paths are unaffected and have their own tests. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["formatBountyPayout(amountUsd, paymentCoin)"] --> B["amount = Number(amountUsd)"]
B --> C["usd = formatCurrency(amount) + ' USD'"]
C --> D["coin = paymentCoin?.trim()"]
D --> E{coin truthy?}
E -- "Yes (e.g. 'SOL')" --> F["Return: '$X USD value, paid in SOL equivalent'"]
E -- "No (null / undefined / blank)" --> G["Return: '$X USD'"]
Reviews (1): Last reviewed commit: "fix: clarify coin-paid bounty payout lab..." | Re-trigger Greptile |
| /** | ||
| * Human label for a bounty payout, matching the gig card style: | ||
| * "$2.00 USD (paid in SOL)" when a coin is set, otherwise "$2.00 USD". | ||
| * "$2.00 USD value, paid in SOL equivalent" when a coin is set, | ||
| * otherwise "$2.00 USD". | ||
| * Centralized so browse/detail/dashboard stay consistent. | ||
| */ |
There was a problem hiding this comment.
The JSDoc comment still says "matching the gig card style", but
GigCard.tsx still uses the old (paid in ${coin}) format — bounties now intentionally diverge from it. The comment should reflect this. The example amount also shows $2.00 USD with a forced two-decimal format, but formatCurrency uses minimumFractionDigits: 0, so a round number like $2 renders as $2 USD, not $2.00 USD.
| /** | |
| * Human label for a bounty payout, matching the gig card style: | |
| * "$2.00 USD (paid in SOL)" when a coin is set, otherwise "$2.00 USD". | |
| * "$2.00 USD value, paid in SOL equivalent" when a coin is set, | |
| * otherwise "$2.00 USD". | |
| * Centralized so browse/detail/dashboard stay consistent. | |
| */ | |
| /** | |
| * Human label for a bounty payout: | |
| * "$2 USD value, paid in SOL equivalent" when a coin is set, | |
| * otherwise "$2 USD". | |
| * Centralized so browse/detail/dashboard stay consistent. | |
| */ |
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!
Summary
payment_coinvalues as USD-only.Fixes #401
Tests
./node_modules/.bin/vitest run src/lib/bounties.test.ts src/lib/utils.test.ts