- API fetch wrapper with error handling and multipart upload - Weight/price formatters for display - TanStack Query hooks for items, categories, and totals with cache invalidation - Zustand UI store for panel and confirm dialog state - TotalsBar, CategoryHeader, ItemCard, ConfirmDialog, ImageUpload components Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
10 lines
293 B
TypeScript
10 lines
293 B
TypeScript
export function formatWeight(grams: number | null | undefined): string {
|
|
if (grams == null) return "--";
|
|
return `${Math.round(grams)}g`;
|
|
}
|
|
|
|
export function formatPrice(cents: number | null | undefined): string {
|
|
if (cents == null) return "--";
|
|
return `$${(cents / 100).toFixed(2)}`;
|
|
}
|