import { Drawer } from "expo-router/drawer"; import { DrawerContentScrollView, DrawerItem } from "@react-navigation/drawer"; import { useRouter, Redirect } from "expo-router"; import { useNavigation, DrawerActions } from "@react-navigation/native"; import { TouchableOpacity, DeviceEventEmitter, View, ActivityIndicator, } from "react-native"; import MaterialIcons from "@expo/vector-icons/MaterialIcons"; import { REFRESH_EVENT } from "common-ui/src/lib/const-strs"; import { useStaffAuth } from "@/components/context/staff-auth-context"; import { tw, MyText, theme } from "common-ui"; function CustomDrawerContent() { const router = useRouter(); const { logout, staff } = useStaffAuth(); return ( {staff && ( {staff.name} Staff Member )} router.push("/(drawer)/dashboard" as any)} icon={({ color, size }) => ( )} /> {/* router.push("/(drawer)/add-product" as any)} icon={({ color, size }) => ( )} /> */} router.push("/(drawer)/products" as any)} icon={({ color, size }) => ( )} /> router.push("/(drawer)/prices-overview" as any)} icon={({ color, size }) => ( )} /> router.push("/(drawer)/product-groupings" as any)} icon={({ color, size }) => ( )} /> router.push("/(drawer)/dashboard-banners" as any)} icon={({ color, size }) => ( )} /> router.push("/(drawer)/slots" as any)} icon={({ color, size }) => ( )} /> {/* router.push("/(drawer)/edit-product" as any)} icon={({ color, size }) => ( )} /> */} router.push("/(drawer)/complaints" as any)} icon={({ color, size }) => ( )} /> router.push("/(drawer)/manage-orders" as any)} icon={({ color, size }) => ( )} /> router.push("coupons" as any)} icon={({ color, size }) => ( )} /> router.push("vendor-snippets" as any)} icon={({ color, size }) => ( )} /> router.push("/(drawer)/stores" as any)} icon={({ color, size }) => ( )} /> logout()} icon={({ color, size }) => ( )} /> ); } export default function Layout() { const { isLoggedIn, isLoading } = useStaffAuth(); if (isLoading) { return ( ); } if (!isLoggedIn) { return ; } return ( ({ headerShown: true, headerStyle: { backgroundColor: theme.colors.gray1, shadowOpacity: 0, shadowRadius: 0, shadowOffset: { height: 0, width: 0 }, elevation: 0, }, headerTitleAlign: "center", headerLeft: () => ( (navigation as any).openDrawer()} style={{ marginLeft: 15, width: 40, height: 40, borderRadius: 20, backgroundColor: "#f2f2f2", justifyContent: "center", alignItems: "center", }} > ), headerRight: () => ( { DeviceEventEmitter.emit(REFRESH_EVENT); }} > ), })} > ); }