enh
This commit is contained in:
parent
b5cdc53e50
commit
0eab909eb1
7 changed files with 18 additions and 5 deletions
|
|
@ -74,7 +74,7 @@ export default function Dashboard() {
|
|||
|
||||
const menuItems: MenuItem[] = [
|
||||
{
|
||||
title: 'Manage Orderss',
|
||||
title: 'Manage Orders',
|
||||
icon: 'shopping-bag',
|
||||
description: 'View and manage customer orders',
|
||||
route: '/(drawer)/manage-orders',
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
"distribution": "internal",
|
||||
"channel": "development"
|
||||
},
|
||||
"dev": {
|
||||
"distribution": "internal",
|
||||
"channel": "dev"
|
||||
},
|
||||
"preview": {
|
||||
"distribution": "internal",
|
||||
"channel": "preview"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import { scaffoldAssetUrl } from '@/src/lib/s3-client'
|
|||
// Uniform Product Type (matches getProductDetails return)
|
||||
interface Product {
|
||||
id: number
|
||||
productId: number
|
||||
name: string
|
||||
shortDescription: string | null
|
||||
longDescription: string | null
|
||||
|
|
@ -253,6 +254,7 @@ export async function getAllProducts(): Promise<Product[]> {
|
|||
|
||||
products.push({
|
||||
id: product.id,
|
||||
productId: product.productId,
|
||||
name: product.name,
|
||||
shortDescription: product.shortDescription,
|
||||
longDescription: product.longDescription,
|
||||
|
|
|
|||
|
|
@ -166,10 +166,11 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
|||
|
||||
const loadReviews = async (reset = false) => {
|
||||
if (reviewsLoading || (!hasMore && !reset)) return;
|
||||
if (!productDetail?.productId) return;
|
||||
setReviewsLoading(true);
|
||||
try {
|
||||
const { reviews: newReviews, hasMore: newHasMore } = await trpcClient.user.product.getProductReviews.query({
|
||||
productId: Number(productId),
|
||||
productId: productDetail.productId,
|
||||
limit: 10,
|
||||
offset: reset ? 0 : reviewsOffset,
|
||||
});
|
||||
|
|
@ -195,10 +196,10 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
|||
};
|
||||
|
||||
React.useEffect(() => {
|
||||
if (productDetail?.id) {
|
||||
if (productDetail?.productId) {
|
||||
loadReviews(true);
|
||||
}
|
||||
}, [productDetail?.id]);
|
||||
}, [productDetail?.productId]);
|
||||
|
||||
// Set the store header title with product name
|
||||
const setStoreHeaderTitle = useStoreHeaderStore((state) => state.setTitle);
|
||||
|
|
@ -477,7 +478,7 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
|||
|
||||
{/* Review Form - Moved above or keep below? Usually users want to read reviews first, but if few reviews, writing is good. The original had form then reviews. I will keep format but make it nicer. */}
|
||||
<View style={tw`mb-6`}>
|
||||
<ReviewForm productId={productDetail!.id} onReviewSubmitted={handleReviewSubmitted} />
|
||||
<ReviewForm productId={productDetail!.productId} onReviewSubmitted={handleReviewSubmitted} />
|
||||
</View>
|
||||
|
||||
<View style={tw`bg-white rounded-3xl shadow-sm border border-gray-100 overflow-hidden`}>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@
|
|||
"channel": "preview",
|
||||
"autoIncrement": true
|
||||
},
|
||||
"dev": {
|
||||
"channel": "dev",
|
||||
"autoIncrement": true
|
||||
},
|
||||
"production": {
|
||||
"autoIncrement": true,
|
||||
"channel": "production"
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ export async function getProductDetailById(skuId: number): Promise<UserProductDe
|
|||
|
||||
return {
|
||||
id: sku.id,
|
||||
productId: sku.productId,
|
||||
name: composeSkuName(product?.name ?? 'Unknown', features),
|
||||
shortDescription: product?.shortDescription ?? null,
|
||||
longDescription: product?.longDescription ?? null,
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@ export interface UserProductComboItem {
|
|||
|
||||
export interface UserProductDetailData {
|
||||
id: number;
|
||||
productId: number;
|
||||
name: string;
|
||||
shortDescription: string | null;
|
||||
longDescription: string | null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue