mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-06 01:27:43 +01:00
fix(currency): drain SATS-stale display + WishlistDonationTiers unit bug
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) <noreply@anthropic.com>
This commit is contained in:
1 parent
ffad811506
commit
94de8f554d
3 files changed
+22
-19
No files matched your search
@@ -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"
|
||||
>
|
||||
<option value={50000}>50k sats / month (~$50)</option>
|
||||
<option value={100000}>100k sats / month (~$100)</option>
|
||||
<option value={250000}>250k sats / month (~$250)</option>
|
||||
<option value={0.0005}>{formatAmountBtc(0.0005)} / month</option>
|
||||
<option value={0.001}>{formatAmountBtc(0.001)} / month</option>
|
||||
<option value={0.0025}>{formatAmountBtc(0.0025)} / month</option>
|
||||
</select>
|
||||
<span className="text-xs text-muted-foreground">per month</span>
|
||||
</div>
|
||||
|
||||
@@ -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:'}
|
||||
</p>
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
{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 (
|
||||
<button
|
||||
key={sats}
|
||||
key={btc}
|
||||
onClick={() => {
|
||||
copyToClipboard(bitcoinAddress, 'Bitcoin address');
|
||||
toast.success(`Address copied! Send ${satsDisplay}`, {
|
||||
toast.success(`Address copied! Send ${btcDisplay}`, {
|
||||
description: `Suggested ${label.toLowerCase()} support (≈ ${formattedAmount})`,
|
||||
});
|
||||
}}
|
||||
@@ -221,7 +221,7 @@ export function ProjectDonationSection({
|
||||
<div className="font-semibold text-foreground group-hover:text-bitcoinOrange">
|
||||
{formattedAmount}
|
||||
</div>
|
||||
<div className="text-xs text-muted-dim mt-0.5">≈ {satsDisplay}</div>
|
||||
<div className="text-xs text-muted-dim mt-0.5">≈ {btcDisplay}</div>
|
||||
<div className="text-xs text-muted-foreground mt-1">{label}</div>
|
||||
</button>
|
||||
);
|
||||
|
||||
@@ -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({
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
{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 (
|
||||
<button
|
||||
@@ -126,7 +129,7 @@ export function WishlistDonationTiers({
|
||||
<span className="text-sm font-bold text-foreground group-hover:text-bitcoinOrange">
|
||||
{formattedAmount}
|
||||
</span>
|
||||
<span className="text-xs text-muted-dim mt-0.5">≈ {satsDisplay}</span>
|
||||
<span className="text-xs text-muted-dim mt-0.5">≈ {btcDisplay}</span>
|
||||
<span className="text-xs text-muted-foreground mt-1 line-clamp-1">{item.title}</span>
|
||||
<div className="w-full bg-muted rounded-full h-1 mt-3">
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user