feat: wire currency conversion into price display
useFormatters().price() now accepts an optional sourceCurrency param. When showConversions is enabled and the source differs from the user's currency, it converts via ECB rates and shows dual format: "€200.00 (~$218.00)". ItemCard and CollectionView pass priceCurrency through from API data. Setup detail items also pass priceCurrency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ interface ItemCardProps {
|
||||
classification?: string;
|
||||
onClassificationCycle?: () => void;
|
||||
linkTo?: string | null;
|
||||
priceCurrency?: string | null;
|
||||
}
|
||||
|
||||
export function ItemCard({
|
||||
@@ -48,6 +49,7 @@ export function ItemCard({
|
||||
classification,
|
||||
onClassificationCycle,
|
||||
linkTo,
|
||||
priceCurrency,
|
||||
}: ItemCardProps) {
|
||||
const { weight, price } = useFormatters();
|
||||
const navigate = useNavigate();
|
||||
@@ -232,7 +234,7 @@ export function ItemCard({
|
||||
)}
|
||||
{priceCents != null && (
|
||||
<span className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-50 text-green-500">
|
||||
{price(priceCents)}
|
||||
{price(priceCents, priceCurrency)}
|
||||
</span>
|
||||
)}
|
||||
<span className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-50 text-gray-600">
|
||||
|
||||
Reference in New Issue
Block a user