diff --git a/components/pdp/ProductInteractiveGrid.tsx b/components/pdp/ProductInteractiveGrid.tsx index 4da0414..e2cde8d 100644 --- a/components/pdp/ProductInteractiveGrid.tsx +++ b/components/pdp/ProductInteractiveGrid.tsx @@ -25,6 +25,7 @@ import { Zap, MapPin, Clock, + Star, } from 'lucide-react'; import { requireLoginForCheckout } from '@/lib/requireLoginForCheckout'; import { trackViewItem, trackAddToCart, trackBeginCheckout } from '@/lib/analytics'; @@ -545,6 +546,37 @@ export const ProductInteractiveGrid: React.FC = ({ {product.name} + {/* Product Rating & Reviews Anchor Shortcut */} +
+
+ {Array.from({ length: 5 }).map((_, i) => ( + + ))} +
+ + {Number(product.rating || 5.0).toFixed(1)} + + • + +
+
{priceLabel} {selectedCompare > selectedPrice && ( diff --git a/components/pdp/ProductTabsWrapper.tsx b/components/pdp/ProductTabsWrapper.tsx index 9a04ab8..8c2a4dc 100644 --- a/components/pdp/ProductTabsWrapper.tsx +++ b/components/pdp/ProductTabsWrapper.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { ProductReviewsSection } from './ProductReviewsSection'; interface ProductTabsWrapperProps { @@ -14,8 +14,7 @@ interface ProductTabsWrapperProps { type TabId = 'description' | 'specs' | 'reviews'; -const TAB_LINE = 'border-[#e0e0e0]'; -const BOX = 'border border-[#e0e0e0]'; +const BOX = 'border border-gray-200 rounded-xl overflow-hidden'; export const ProductTabsWrapper: React.FC = ({ productId, @@ -28,33 +27,68 @@ export const ProductTabsWrapper: React.FC = ({ const [activeTab, setActiveTab] = useState('description'); const [reviewsCount, setReviewsCount] = useState(initialReviewsCount); - const tabs: { id: TabId; label: string }[] = [ - { id: 'description', label: 'Description' }, - ...(showSpecifications ? [{ id: 'specs' as TabId, label: 'Specifications' }] : []), - { id: 'reviews' as TabId, label: `Reviews (${reviewsCount})` }, - ]; + useEffect(() => { + if (typeof window !== 'undefined' && window.location.hash === '#reviews') { + setActiveTab('reviews'); + setTimeout(() => { + document.getElementById('product-tabs')?.scrollIntoView({ behavior: 'smooth' }); + }, 150); + } + }, []); return (
- {/* Tab Headers */} -
- {tabs.map((tab) => { - const isActive = activeTab === tab.id; - return ( - - ); - })} + {/* Modern High-Visibility Tab Bar */} +
+ + + {showSpecifications && ( + + )} + +
{/* Tab Panels */} diff --git a/components/pdp/YouMayAlsoLike.tsx b/components/pdp/YouMayAlsoLike.tsx index ab831aa..691022e 100644 --- a/components/pdp/YouMayAlsoLike.tsx +++ b/components/pdp/YouMayAlsoLike.tsx @@ -101,7 +101,12 @@ export function YouMayAlsoLike({ products }: YouMayAlsoLikeProps) { style={{ gridTemplateColumns: `repeat(${Math.min(products.length, 5)}, minmax(168px, 1fr))` }} > {products.slice(0, 5).map((prod, index) => { - const img = getImageUrl(prod.images?.[0]?.image_url || prod.variants?.[0]?.images?.[0]?.image_url); + const img = getImageUrl( + prod.thumbnail_url || + prod.images?.[0]?.image_url || + prod.variants?.[0]?.thumbnail_url || + prod.variants?.[0]?.images?.[0]?.image_url + ); const off = discountPct(prod); const pricing = priceLabel(prod); const onSale = off > 0; diff --git a/public/images/placeholder-product.webp b/public/images/placeholder-product.webp index 0f1540d..eaf17e3 100644 Binary files a/public/images/placeholder-product.webp and b/public/images/placeholder-product.webp differ diff --git a/services/api/catalogService.ts b/services/api/catalogService.ts index a0db05f..24d8347 100644 --- a/services/api/catalogService.ts +++ b/services/api/catalogService.ts @@ -91,6 +91,7 @@ export interface ProductVariantResponse { low_stock_threshold: number; status: string; available_stock?: number; + thumbnail_url?: string | null; attributes?: VariantAttributeResponse[]; images?: VariantImageResponse[]; } @@ -116,6 +117,7 @@ export interface ProductResponse { description: string | null; status: string; created_at: string; + thumbnail_url?: string | null; images: ProductImageResponse[]; variants: ProductVariantResponse[]; warranty_type?: string | null;