feat(01-03): add data hooks, utilities, UI store, and foundational components
- 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>
This commit is contained in:
9
src/client/lib/formatters.ts
Normal file
9
src/client/lib/formatters.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
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)}`;
|
||||
}
|
||||
Reference in New Issue
Block a user