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[] = [
|
const menuItems: MenuItem[] = [
|
||||||
{
|
{
|
||||||
title: 'Manage Orderss',
|
title: 'Manage Orders',
|
||||||
icon: 'shopping-bag',
|
icon: 'shopping-bag',
|
||||||
description: 'View and manage customer orders',
|
description: 'View and manage customer orders',
|
||||||
route: '/(drawer)/manage-orders',
|
route: '/(drawer)/manage-orders',
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"channel": "development"
|
"channel": "development"
|
||||||
},
|
},
|
||||||
|
"dev": {
|
||||||
|
"distribution": "internal",
|
||||||
|
"channel": "dev"
|
||||||
|
},
|
||||||
"preview": {
|
"preview": {
|
||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"channel": "preview"
|
"channel": "preview"
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import { scaffoldAssetUrl } from '@/src/lib/s3-client'
|
||||||
// Uniform Product Type (matches getProductDetails return)
|
// Uniform Product Type (matches getProductDetails return)
|
||||||
interface Product {
|
interface Product {
|
||||||
id: number
|
id: number
|
||||||
|
productId: number
|
||||||
name: string
|
name: string
|
||||||
shortDescription: string | null
|
shortDescription: string | null
|
||||||
longDescription: string | null
|
longDescription: string | null
|
||||||
|
|
@ -253,6 +254,7 @@ export async function getAllProducts(): Promise<Product[]> {
|
||||||
|
|
||||||
products.push({
|
products.push({
|
||||||
id: product.id,
|
id: product.id,
|
||||||
|
productId: product.productId,
|
||||||
name: product.name,
|
name: product.name,
|
||||||
shortDescription: product.shortDescription,
|
shortDescription: product.shortDescription,
|
||||||
longDescription: product.longDescription,
|
longDescription: product.longDescription,
|
||||||
|
|
|
||||||
|
|
@ -166,10 +166,11 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
||||||
|
|
||||||
const loadReviews = async (reset = false) => {
|
const loadReviews = async (reset = false) => {
|
||||||
if (reviewsLoading || (!hasMore && !reset)) return;
|
if (reviewsLoading || (!hasMore && !reset)) return;
|
||||||
|
if (!productDetail?.productId) return;
|
||||||
setReviewsLoading(true);
|
setReviewsLoading(true);
|
||||||
try {
|
try {
|
||||||
const { reviews: newReviews, hasMore: newHasMore } = await trpcClient.user.product.getProductReviews.query({
|
const { reviews: newReviews, hasMore: newHasMore } = await trpcClient.user.product.getProductReviews.query({
|
||||||
productId: Number(productId),
|
productId: productDetail.productId,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
offset: reset ? 0 : reviewsOffset,
|
offset: reset ? 0 : reviewsOffset,
|
||||||
});
|
});
|
||||||
|
|
@ -195,10 +196,10 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
||||||
};
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (productDetail?.id) {
|
if (productDetail?.productId) {
|
||||||
loadReviews(true);
|
loadReviews(true);
|
||||||
}
|
}
|
||||||
}, [productDetail?.id]);
|
}, [productDetail?.productId]);
|
||||||
|
|
||||||
// Set the store header title with product name
|
// Set the store header title with product name
|
||||||
const setStoreHeaderTitle = useStoreHeaderStore((state) => state.setTitle);
|
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. */}
|
{/* 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`}>
|
<View style={tw`mb-6`}>
|
||||||
<ReviewForm productId={productDetail!.id} onReviewSubmitted={handleReviewSubmitted} />
|
<ReviewForm productId={productDetail!.productId} onReviewSubmitted={handleReviewSubmitted} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={tw`bg-white rounded-3xl shadow-sm border border-gray-100 overflow-hidden`}>
|
<View style={tw`bg-white rounded-3xl shadow-sm border border-gray-100 overflow-hidden`}>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@
|
||||||
"channel": "preview",
|
"channel": "preview",
|
||||||
"autoIncrement": true
|
"autoIncrement": true
|
||||||
},
|
},
|
||||||
|
"dev": {
|
||||||
|
"channel": "dev",
|
||||||
|
"autoIncrement": true
|
||||||
|
},
|
||||||
"production": {
|
"production": {
|
||||||
"autoIncrement": true,
|
"autoIncrement": true,
|
||||||
"channel": "production"
|
"channel": "production"
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ export async function getProductDetailById(skuId: number): Promise<UserProductDe
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: sku.id,
|
id: sku.id,
|
||||||
|
productId: sku.productId,
|
||||||
name: composeSkuName(product?.name ?? 'Unknown', features),
|
name: composeSkuName(product?.name ?? 'Unknown', features),
|
||||||
shortDescription: product?.shortDescription ?? null,
|
shortDescription: product?.shortDescription ?? null,
|
||||||
longDescription: product?.longDescription ?? null,
|
longDescription: product?.longDescription ?? null,
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,7 @@ export interface UserProductComboItem {
|
||||||
|
|
||||||
export interface UserProductDetailData {
|
export interface UserProductDetailData {
|
||||||
id: number;
|
id: number;
|
||||||
|
productId: number;
|
||||||
name: string;
|
name: string;
|
||||||
shortDescription: string | null;
|
shortDescription: string | null;
|
||||||
longDescription: string | null;
|
longDescription: string | null;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue