rework app shell, strip coach hooks, wire barcode flow

rename state vars throughout, add barcode scanner trigger and draft flow,
drop coach navigation and session, add ForecastPoint type
This commit is contained in:
Ned Halksworth
2026-05-27 17:30:55 +01:00
committed by Ned
parent ea8b10a81f
commit cbdd98e133
2 changed files with 904 additions and 795 deletions
+804 -743
View File
File diff suppressed because it is too large Load Diff
+64 -16
View File
@@ -34,6 +34,57 @@ export type EntryDraft = Omit<
source?: RedBullEntry["source"]; source?: RedBullEntry["source"];
}; };
export type BarcodeFormatName = "ean-13" | "ean-8" | "upc-a" | "upc-e" | "unknown";
export type BarcodeProductDraft = {
flavourName: string;
sizeMl: number;
pricePerCan: number;
sugarFree?: boolean;
caffeineMgPerCan?: number;
};
export type ResolvedBarcodeProduct = BarcodeProductDraft & {
flavourAccent: string;
source: "built-in" | "user";
};
export type BarcodeSeedProduct = BarcodeProductDraft & {
verifiedBy: string;
sourceName?: string;
sourceUrl?: string;
notes?: string;
variant?: string;
};
export type UserBarcodeMapping = BarcodeProductDraft & {
barcode: string;
createdAt: string;
updatedAt: string;
};
export type BarcodeLookupCatalog = {
verifiedProducts?: Record<string, BarcodeSeedProduct>;
userMappings?: UserBarcodeMapping[];
};
export type BarcodeLookupResult =
| {
status: "known" | "user";
barcode: string;
product: ResolvedBarcodeProduct;
}
| {
status: "partial";
barcode: string;
product: BarcodeProductDraft;
reason: string;
}
| {
status: "unknown";
barcode: string;
};
export type Filters = { export type Filters = {
flavour: string; flavour: string;
dateRange: DateFilter; dateRange: DateFilter;
@@ -55,22 +106,19 @@ export type ImportPreview = {
rows: ImportPreviewRow[]; rows: ImportPreviewRow[];
}; };
export type ChatRole = "user" | "assistant"; export type UserLimits = {
dailyCanLimit?: number;
export type CoachMessage = { dailySpendLimit?: number;
id: string; stopTime?: string;
role: ChatRole;
content: string;
thinking?: string;
pending?: boolean;
stopped?: boolean;
}; };
export type CoachChat = { export type LimitViolation = "cans" | "spend" | "stopTime";
id: string;
userId: string; export type LimitCheckResult = {
title: string; violations: LimitViolation[];
messages: CoachMessage[]; projectedCans: number;
createdAt: string; projectedSpend: number;
updatedAt: string; todayCans: number;
todaySpend: number;
pastStopTime: boolean;
}; };