This commit is contained in:
shafi54 2026-02-07 01:32:28 +05:30
parent 3ed324bde7
commit 31f011ba8c
39 changed files with 56 additions and 6565 deletions

File diff suppressed because one or more lines are too long

View file

@ -152,6 +152,7 @@ export default function Layout() {
backBehavior="history"
drawerContent={CustomDrawerContent}
screenOptions={({ navigation, route }) => ({
swipeEnabled: false,
headerShown: true,
headerStyle: {
backgroundColor: theme.colors.gray1,
@ -197,33 +198,26 @@ export default function Layout() {
),
})}
>
<Drawer.Screen name="dashboard" options={{ title: "Dashboard" }} />
<Drawer.Screen name="add-product" options={{ title: "Add Product" }} />
<Drawer.Screen name="dashboard" options={{ title: "Dashboard" }} />
<Drawer.Screen name="products" options={{ title: "Products" }} />
<Drawer.Screen name="prices-overview" options={{ title: "Prices Overview" }} />
<Drawer.Screen name="product-groupings" options={{ title: "Product Groupings" }} />
<Drawer.Screen name="create-product-group" options={{ title: "Create Product Group" }} />
<Drawer.Screen name="edit-product-group/[id]" options={{ title: "Edit Product Group" }} />
<Drawer.Screen name="edit-product" options={{ title: "Edit Product" }} />
<Drawer.Screen
name="manage-orders"
options={{ title: "Manage Orders" }}
/>
<Drawer.Screen name="complaints" options={{ title: "Complaints" }} />
<Drawer.Screen name="coupons" options={{ title: "Coupons" }} />
<Drawer.Screen name="create-coupon" options={{ title: "Create Coupon" }} />
<Drawer.Screen name="edit-coupon/[id]" options={{ title: "Edit Coupon" }} />
<Drawer.Screen name="slots" options={{ title: "Slots" }} />
<Drawer.Screen name="add-slot" options={{ title: "Add Slot" }} />
<Drawer.Screen name="edit-slot/[id]" options={{ title: "Edit Slot" }} />
<Drawer.Screen name="coupons" options={{ title: "Coupons" }} />
<Drawer.Screen name="slots" options={{ title: "Slots" }} />
<Drawer.Screen name="vendor-snippets" options={{ title: "Vendor Snippets" }} />
<Drawer.Screen name="delivery-sequences" options={{ title: "Delivery Sequences", headerShown: false }} />
<Drawer.Screen name="stores" options={{ title: "Stores" }} />
<Drawer.Screen name="address-management" options={{ title: "Address Management" }} />
<Drawer.Screen name="product-tags" options={{ title: "Product Tags" }} />
<Drawer.Screen name="add-tag" options={{ title: "Add Tag" }} />
<Drawer.Screen name="edit-tag" options={{ title: "Edit Tag" }} />
<Drawer.Screen name="order-details/[id]" options={{ title: "Order Details" }} />
<Drawer.Screen name="orders" options={{ title: "Orders" }} />
<Drawer.Screen name="rebalance-orders" options={{ title: "Rebalance Orders" }} />

View file

@ -1,15 +0,0 @@
import { Stack } from "expo-router";
export default function Layout() {
return (
<Stack>
<Stack.Screen
name="index"
options={{
title: "Add Product",
headerShown: false,
}}
/>
</Stack>
);
}

View file

@ -1,9 +0,0 @@
import { Stack } from 'expo-router';
export default function Layout() {
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: 'Add Slot' }} />
</Stack>
);
}

View file

@ -1,9 +0,0 @@
import { Stack } from 'expo-router';
export default function Layout() {
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: 'Add Store' }} />
</Stack>
);
}

View file

@ -1,15 +0,0 @@
import { Stack } from "expo-router";
export default function Layout() {
return (
<Stack>
<Stack.Screen
name="index"
options={{
title: "Add Tag",
headerShown: false,
}}
/>
</Stack>
);
}

View file

@ -2,14 +2,10 @@ import { Stack } from "expo-router";
export default function Layout() {
return (
<Stack>
<Stack.Screen
name="index"
options={{
title: "Coupons",
headerShown: false,
}}
/>
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: "Coupons" }} />
<Stack.Screen name="create" options={{ title: "Create Coupon" }} />
<Stack.Screen name="edit/[id]" options={{ title: "Edit Coupon" }} />
</Stack>
);
}

View file

@ -1,7 +1,7 @@
import React from 'react';
import { View, Alert } from 'react-native';
import { tw, AppContainer } from 'common-ui';
import CouponForm from '../../../src/components/CouponForm';
import CouponForm from '@/src/components/CouponForm';
import { trpc } from '@/src/trpc-client';
import { useRouter } from 'expo-router';

View file

@ -1,7 +1,7 @@
import React from 'react';
import { View, Alert } from 'react-native';
import { tw, AppContainer, MyText } from 'common-ui';
import CouponForm from '../../../../src/components/CouponForm';
import CouponForm from '@/src/components/CouponForm';
import { trpc } from '@/src/trpc-client';
import { useRouter, useLocalSearchParams } from 'expo-router';
import dayjs from 'dayjs';

View file

@ -90,7 +90,7 @@ const CouponItem = ({ item, onDelete }: { item: any; onDelete: (id: number) => v
<View style={tw`flex-row mt-3 gap-2`}>
<TouchableOpacity
onPress={() => router.push(`/(drawer)/edit-coupon/${item.id}`)}
onPress={() => router.push(`/coupons/edit/${item.id}`)}
style={tw`bg-blue-500 p-3 rounded-lg shadow-md flex-1 flex-row items-center justify-center`}
>
<MaterialCommunityIcons name="pencil" size={16} color="white" />
@ -497,7 +497,7 @@ export default function Coupons() {
)}
/>
<MyTouchableOpacity
onPress={() => router.push('/(drawer)/create-coupon')}
onPress={() => router.push('/coupons/create')}
activeOpacity={0.95}
style={{ position: 'absolute', bottom: 32, right: 24, zIndex: 100 }}
>

View file

@ -217,7 +217,7 @@ export default function ReservedCoupons() {
</View>
<MyText style={tw`text-xl font-semibold text-gray-600 mb-2`}>No Reserved Coupons Yet</MyText>
<MyText style={tw`text-gray-500 text-center mb-4`}>Create your first reserved coupon to start offering secret discounts</MyText>
<MyButton onPress={() => router.push('/(drawer)/create-coupon')} style={tw`bg-blue-500`}>
<MyButton onPress={() => router.push('/coupons/create')} style={tw`bg-blue-500`}>
<View style={tw`flex-row items-center`}>
<MaterialCommunityIcons name="plus" size={16} color="white" />
<MyText style={tw`text-white font-semibold ml-1`}>Create Reserved Coupon</MyText>
@ -230,7 +230,7 @@ export default function ReservedCoupons() {
{/* FAB for Add New Reserved Coupon */}
<MyTouchableOpacity
onPress={() => router.push('/(drawer)/create-coupon')}
onPress={() => router.push('/coupons/create')}
activeOpacity={0.95}
style={{ position: 'absolute', bottom: 32, right: 24, zIndex: 100 }}
>

View file

@ -1,9 +0,0 @@
import { Stack } from "expo-router";
export default function Layout() {
return (
<Stack>
<Stack.Screen name="index" options={{ title: "Create Coupon", headerShown: false }} />
</Stack>
);
}

View file

@ -91,7 +91,7 @@ export default function Dashboard() {
title: 'Add Product',
icon: 'add-circle',
description: 'Create a new product listing',
route: '/(drawer)/add-product',
route: '/products/add',
category: 'quick',
iconColor: theme.colors.brand500,
iconBg: theme.colors.brand50,

View file

@ -1,15 +0,0 @@
import { Stack } from "expo-router";
export default function Layout() {
return (
<Stack>
<Stack.Screen
name="index"
options={{
title: "Edit Product",
headerShown: false,
}}
/>
</Stack>
);
}

View file

@ -1,9 +0,0 @@
import { Stack } from 'expo-router';
export default function Layout() {
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="[id]" options={{ title: 'Edit Slot' }} />
</Stack>
);
}

View file

@ -1,9 +0,0 @@
import { Stack } from 'expo-router';
export default function Layout() {
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: 'Edit Store' }} />
</Stack>
);
}

View file

@ -1,15 +0,0 @@
import { Stack } from "expo-router";
export default function Layout() {
return (
<Stack>
<Stack.Screen
name="index"
options={{
title: "Edit Tag",
headerShown: false,
}}
/>
</Stack>
);
}

View file

@ -1,9 +0,0 @@
import { Stack } from 'expo-router';
export default function Layout() {
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="[id]" options={{ title: 'Product Detail' }} />
</Stack>
);
}

View file

@ -2,14 +2,10 @@ import { Stack } from "expo-router";
export default function Layout() {
return (
<Stack>
<Stack.Screen
name="index"
options={{
title: "Product Tags",
headerShown: false,
}}
/>
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: "Product Tags" }} />
<Stack.Screen name="add" options={{ title: "Add Tag" }} />
<Stack.Screen name="edit/index" options={{ title: "Edit Tag" }} />
</Stack>
);
}

View file

@ -78,7 +78,7 @@ export default function ProductTags() {
};
const handleAddNewTag = () => {
router.push('/(drawer)/add-tag');
router.push('/product-tags/add');
};

View file

@ -4,6 +4,9 @@ export default function Layout() {
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: 'Products' }} />
<Stack.Screen name="add" options={{ title: 'Add Product' }} />
<Stack.Screen name="edit" options={{ title: 'Edit Product' }} />
<Stack.Screen name="detail/[id]" options={{ title: 'Product Detail' }} />
</Stack>
);
}

View file

@ -1,8 +1,8 @@
import React from 'react';
import { Alert } from 'react-native';
import { AppContainer } from 'common-ui';
import ProductForm from '../../../src/components/ProductForm';
import { useCreateProduct, CreateProductPayload } from '../../../src/api-hooks/product.api';
import ProductForm from '@/src/components/ProductForm';
import { useCreateProduct, CreateProductPayload } from '@/src/api-hooks/product.api';
export default function AddProduct() {
const { mutate: createProduct, isPending: isCreating } = useCreateProduct();

View file

@ -177,7 +177,7 @@ export default function ProductDetail() {
const product = productData?.product;
const handleEdit = () => {
router.push(`/edit-product?id=${productId}` as any);
router.push(`/products/edit?id=${productId}` as any);
};

View file

@ -2,8 +2,8 @@ import React, { useRef } from 'react';
import { View, Text, Alert } from 'react-native';
import { useLocalSearchParams } from 'expo-router';
import { AppContainer, useManualRefresh, MyText, tw } from 'common-ui';
import ProductForm, { ProductFormRef } from '../../../src/components/ProductForm';
import { useUpdateProduct } from '../../../src/api-hooks/product.api';
import ProductForm, { ProductFormRef } from '@/src/components/ProductForm';
import { useUpdateProduct } from '@/src/api-hooks/product.api';
import { trpc } from '@/src/trpc-client';
export default function EditProduct() {

View file

@ -48,7 +48,7 @@ export default function Products() {
}, [products, searchTerm, activeFilter]);
const handleEdit = (productId: number) => {
router.push(`/edit-product?id=${productId}` as any);
router.push(`/products/edit?id=${productId}` as any);
};
@ -80,7 +80,7 @@ export default function Products() {
};
const handleViewDetails = (productId: number) => {
router.push(`/product-detail/${productId}` as any);
router.push(`/products/detail/${productId}` as any);
};
const FilterButton = ({ filter, label, count }: { filter: FilterType; label: string; count: number }) => (
@ -129,7 +129,7 @@ export default function Products() {
{/* Header */}
<View style={tw`flex-row justify-between items-center mb-6`}>
<MyText style={tw`text-2xl font-bold text-gray-800`}>Products</MyText>
<MyButton onPress={() => router.push('/add-product' as any)}>
<MyButton onPress={() => router.push('/products/add' as any)}>
Add Product
</MyButton>
</View>

View file

@ -5,6 +5,8 @@ export default function Layout() {
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: 'Slots' }} />
<Stack.Screen name="slot-details" options={{ title: 'Slot Details' }} />
<Stack.Screen name="add" options={{ title: 'Add Slot' }} />
<Stack.Screen name="edit/[id]" options={{ title: 'Edit Slot' }} />
</Stack>
);
}

View file

@ -1,9 +1,9 @@
import React from 'react';
import { View, Text } from 'react-native';
import { AppContainer } from 'common-ui';
import SlotForm from '../../../components/SlotForm';
import SlotForm from '@/components/SlotForm';
import { useRouter, useLocalSearchParams } from 'expo-router';
import { trpc } from '../../../src/trpc-client';
import { trpc } from '@/src/trpc-client';
export default function AddSlot() {
const router = useRouter();
@ -35,7 +35,7 @@ export default function AddSlot() {
<AppContainer>
<SlotForm
onSlotAdded={handleSlotAdded}
initialProductIds={baseSlotData?.slot?.products?.map(p => p.id) || []}
initialProductIds={baseSlotData?.slot?.products?.map((p: any) => p.id) || []}
initialGroupIds={baseSlotData?.slot?.groupIds || []}
/>
</AppContainer>

View file

@ -1,8 +1,6 @@
import React from 'react';
import { View, Text } from 'react-native';
import { AppContainer } from 'common-ui';
// import SlotForm from '../../../components/SlotForm';
// import { trpc } from '../../../src/trpc-client';
import { useRouter, useLocalSearchParams } from 'expo-router';
import { trpc } from '@/src/trpc-client';
import SlotForm from '@/components/SlotForm';
@ -45,9 +43,9 @@ export default function EditSlot() {
initialFreezeTime={new Date(slot.slot.freezeTime)}
initialIsActive={slot.slot.isActive}
slotId={slot.slot.id}
initialProductIds={slot.slot.products?.map(p => p.id) || []}
initialProductIds={slot.slot.products?.map((p: any) => p.id) || []}
onSlotAdded={handleSlotUpdated}
/>
</AppContainer>
);
}
}

View file

@ -2,7 +2,7 @@ import React, { useState } from 'react';
import { MaterialCommunityIcons, Entypo } from '@expo/vector-icons';
import { View, TouchableOpacity, FlatList, Alert } from 'react-native';
import { AppContainer, MyText, tw, MyFlatList , BottomDialog, MyTouchableOpacity } from 'common-ui';
import { trpc } from '../../../src/trpc-client';
import { trpc } from '@/src/trpc-client';
import { useRouter } from 'expo-router';
import dayjs from 'dayjs';
import { LinearGradient } from 'expo-linear-gradient';
@ -47,7 +47,7 @@ const SlotItemComponent: React.FC<SlotItemProps> = ({
</View>
<View style={tw`flex-row items-center`}>
<TouchableOpacity
onPress={() => router.push(`/edit-slot/${slot.id}` as any)}
onPress={() => router.push(`/slots/edit/${slot.id}` as any)}
style={tw`px-3 py-1 rounded-full bg-pink2 mr-2`}
>
<View style={tw`flex-row items-center`}>
@ -75,7 +75,7 @@ const SlotItemComponent: React.FC<SlotItemProps> = ({
<TouchableOpacity
onPress={() => {
setMenuOpen(false);
router.push(`/add-slot?baseslot=${slot.id}` as any);
router.push(`/slots/add?baseslot=${slot.id}` as any);
}}
style={tw`py-4 border-b border-gray-200`}
>
@ -202,7 +202,7 @@ export default function Slots() {
{/* FAB for Add New Slot */}
<MyTouchableOpacity
onPress={() => router.push('/add-slot' as any)}
onPress={() => router.push('/slots/add' as any)}
activeOpacity={0.95}
style={{ position: 'absolute', bottom: 32, right: 24, zIndex: 100 }}
>

View file

@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { View, ScrollView, TouchableOpacity, Alert, Share } from 'react-native';
import { theme, AppContainer, MyText, tw, MyTouchableOpacity, BottomDialog } from 'common-ui';
import { trpc } from '../../../src/trpc-client';
import { trpc } from '@/src/trpc-client';
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import dayjs from "dayjs";
import { useRouter, useLocalSearchParams } from 'expo-router';

View file

@ -4,6 +4,8 @@ export default function Layout() {
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" options={{ title: 'Stores' }} />
<Stack.Screen name="add" options={{ title: 'Add Store' }} />
<Stack.Screen name="edit" options={{ title: 'Edit Store' }} />
</Stack>
);
}

View file

@ -14,7 +14,7 @@ export default function AddStore() {
createStoreMutation.mutate(values, {
onSuccess: (data) => {
Alert.alert('Success', data.message);
router.push('/(drawer)/stores' as any); // Navigate back to stores list
router.push('/stores' as any); // Navigate back to stores list
},
onError: (error: any) => {
Alert.alert('Error', error.message || 'Failed to create store');

View file

@ -23,7 +23,7 @@ export default function EditStore() {
onSuccess: (data) => {
refetch();
Alert.alert('Success', data.message);
router.push('/(drawer)/stores' as any);
router.push('/stores' as any);
},
onError: (error: any) => {
Alert.alert('Error', error.message || 'Failed to update store');

View file

@ -106,7 +106,7 @@ export default function Stores() {
const stores = storesData?.stores || [];
const handleEdit = (storeId: number) => {
router.push({ pathname: '/edit-store', params: { id: storeId } });
router.push({ pathname: '/stores/edit', params: { id: storeId } });
};
const handleDelete = (storeId: number) => {
@ -207,7 +207,7 @@ export default function Stores() {
<Animated.View entering={FadeInUp.delay(500)} style={tw`absolute bottom-8 right-6 shadow-xl`}>
<TouchableOpacity
activeOpacity={0.8}
onPress={() => router.push('/add-store' as any)}
onPress={() => router.push('/stores/add' as any)}
>
<LinearGradient
colors={['#2563EB', '#1D4ED8']}

View file

@ -34,7 +34,7 @@ export const TagMenu: React.FC<TagMenuProps> = ({
const handleEditTag = () => {
setIsOpen(false);
router.push(`/(drawer)/edit-tag?tagId=${tagId}`);
router.push(`/product-tags/edit?tagId=${tagId}`);
};
const handleDeleteTag = () => {

View file

@ -63,8 +63,8 @@ const isDevMode = Constants.executionEnvironment !== "standalone";
// const BASE_API_URL = API_URL;
// const BASE_API_URL = 'http://10.0.2.2:4000';
// const BASE_API_URL = 'http://192.168.100.101:4000';
const BASE_API_URL = 'http://192.168.1.3:4000';
// let BASE_API_URL = "https://mf.freshyo.in";
// const BASE_API_URL = 'http://192.168.1.3:4000';
let BASE_API_URL = "https://mf.freshyo.in";
// let BASE_API_URL = 'http://192.168.100.104:4000';
// let BASE_API_URL = 'http://192.168.29.176:4000';

File diff suppressed because one or more lines are too long