From 91a8f65db48b1c04da88a9647429737a48cb1c6e Mon Sep 17 00:00:00 2001 From: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com> Date: Wed, 13 May 2026 03:58:34 +0000 Subject: [PATCH] chore: update --- lib/manager-context.tsx | 77 ----------------------------------------- 1 file changed, 77 deletions(-) diff --git a/lib/manager-context.tsx b/lib/manager-context.tsx index 7f65edc..25b7bb0 100644 --- a/lib/manager-context.tsx +++ b/lib/manager-context.tsx @@ -11,10 +11,7 @@ import { } from "react"; import { eateryClient } from "./apollo-clients"; -import { MENU_CATEGORIES, MOCK_COMBOS } from "./constants"; import type { - Combo, - MenuCategory, MenuItemEntity, addMenuItemMutation, allEateriesQuery, @@ -27,8 +24,6 @@ export type ManagerTab = "products" | "combos" | "categories" | "menu-items"; interface ManagerContextType { // Data products: MenuItemEntity[]; - combos: Combo[]; - categories: MenuCategory[]; // Active tab activeTab: ManagerTab; @@ -39,17 +34,6 @@ interface ManagerContextType { updateProduct: (product: MenuItemEntity) => void; deleteProduct: (id: string) => void; toggleProductAvailability: (id: string) => void; - - // Combo actions - addCombo: (combo: Omit) => void; - updateCombo: (combo: Combo) => void; - deleteCombo: (id: number) => void; - toggleComboAvailability: (id: number) => void; - - // Category actions - addCategory: (category: Omit) => void; - updateCategory: (category: MenuCategory) => void; - deleteCategory: (id: string) => void; } // ─── Context ────────────────────────────────────────────────────────────────── @@ -89,11 +73,6 @@ const ADD_MENU_ITEM = gql` export function ManagerProvider({ children }: { children: ReactNode }) { const [products, setProducts] = useState([]); - const [combos, setCombos] = useState(MOCK_COMBOS); - // Filter out the "all" pseudo-category — managers manage real categories only - const [categories, setCategories] = useState( - MENU_CATEGORIES.filter((c) => c.id !== "all"), - ); const [activeTab, setActiveTab] = useState("products"); const { data } = useQuery(GET_EATERY_MENU, { @@ -139,72 +118,16 @@ export function ManagerProvider({ children }: { children: ReactNode }) { ); }; - // ── Combo actions ──────────────────────────────────────────────────────── - - const addCombo = (combo: Omit) => { - const newCombo: Combo = { ...combo, id: Date.now() }; - setCombos((prev) => [...prev, newCombo]); - }; - - const updateCombo = (combo: Combo) => { - setCombos((prev) => prev.map((c) => (c.id === combo.id ? combo : c))); - }; - - const deleteCombo = (id: number) => { - setCombos((prev) => prev.filter((c) => c.id !== id)); - }; - - const toggleComboAvailability = (id: number) => { - setCombos((prev) => - prev.map((c) => (c.id === id ? { ...c, available: !c.available } : c)), - ); - }; - - // ── Category actions ───────────────────────────────────────────────────── - - const addCategory = (category: Omit) => { - const slug = category.name - .toLowerCase() - .normalize("NFD") - .replace(/[\u0300-\u036f]/g, "") - .replace(/[^a-z0-9]+/g, "-") - .replace(/(^-|-$)/g, ""); - const newCategory: MenuCategory = { - ...category, - id: `${slug}-${Date.now()}`, - }; - setCategories((prev) => [...prev, newCategory]); - }; - - const updateCategory = (category: MenuCategory) => { - setCategories((prev) => - prev.map((c) => (c.id === category.id ? category : c)), - ); - }; - - const deleteCategory = (id: string) => { - setCategories((prev) => prev.filter((c) => c.id !== id)); - }; - return ( {children}