From 7f8e363b5b21cb06a276a25261dd3e93c11c9b9c Mon Sep 17 00:00:00 2001 From: siddharthd Date: Mon, 10 Aug 2026 18:02:51 +1000 Subject: [PATCH] order details: hide the review surface for spine-bridged retail rows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verdicts are the meal lane's feedback loop (loved/never steers the next restaurant order and the nudge card warns on re-order). Bridge rows (source='order-bridge': Amazon, eBay, Officeworks...) have no such loop, so ItemVerdictToggle and OrderVerdict stay hidden there. The order API now returns 'source'; OrderReceipt.platform widened to string — the bridge writes real platform slugs beyond the meal trio. --- src/app/api/transactions/[id]/order/route.ts | 2 +- src/components/order-details.tsx | 37 +++++++++++++------- src/lib/hooks.ts | 4 ++- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/app/api/transactions/[id]/order/route.ts b/src/app/api/transactions/[id]/order/route.ts index ee3fc9f..844815f 100644 --- a/src/app/api/transactions/[id]/order/route.ts +++ b/src/app/api/transactions/[id]/order/route.ts @@ -26,7 +26,7 @@ export async function GET( } const row = await queryRow( - `SELECT platform, order_reference, line_items, route, subtotal, amount, + `SELECT source, platform, order_reference, line_items, route, subtotal, amount, currency, card_last4, flags, source_email_subject, transaction_date FROM expense_metadata -- A card-settled order creates no transaction of its own (I5): the diff --git a/src/components/order-details.tsx b/src/components/order-details.tsx index ee3643e..9e41890 100644 --- a/src/components/order-details.tsx +++ b/src/components/order-details.tsx @@ -81,6 +81,13 @@ export function OrderDetails({ const mine = review?.reviews.find((r) => r.participant_id === reviewer); + // Verdicts are the MEAL lane's feedback loop — "loved / never again" exists + // to steer the next restaurant order, and the nudge card warns on re-order. + // Spine-bridged retail (Amazon boxes, eBay, Officeworks) has no such loop: + // rating a roller-shade motor "order again?" is noise, so the whole review + // surface stays hidden for bridge rows. + const rateable = receipt.source !== "order-bridge"; + return (
@@ -106,14 +113,16 @@ export function OrderDetails({ {it.options.join(" · ")} )} - + {rateable && ( + + )} {/* Spine-bridged receipts (Amazon shipment notices, eBay) often name the goods without per-item prices — a null here is "the mail didn't say", and printing $0.00 would assert it did. */} @@ -152,11 +161,13 @@ export function OrderDetails({

)} - + {rateable && ( + + )}
); } diff --git a/src/lib/hooks.ts b/src/lib/hooks.ts index 6f4bad7..92c2617 100644 --- a/src/lib/hooks.ts +++ b/src/lib/hooks.ts @@ -257,7 +257,9 @@ export function useTransactionSplits(transactionId: number) { } export interface OrderReceipt { - platform: "doordash" | "ubereats" | "uber" | null; + /** 'email' | 'receipt-scan' | 'order-bridge' | ... — which lane wrote the row. */ + source: string | null; + platform: string | null; order_reference: string | null; line_items: { qty: number; description: string; amount: number; options?: string[] }[]; route: { label: string; time: string | null; address: string }[];