'use client'; import dynamic from 'next/dynamic'; import { motion } from 'framer-motion'; import { useLocale } from '@/lib/i18n/locale-context'; import { SectionHeader } from '@/components/ui/SectionHeader'; import type { StackNode } from './StackCanvas'; // Category accent palette (index-aligned). Hex feeds the WebGL sprites; the // literal Tailwind maps below keep the JIT scanner happy for the legend. const ACCENTS = ['electric', 'violet', 'magenta', 'cyan'] as const; type Accent = (typeof ACCENTS)[number]; const ACCENT_HEX: Record = { electric: '#38bdf8', violet: '#818cf8', magenta: '#e879f9', cyan: '#22d3ee', }; const ACCENT_TEXT: Record = { electric: 'text-electric', violet: 'text-violet', magenta: 'text-magenta', cyan: 'text-cyan', }; const ACCENT_BORDER: Record = { electric: 'border-electric/30', violet: 'border-violet/30', magenta: 'border-magenta/30', cyan: 'border-cyan/30', }; // The globe is client-only WebGL: never SSR it. While the chunk loads we show // a calm placeholder so layout doesn't jump. const StackCanvas = dynamic( () => import('./StackCanvas').then((m) => m.StackCanvas), { ssr: false, loading: () => (
), }, ); export function Stack() { const { t, locale } = useLocale(); // Flatten every tool into a colored node for the constellation. const nodes: StackNode[] = t.stack.categories.flatMap((cat, i) => { const hex = ACCENT_HEX[ACCENTS[i % ACCENTS.length]]; return cat.items.map((label) => ({ label, color: hex })); }); return (
{/* 3D constellation */}

{locale === 'fa' ? 'بکشید برای چرخش · نشانگر برای نام' : 'Drag to spin · hover for name'}

{/* Category legend */}
{t.stack.categories.map((cat, i) => { const accent = ACCENTS[i % ACCENTS.length]; return (
{cat.label}
    {cat.items.map((item) => (
  • {item}
  • ))}
); })}
); }