-
Notifications
You must be signed in to change notification settings - Fork 42
fix: #401 improve bounty payout display clarity #412
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -60,7 +60,9 @@ export function GigCard({ | |||||
| const coin = gig.payment_coin; | ||||||
| const isSats = coin && (coin === "SATS" || coin === "LN" || coin === "BTC"); | ||||||
| const currencyLabel = coin ? (isSats ? "sats" : coin) : "USD"; | ||||||
| const coinNote = coin ? ` (paid in ${coin})` : ""; | ||||||
| // 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})` : ""; | ||||||
|
|
||||||
| const fmt = (val: number) => { | ||||||
| if (isSats) return `${val.toLocaleString("en-US")} sats`; | ||||||
|
|
@@ -75,7 +77,7 @@ export function GigCard({ | |||||
| } | ||||||
|
|
||||||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| if (min) return `${fmt(min)}+${suffix}${!isSats ? coinNote : ""}`; | ||||||
| if (max) return `up to ${fmt(max)}${suffix}${!isSats ? coinNote : ""}`; | ||||||
| return (gig.budget_type === "fixed" || gig.budget_type === "bounty") ? "Budget TBD" : "Rate TBD"; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { formatBountyPayout } from "./bounties"; | ||
|
|
||
| describe("formatBountyPayout", () => { | ||
| it("shows USD only when no coin", () => { | ||
| expect(formatBountyPayout(1, null)).toBe("$1.00 USD"); | ||
|
Check failure on line 6 in src/lib/bounties.test.ts
|
||
| expect(formatBountyPayout(100, undefined)).toBe("$100.00 USD"); | ||
| }); | ||
|
|
||
| it("shows (COIN) format to avoid misreading USD value as coin amount", () => { | ||
| expect(formatBountyPayout(1, "SOL")).toBe("$1.00 USD (SOL)"); | ||
|
Check failure on line 11 in src/lib/bounties.test.ts
|
||
| expect(formatBountyPayout(50, "ETH")).toBe("$50.00 USD (ETH)"); | ||
| }); | ||
|
|
||
| it("handles string amount input", () => { | ||
| expect(formatBountyPayout("2.50", "BTC")).toBe("$2.50 USD (BTC)"); | ||
|
Check failure on line 16 in src/lib/bounties.test.ts
|
||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"$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.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!