Skip to content

fix: #401 improve bounty payout display clarity#412

Open
nxz1026 wants to merge 3 commits into
profullstack:masterfrom
nxz1026:bounty-401-fix
Open

fix: #401 improve bounty payout display clarity#412
nxz1026 wants to merge 3 commits into
profullstack:masterfrom
nxz1026:bounty-401-fix

Conversation

@nxz1026
Copy link
Copy Markdown

@nxz1026 nxz1026 commented Jun 5, 2026

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 formatBountyPayout to output (COIN) format instead of (paid in COIN):

  • Before: $1.00 USD (paid in SOL)
  • After: $1.00 USD (SOL)

This matches the GigCard component style and removes the ambiguity.

Files Changed

  • src/lib/bounties.ts - core format function fix
  • src/lib/bounties.test.ts - new unit tests

/bounty

Hermes Bounty Bot added 3 commits June 4, 2026 22:03
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-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jun 5, 2026

Greptile Summary

This PR narrows the bounty/gig payout label from "$1.00 USD (paid in SOL)" to "$1.00 USD (SOL)" in both formatBountyPayout and GigCard, and adds unit tests for formatBountyPayout. The core intent is correct, but a stray " " + was added to one branch of getBudgetDisplay that produces a double-space string for equal min/max budgets.

  • src/lib/bounties.ts — clean one-liner change to formatBountyPayout; well-covered by the new bounties.test.ts.
  • src/components/gigs/GigCard.tsx — same format change, but the min === max return path now prepends an extra space before coinNote (which already starts with a space), producing "$1.00 USD (SOL)". Browsers and RTL's whitespace normalizer collapse it, so it's invisible in tests and UI, but the raw string is inconsistent with the three other return paths in the same function.
  • The code comment on line 63 references a ~ prefix (e.g. "$1.00 USD (~SOL)") that was never implemented, which will confuse future readers.

Confidence Score: 4/5

Safe to merge — the format change is correct and the only defect is a cosmetic double-space invisible to end users.

The bounties.ts change is clean and well-tested. The GigCard.tsx change achieves the same goal but introduces an extra space in the equal-budget branch; it's invisible because browsers and the test framework both collapse whitespace, but the raw string output is inconsistent with the other three branches in the same function.

src/components/gigs/GigCard.tsx — the min === max return path and the stale comment both warrant a quick look.

Important Files Changed

Filename Overview
src/components/gigs/GigCard.tsx Removes "(paid in COIN)" suffix in favour of "(COIN)"; introduces an accidental double-space in the equal min/max branch and leaves a stale comment describing a ~ prefix that was never implemented.
src/lib/bounties.ts Single-line change in formatBountyPayout: replaces "(paid in COIN)" with "(COIN)". Correct and consistent with the GigCard change.
src/lib/bounties.test.ts New test file covering formatBountyPayout with null, undefined, string, and coin inputs. Missing newline at EOF is a minor style nit.
src/components/gigs/GigCard.test.tsx Adds a test for the "(SOL)" coin notation. Test name says "~coin notation" but verifies no-tilde output — minor naming inconsistency.

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
Loading

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 : ""}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
if (min && max) return `${fmt(min)}${suffix}${!isSats ? " " + coinNote : ""}`;
if (min && max) return `${fmt(min)}${suffix}${!isSats ? coinNote : ""}`;

Comment on lines +63 to +65
// 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})` : "";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
// 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant