"use client"; import { useMemo } from "react"; import Link from "next/link"; import { useParams } from "next/navigation"; import { CATEGORIES, PARTS } from "@/data/gunbuilderParts"; import type { CategoryId } from "@/types/gunbuilder"; export default function PartDetailPage() { const params = useParams(); const categoryId = params.categoryId as CategoryId; const partId = params.partId as string; const category = useMemo( () => CATEGORIES.find((c) => c.id === categoryId), [categoryId], ); const part = useMemo( () => PARTS.find((p) => p.id === partId && p.categoryId === categoryId), [partId, categoryId], ); if (!category || !part) { return ( Product Not Found Return to Gunbuilder ); } return ( {/* Header */} ← Back to {category.name} Shadow Standard {part.brand} {part.name} {category.name} • Product Details {/* Product Details */} {/* Main Content */} {/* Product Info */} Product Information Brand {part.brand} Model {part.name} Category {category.name} {part.notes && ( Details {part.notes} )} {/* Product Image */} Product Image {/* Sidebar */} ); }
Shadow Standard
{category.name} • Product Details
Product Image