"use client"; import React, { useState } from 'react'; import { ProductReviewsSection } from './ProductReviewsSection'; interface ProductTabsWrapperProps { productId?: string; productName?: string; initialReviewsCount?: number; descriptionHtml: React.ReactNode; specsHtml: React.ReactNode; showSpecifications?: boolean; } type TabId = 'description' | 'specs' | 'reviews'; const TAB_LINE = 'border-[#e0e0e0]'; const BOX = 'border border-[#e0e0e0]'; export const ProductTabsWrapper: React.FC = ({ productId, productName, initialReviewsCount = 0, descriptionHtml, specsHtml, showSpecifications = true, }) => { 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})` }, ]; return (
{/* Tab Headers */}
{tabs.map((tab) => { const isActive = activeTab === tab.id; return ( ); })}
{/* Tab Panels */}
{/* ── Description ── */}
{descriptionHtml ? ( descriptionHtml ) : (

No description available for this product.

)}
{/* ── Specifications ── */}
{specsHtml}
{/* ── Reviews ── */}
{productId ? ( ) : (

Reviews unavailable

)}
); };