From ef2bfa5f05cb61a4e31a4062c588cab47c6d9621 Mon Sep 17 00:00:00 2001 From: muken Date: Tue, 30 Jun 2026 00:13:30 -0500 Subject: [PATCH] fix: properly track featured_photo state in menu editor --- src/app/admin/page.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 921a329..9b17144 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -1524,7 +1524,8 @@ function MenuSection({ items, setItems, images, onToast }: any) { function MenuEditor({ item, setItem, onSave, onCancel }: any) { const [localPhotos, setLocalPhotos] = useState(item.photos || []); - const i = { ...item, photos: localPhotos }; + const [featuredPhoto, setFeaturedPhoto] = useState(item.featured_photo || null); + const i = { ...item, photos: localPhotos, featured_photo: featuredPhoto }; const addPhotos = async (files: FileList) => { const newPhotos: string[] = []; @@ -1565,13 +1566,13 @@ function MenuEditor({ item, setItem, onSave, onCancel }: any) { setItem({ ...i, featured_photo: ph })} + onClick={() => setFeaturedPhoto(ph)} style={{ - width: 64, height: 48, objectFit: 'cover', borderRadius: 6, border: i.featured_photo === ph ? `2px solid ${C.gold}` : '1px solid #eee', + width: 64, height: 48, objectFit: 'cover', borderRadius: 6, border: featuredPhoto === ph ? `2px solid ${C.gold}` : '1px solid #eee', cursor: 'pointer', }} /> - ))}