feat: redesign weight summary legend and add currency selector
Redesign WeightSummaryCard stats from a disconnected 4-column grid to a compact legend-style list with color dots, percentages, and a divider before the total row. Switch chart and legend colors to a neutral gray palette. Add a currency selector to settings (USD, EUR, GBP, JPY, CAD, AUD) that changes the displayed symbol across the app. This is visual only — no value conversion is performed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,25 @@ export function formatWeight(
|
||||
}
|
||||
}
|
||||
|
||||
export function formatPrice(cents: number | null | undefined): string {
|
||||
export type Currency = "USD" | "EUR" | "GBP" | "JPY" | "CAD" | "AUD";
|
||||
|
||||
const CURRENCY_SYMBOLS: Record<Currency, string> = {
|
||||
USD: "$",
|
||||
EUR: "€",
|
||||
GBP: "£",
|
||||
JPY: "¥",
|
||||
CAD: "CA$",
|
||||
AUD: "A$",
|
||||
};
|
||||
|
||||
export function formatPrice(
|
||||
cents: number | null | undefined,
|
||||
currency: Currency = "USD",
|
||||
): string {
|
||||
if (cents == null) return "--";
|
||||
return `$${(cents / 100).toFixed(2)}`;
|
||||
const symbol = CURRENCY_SYMBOLS[currency];
|
||||
if (currency === "JPY") {
|
||||
return `${symbol}${Math.round(cents / 100)}`;
|
||||
}
|
||||
return `${symbol}${(cents / 100).toFixed(2)}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user