From 94de8f554d445c949fd3ebec4b174d5824fdd240 Mon Sep 17 00:00:00 2001 From: Georgy Butaev <41178744+g-but@users.noreply.github.com> Date: Fri, 5 Jun 2026 10:03:21 +0200 Subject: [PATCH] fix(currency): drain SATS-stale display + WishlistDonationTiers unit bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three SATS-stale UI spots called out by the rebrand verify: 1. ProjectDonationSection: SUGGESTED_AMOUNTS_SATS → SUGGESTED_AMOUNTS_BTC (0.001 / 0.005 / 0.01). Primary shows user's preferred currency, secondary shows BTC (was sats). 2. ProfileOverviewTab subscribe dropdown: 50k/100k/250k sats hardcoded with stale "(~$50)" approximations → BTC values with labels rendered dynamically via formatAmountBtc so each user sees their preferred currency. 3. WishlistDonationTiers: real BUG. It was calling convert(item.target_amount_btc, 'SATS', userCurrency) passing a BTC value (e.g. 0.001) while telling convert() the unit was 'SATS'. Result: 0.001 sats ≈ ~0 fiat — every tier showed a meaningless ~CHF 0 to users. Now correctly passes 'BTC' fromCurrency and uses displayBTC() for the secondary line. Lend/invest sats inputs in ProfileOverviewTab still need a deeper UX pass (separate session) — they're typed inputs, not just labels. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/profile/ProfileOverviewTab.tsx | 8 +++---- .../project/ProjectDonationSection.tsx | 22 +++++++++---------- .../wishlist/WishlistDonationTiers.tsx | 11 ++++++---- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/components/profile/ProfileOverviewTab.tsx b/src/components/profile/ProfileOverviewTab.tsx index 9b149dab0..3df5448ab 100644 --- a/src/components/profile/ProfileOverviewTab.tsx +++ b/src/components/profile/ProfileOverviewTab.tsx @@ -61,7 +61,7 @@ export default function ProfileOverviewTab({ const [supportType, setSupportType] = useState<'donate' | 'subscribe' | 'lend' | 'invest' | null>( null ); - const [subAmount, setSubAmount] = useState(100000); + const [subAmount, setSubAmount] = useState(0.001); const [lendAmount, setLendAmount] = useState(500000); const [lendRate, setLendRate] = useState(5); const [lendTerm, setLendTerm] = useState(12); @@ -229,9 +229,9 @@ export default function ProfileOverviewTab({ onChange={e => setSubAmount(Number(e.target.value))} className="border rounded p-1 text-sm" > - - - + + + per month diff --git a/src/components/project/ProjectDonationSection.tsx b/src/components/project/ProjectDonationSection.tsx index f61bfac79..b79b07cb4 100644 --- a/src/components/project/ProjectDonationSection.tsx +++ b/src/components/project/ProjectDonationSection.tsx @@ -7,7 +7,7 @@ import Button from '@/components/ui/Button'; import { toast } from 'sonner'; import { QRCodeSVG } from 'qrcode.react'; import { WishlistDonationTiers } from '@/components/wishlist/WishlistDonationTiers'; -import { convert, formatCurrency } from '@/services/currency'; +import { convert, formatCurrency, displayBTC } from '@/services/currency'; import { ENTITY_REGISTRY } from '@/config/entity-registry'; import { useProjectDonation } from './useProjectDonation'; import { ROUTES } from '@/config/routes'; @@ -21,10 +21,10 @@ interface ProjectDonationSectionProps { isOwner?: boolean; } -const SUGGESTED_AMOUNTS_SATS = [ - { sats: 100_000, label: 'Small' }, - { sats: 500_000, label: 'Medium' }, - { sats: 1_000_000, label: 'Large' }, +const SUGGESTED_AMOUNTS_BTC = [ + { btc: 0.001, label: 'Small' }, + { btc: 0.005, label: 'Medium' }, + { btc: 0.01, label: 'Large' }, ]; export function ProjectDonationSection({ @@ -200,19 +200,19 @@ export function ProjectDonationSection({ {ownerId && !isOwner ? 'Other amounts:' : 'Suggested support amounts:'}

- {SUGGESTED_AMOUNTS_SATS.map(({ sats, label }) => { - const displayAmount = convert(sats, 'SATS', userCurrency); + {SUGGESTED_AMOUNTS_BTC.map(({ btc, label }) => { + const displayAmount = convert(btc, 'BTC', userCurrency); const formattedAmount = formatCurrency(displayAmount, userCurrency, { compact: true, }); - const satsDisplay = formatCurrency(sats, 'SATS', { compact: true }); + const btcDisplay = displayBTC(btc); return ( ); diff --git a/src/components/wishlist/WishlistDonationTiers.tsx b/src/components/wishlist/WishlistDonationTiers.tsx index 112789c4b..393e52b22 100644 --- a/src/components/wishlist/WishlistDonationTiers.tsx +++ b/src/components/wishlist/WishlistDonationTiers.tsx @@ -18,7 +18,7 @@ import { Gift, Loader2 } from 'lucide-react'; import { logger } from '@/utils/logger'; import BitcoinPaymentModal from '@/components/bitcoin/BitcoinPaymentModal'; import { useUserCurrency } from '@/hooks/useUserCurrency'; -import { convert, formatCurrency } from '@/services/currency'; +import { convert, formatCurrency, displayBTC } from '@/services/currency'; import { ENTITY_REGISTRY } from '@/config/entity-registry'; import { API_ROUTES } from '@/config/api-routes'; @@ -113,9 +113,12 @@ export function WishlistDonationTiers({
{items.map(item => { - const displayAmount = convert(item.target_amount_btc, 'SATS', userCurrency); + // target_amount_btc is BTC. Convert from BTC (not from SATS — the + // previous code passed BTC values to convert() with fromCurrency='SATS', + // which interpreted 0.001 BTC as 0.001 sats ≈ zero fiat). + const displayAmount = convert(item.target_amount_btc, 'BTC', userCurrency); const formattedAmount = formatCurrency(displayAmount, userCurrency, { compact: true }); - const satsDisplay = formatCurrency(item.target_amount_btc, 'SATS', { compact: true }); + const btcDisplay = displayBTC(item.target_amount_btc); return (