diff --git a/README.md b/README.md index 877353c..cb39967 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,8 @@ new) and touches nothing else. - `name` / `variant` — variants are **separate products** whenever their price differs ("Penne Arrabiata" + variant "Veg" ₹589 / "Chicken" ₹639); the POS can group by `name` - `description` -- `price` — number, whole rupees (449 = ₹449) +- `price` — number, rupees with optional paise after the decimal point + (449 = ₹449, 449.5 = ₹449.50) - `diet` — select: `veg` / `nonveg` / `mixed` (a bool can't be null in PocketBase, so mixed items like Caesar Salad use `mixed`; the site renders no badge for it) - `pairing` — optional beer pairing diff --git a/app/src/components/menu-browser.tsx b/app/src/components/menu-browser.tsx index 0267034..78868cd 100644 --- a/app/src/components/menu-browser.tsx +++ b/app/src/components/menu-browser.tsx @@ -62,6 +62,11 @@ export function MenuBrowser({ ) } +/** ₹449 for whole rupees, ₹449.50 when paise are set. */ +function formatPrice(price: number): string { + return Number.isInteger(price) ? String(price) : price.toFixed(2) +} + function MenuCard({ item }: { item: MenuItem }) { const icon = CATEGORY_ICONS[item.category] ?? 'restaurant' const showFooter = Boolean(item.pairing || item.tag) @@ -93,7 +98,9 @@ function MenuCard({ item }: { item: MenuItem }) { – {item.variant} ) : null} - ₹{item.price} + + ₹{formatPrice(item.price)} + {item.description ? (

{item.description}

diff --git a/app/src/data/menu-data.mjs b/app/src/data/menu-data.mjs index b34fc91..edaf435 100644 --- a/app/src/data/menu-data.mjs +++ b/app/src/data/menu-data.mjs @@ -10,7 +10,8 @@ * - Variants are separate products whenever their price differs * ("Penne Arrabiata" + variant "Veg" 589 / "Chicken" 639). * - Same-price choice lists (flavours, sauces) stay on one item in `tag`. - * - price: number, whole rupees (449 = ₹449). + * - price: number, rupees with optional paise after the decimal point + * (449 = ₹449, 449.5 = ₹449.50). * - diet: 'veg' | 'nonveg' | 'mixed' (PB bools can't be null, so a select is used). * - sku: stable GB-- code for POS mapping. * - tax_category: default "food-5-gst" — adjust per item if the POS needs it. diff --git a/app/src/lib/types.ts b/app/src/lib/types.ts index 8a39427..20fec9c 100644 --- a/app/src/lib/types.ts +++ b/app/src/lib/types.ts @@ -73,7 +73,7 @@ export interface MenuItem { /** "Veg", "Chicken", "Basa", "Half"… — same dish, different product. */ variant?: string description?: string - /** Whole rupees (449 = ₹449). */ + /** Rupees as a decimal number; paise after the point (449.5 = ₹449.50). */ price: number /** Dietary status; 'mixed' items (e.g. Caesar Salad) get no badge. */ diet?: 'veg' | 'nonveg' | 'mixed'