diff --git a/marketplace/src/components/ProductCard.tsx b/marketplace/src/components/ProductCard.tsx index efd4145..06fb799 100644 --- a/marketplace/src/components/ProductCard.tsx +++ b/marketplace/src/components/ProductCard.tsx @@ -1,4 +1,5 @@ import { ProductWithDistance } from '../types/product' +import { formatCents } from '../utils/format' interface ProductCardProps { product: ProductWithDistance @@ -38,7 +39,7 @@ export const ProductCard = ({ product, onAddToCart }: ProductCardProps) => {
- R$ {(product.price_cents / 100).toFixed(2).replace('.', ',')} + {formatCents(product.price_cents)}

Itens: {summary.totalItems}

-

R$ {summary.totalValue.toFixed(2)}

+

R$ {formatCurrency(summary.totalValue)}

{items.length === 0 ? ( @@ -58,7 +59,7 @@ export function CartPage() {

Preço

-

R$ {item.unitPrice.toFixed(2)}

+

R$ {formatCurrency(item.unitPrice)}

Subtotal

- R$ {(item.quantity * item.unitPrice).toFixed(2)} + R$ {formatCurrency(item.quantity * item.unitPrice)}

@@ -109,3 +110,4 @@ export function CartPage() { ) } + diff --git a/marketplace/src/pages/Dashboard.tsx b/marketplace/src/pages/Dashboard.tsx index a9a98be..218fbd4 100644 --- a/marketplace/src/pages/Dashboard.tsx +++ b/marketplace/src/pages/Dashboard.tsx @@ -3,6 +3,7 @@ import { FixedSizeList as List, ListChildComponentProps } from 'react-window' import { Product } from '../types/product' import { useCartStore } from '../stores/cartStore' import { Shell } from '../layouts/Shell' +import { formatCents } from '../utils/format' // Mock data updated to match new Product interface const mockProducts: Product[] = Array.from({ length: 500 }).map((_, idx) => { @@ -33,7 +34,7 @@ function DenseRow({ index, style, data }: ListChildComponentProps) {
{product.description}
{product.batch}
{product.expires_at}
-
R$ {(product.price_cents / 100).toFixed(2)}
+
{formatCents(product.price_cents)}