feat(33-05): market/currency selector, dual price format, conversion toggle
- Add formatDualPrice() with ~prefix for approximate conversions (D-14) - Evolve useCurrency() to return CurrencyContext with currency, market, showConversions - Create useExchangeRates hook + convertClientPrice utility - Redesign settings: Market & Currency selector, Show Converted Prices toggle - Add locale-based auto-suggestion banner for first-time currency selection (D-13) - Update useFormatters to destructure from new CurrencyContext Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,3 +43,23 @@ export function formatPrice(
|
||||
}
|
||||
return `${symbol}${(cents / 100).toFixed(2)}`;
|
||||
}
|
||||
|
||||
export interface DualPriceOptions {
|
||||
sourceCents: number;
|
||||
sourceCurrency: Currency;
|
||||
targetCurrency: Currency;
|
||||
convertedCents: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a price with dual display: source price + converted in parentheses.
|
||||
* Per D-14: "€2,000 (~£1,720)" — source prominent, converted approximate.
|
||||
*/
|
||||
export function formatDualPrice(options: DualPriceOptions): {
|
||||
source: string;
|
||||
converted: string;
|
||||
} {
|
||||
const source = formatPrice(options.sourceCents, options.sourceCurrency);
|
||||
const converted = `~${formatPrice(options.convertedCents, options.targetCurrency)}`;
|
||||
return { source, converted };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user