fix: better ui (#45)
Release package / release (push) Successful in 12m29s

Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #45
This commit was merged in pull request #45.
This commit is contained in:
2026-05-15 06:26:00 +00:00
parent 27bb95dea5
commit 3a5cfd0494
4 changed files with 53 additions and 4 deletions
+6
View File
@@ -12,6 +12,7 @@ import {
import { eateryClient } from "./apollo-clients";
import {
EateryEntity,
type MenuItemEntity,
type addMenuItemMutation,
type allEateriesQuery,
@@ -27,6 +28,7 @@ interface ManagerContextType {
// Data
products: MenuItemEntity[];
eateryId: string | null;
eatery?: EateryEntity;
// Active tab
activeTab: ManagerTab;
@@ -49,6 +51,7 @@ const GET_EATERY_MENU = gql`
query GetEateryMenu {
allEateries {
id
name
menuItems {
id
name
@@ -97,6 +100,7 @@ const DELETE_MENU_ITEM = gql`
export function ManagerProvider({ children }: { children: ReactNode }) {
const [products, setProducts] = useState<MenuItemEntity[]>([]);
const [eatery, setEatery] = useState<EateryEntity>();
const [activeTab, setActiveTab] = useState<ManagerTab>("products");
const { data } = useQuery<allEateriesQuery>(GET_EATERY_MENU, {
@@ -123,6 +127,7 @@ export function ManagerProvider({ children }: { children: ReactNode }) {
useEffect(() => {
if (data?.allEateries?.[0]) {
setProducts(data.allEateries[0].menuItems);
setEatery(data.allEateries[0]);
}
}, [data]);
@@ -193,6 +198,7 @@ export function ManagerProvider({ children }: { children: ReactNode }) {
return (
<ManagerContext.Provider
value={{
eatery,
products,
eateryId,
activeTab,