From 197b8d76d0414f5f2f7cb32c4f4d8841ee3e6c38 Mon Sep 17 00:00:00 2001 From: rxshellg Date: Wed, 11 Feb 2026 15:11:13 -0500 Subject: [PATCH 1/2] Added item IDs and assignment fields --- src/types/index.ts | 23 +++++++++++++++++++++++ src/utils/parseReceipt.ts | 11 +++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/types/index.ts diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..afbab60 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,23 @@ +// Core types that the whole app will use +export type Item = { + id: string; + name: string; + price: number; + quantity: number; + assignedTo: string[]; + splitType: 'equal' | 'custom'; +}; + +export type Person = { + id: string; + name: string; + color: string; + total: number; + items: string[]; +}; + +export type Assignment = { + itemId: string; + personIds: string[]; + splitType: 'equal' | 'custom'; +}; \ No newline at end of file diff --git a/src/utils/parseReceipt.ts b/src/utils/parseReceipt.ts index e552377..2ccdee9 100644 --- a/src/utils/parseReceipt.ts +++ b/src/utils/parseReceipt.ts @@ -1,4 +1,4 @@ -export type Item = { name: string; price: number; quantity: number }; +import type { Item } from '../types'; const BANNED = ["total", "subtotal", "admin", "tax", "change", "instagram"]; @@ -39,7 +39,14 @@ export function parseItems(ocrText: string): Item[] { return null; } - return { name, price, quantity } as Item; + return { + id: crypto.randomUUID(), + name, + price, + quantity, + assignedTo: [], + splitType: 'equal' as const + } as Item; }) .filter(Boolean) as Item[]; From 3221051a411fb2797e15156d305e614b021768fe Mon Sep 17 00:00:00 2001 From: rxshellg Date: Wed, 11 Feb 2026 15:17:05 -0500 Subject: [PATCH 2/2] Updated Item imports --- src/pages/Review.tsx | 3 ++- src/pages/Split.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/Review.tsx b/src/pages/Review.tsx index 74d8de9..9f55cd7 100644 --- a/src/pages/Review.tsx +++ b/src/pages/Review.tsx @@ -1,6 +1,7 @@ import { useLocation, useNavigate } from "react-router-dom"; import { useState, useEffect } from "react"; -import { parseItems, type Item } from "../utils/parseReceipt"; +import { parseItems } from "../utils/parseReceipt"; +import type { Item } from "../types"; const Review = () => { const ocrText = useLocation().state?.ocrText || ""; diff --git a/src/pages/Split.tsx b/src/pages/Split.tsx index 4c66b1d..463d641 100644 --- a/src/pages/Split.tsx +++ b/src/pages/Split.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import { useLocation } from "react-router-dom"; -import type { Item } from "../utils/parseReceipt"; +import type { Item } from "../types"; import useIsMobile from "../hooks/useIsMobile"; import { usePeople, PeopleChips, AddPersonModal } from "../components/PeopleManager";