Compare commits
No commits in common. "09e1067b69506d9307f7d1a2cb299b46717af457" and "71a8dece86103c9f7179a705e741fc8777edea4a" have entirely different histories.
09e1067b69
...
71a8dece86
8 changed files with 25 additions and 173 deletions
|
|
@ -1,33 +0,0 @@
|
||||||
import { Stack, useNavigation } from 'expo-router';
|
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { useStoreHeaderStore } from '@/src/store/storeHeaderStore';
|
|
||||||
|
|
||||||
function DynamicHeaderTitle() {
|
|
||||||
const navigation = useNavigation();
|
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (title) {
|
|
||||||
navigation.setOptions({ title });
|
|
||||||
}
|
|
||||||
}, [title, navigation]);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ProductDetailLayout() {
|
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<DynamicHeaderTitle />
|
|
||||||
<Stack
|
|
||||||
screenOptions={{
|
|
||||||
headerShown: true,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Stack.Screen name="[id]" options={{ title: title || 'Product Details' }} />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +1,20 @@
|
||||||
import FloatingCartBar from "@/components/floating-cart-bar";
|
import FloatingCartBar from "@/components/floating-cart-bar";
|
||||||
import { tw } from "common-ui";
|
import { tw } from "common-ui";
|
||||||
import { Stack, useNavigation } from 'expo-router';
|
import { Stack } from "expo-router";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { useStoreHeaderStore } from '@/src/store/storeHeaderStore';
|
|
||||||
|
|
||||||
function DynamicHeaderTitle() {
|
|
||||||
const navigation = useNavigation();
|
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (title) {
|
|
||||||
navigation.setOptions({ title });
|
|
||||||
}
|
|
||||||
}, [title, navigation]);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ProductDetailLayout() {
|
export default function ProductDetailLayout() {
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DynamicHeaderTitle />
|
|
||||||
<Stack
|
<Stack
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
headerShown: true,
|
headerShown: true,
|
||||||
|
title: "Product Details",
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
<Stack.Screen name="[id]" options={{ title: title || 'Product Details' }} />
|
|
||||||
</Stack>
|
|
||||||
<View style={tw`absolute bottom-2 left-4 right-4`}>
|
<View style={tw`absolute bottom-2 left-4 right-4`}>
|
||||||
<FloatingCartBar />
|
<FloatingCartBar />
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
import { Stack, useNavigation } from 'expo-router';
|
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { useStoreHeaderStore } from '@/src/store/storeHeaderStore';
|
|
||||||
|
|
||||||
function DynamicHeaderTitle() {
|
|
||||||
const navigation = useNavigation();
|
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (title) {
|
|
||||||
navigation.setOptions({ title });
|
|
||||||
}
|
|
||||||
}, [title, navigation]);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ProductDetailLayout() {
|
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<DynamicHeaderTitle />
|
|
||||||
<Stack
|
|
||||||
screenOptions={{
|
|
||||||
headerShown: true,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Stack.Screen name="[id]" options={{ title: title || 'Product Details' }} />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -15,7 +15,6 @@ import FontAwesome5 from "@expo/vector-icons/FontAwesome5";
|
||||||
import { trpc } from "@/src/trpc-client";
|
import { trpc } from "@/src/trpc-client";
|
||||||
import ProductCard from "@/components/ProductCard";
|
import ProductCard from "@/components/ProductCard";
|
||||||
import FloatingCartBar from "@/components/floating-cart-bar";
|
import FloatingCartBar from "@/components/floating-cart-bar";
|
||||||
import { useStoreHeaderStore } from "@/src/store/storeHeaderStore";
|
|
||||||
|
|
||||||
const { width: screenWidth } = Dimensions.get("window");
|
const { width: screenWidth } = Dimensions.get("window");
|
||||||
const itemWidth = (screenWidth - 48) / 2;
|
const itemWidth = (screenWidth - 48) / 2;
|
||||||
|
|
@ -80,12 +79,7 @@ export default function StoreDetail() {
|
||||||
return selectedTag?.productIds?.includes(product.id) ?? false;
|
return selectedTag?.productIds?.includes(product.id) ?? false;
|
||||||
}) || []
|
}) || []
|
||||||
: storeData?.products || [];
|
: storeData?.products || [];
|
||||||
|
|
||||||
// Set the store header title
|
|
||||||
const setStoreHeaderTitle = useStoreHeaderStore((state) => state.setTitle);
|
|
||||||
if (storeData?.store?.name) {
|
|
||||||
setStoreHeaderTitle(storeData.store.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
useManualRefresh(() => {
|
useManualRefresh(() => {
|
||||||
refetch();
|
refetch();
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,15 @@
|
||||||
import { Stack, useNavigation } from 'expo-router';
|
import { Stack } from 'expo-router';
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { useStoreHeaderStore } from '@/src/store/storeHeaderStore';
|
|
||||||
|
|
||||||
function DynamicHeaderTitle() {
|
|
||||||
const navigation = useNavigation();
|
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (title) {
|
|
||||||
navigation.setOptions({ title });
|
|
||||||
}
|
|
||||||
}, [title, navigation]);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function StoreDetailLayout() {
|
export default function StoreDetailLayout() {
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Stack
|
||||||
<DynamicHeaderTitle />
|
screenOptions={{
|
||||||
<Stack
|
headerShown: true,
|
||||||
screenOptions={{
|
title: "Store Details",
|
||||||
headerShown: true,
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Stack.Screen name="[id]" />
|
||||||
<Stack.Screen name="[id]" options={{ title: title || 'Store Details' }} />
|
<Stack.Screen options={{headerShown: false}} name="product-detail" />
|
||||||
<Stack.Screen options={{headerShown: false}} name="product-detail" />
|
</Stack>
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1,33 +1,12 @@
|
||||||
import { Stack, useNavigation } from 'expo-router';
|
import { Stack } from 'expo-router';
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { useStoreHeaderStore } from '@/src/store/storeHeaderStore';
|
|
||||||
|
|
||||||
function DynamicHeaderTitle() {
|
|
||||||
const navigation = useNavigation();
|
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (title) {
|
|
||||||
navigation.setOptions({ title });
|
|
||||||
}
|
|
||||||
}, [title, navigation]);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ProductDetailLayout() {
|
export default function ProductDetailLayout() {
|
||||||
const title = useStoreHeaderStore((state) => state.title);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Stack
|
||||||
<DynamicHeaderTitle />
|
screenOptions={{
|
||||||
<Stack
|
headerShown: true,
|
||||||
screenOptions={{
|
title: "Product Details",
|
||||||
headerShown: true,
|
}}
|
||||||
}}
|
/>
|
||||||
>
|
|
||||||
<Stack.Screen name="[id]" options={{ title: title || 'Product Details' }} />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,6 @@ import { useAddToCart, useGetCart, useUpdateCartItem, useRemoveFromCart } from '
|
||||||
import { useProductSlotIdentifier } from '@/hooks/useProductSlotIdentifier';
|
import { useProductSlotIdentifier } from '@/hooks/useProductSlotIdentifier';
|
||||||
import { useFlashNavigationStore } from '@/components/stores/flashNavigationStore';
|
import { useFlashNavigationStore } from '@/components/stores/flashNavigationStore';
|
||||||
import FloatingCartBar from './floating-cart-bar';
|
import FloatingCartBar from './floating-cart-bar';
|
||||||
import { useStoreHeaderStore } from '@/src/store/storeHeaderStore';
|
|
||||||
|
|
||||||
const { width: screenWidth } = Dimensions.get("window");
|
const { width: screenWidth } = Dimensions.get("window");
|
||||||
const carouselWidth = screenWidth;
|
const carouselWidth = screenWidth;
|
||||||
|
|
@ -183,12 +182,6 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
||||||
}
|
}
|
||||||
}, [productDetail?.id]);
|
}, [productDetail?.id]);
|
||||||
|
|
||||||
// Set the store header title with product name
|
|
||||||
const setStoreHeaderTitle = useStoreHeaderStore((state) => state.setTitle);
|
|
||||||
if (productDetail?.name) {
|
|
||||||
setStoreHeaderTitle(productDetail.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<View style={tw`flex-1 justify-center items-center bg-gray-50`}>
|
<View style={tw`flex-1 justify-center items-center bg-gray-50`}>
|
||||||
|
|
@ -207,6 +200,7 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={tw`flex-1 bg-gray-50`}>
|
<View style={tw`flex-1 bg-gray-50`}>
|
||||||
{/* <CustomHeader /> */}
|
{/* <CustomHeader /> */}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
import { create } from 'zustand';
|
|
||||||
|
|
||||||
interface StoreHeaderState {
|
|
||||||
title: string;
|
|
||||||
setTitle: (title: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useStoreHeaderStore = create<StoreHeaderState>((set) => ({
|
|
||||||
title: '',
|
|
||||||
setTitle: (title) => set({ title }),
|
|
||||||
}));
|
|
||||||
Loading…
Add table
Reference in a new issue