"use client"; import { useState } from "react"; import { EmptyState } from "@/components/ui/EmptyState"; import type { TechnicalInfoField } from "@/lib/meshkee"; type Tab = "specs" | "review" | "comments"; const TABS: { id: Tab; label: string }[] = [ { id: "specs", label: "مشخصات فنی" }, { id: "review", label: "نقد و بررسی" }, { id: "comments", label: "نظرات کاربران" }, ]; export function ProductTabs({ technicalInfo, descriptionHtml, }: { technicalInfo: TechnicalInfoField[]; descriptionHtml?: string; }) { const [active, setActive] = useState("specs"); const activeLabel = TABS.find((t) => t.id === active)?.label ?? ""; return (
{TABS.map((tab) => ( ))}

{activeLabel}

{active === "specs" && (technicalInfo.length === 0 ? ( ) : (
{technicalInfo.map((field) => (

{field.label} :

{field.value}

))}
))} {active === "review" && (descriptionHtml ? (
) : ( ))} {active === "comments" && ( )}
); }