'use client'; import { useState } from 'react'; import { useTranslations } from 'next-intl'; import type { EditorData, EditorSection } from './types'; import LanguageSwitch from '@/components/LanguageSwitch'; import CatalogTab from './CatalogTab'; import PaletteTab from './PaletteTab'; import BrandTab from './BrandTab'; import OrdersTab from './OrdersTab'; import QrTab from './QrTab'; import PublishModal from './PublishModal'; import { ClipboardList, Palette, Store, Bell, QrCode, type LucideIcon } from 'lucide-react'; type Tab = 'catalog' | 'palette' | 'brand' | 'orders' | 'qr'; export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: string }) { const t = useTranslations('editor'); const [tab, setTab] = useState('catalog'); const [sections, setSections] = useState(data.sections); const [ordersEnabled, setOrdersEnabled] = useState(data.ordersEnabled); const [splitEnabled, setSplitEnabled] = useState(data.splitEnabled); const [showMacros, setShowMacros] = useState(data.showMacros); const [publishOpen, setPublishOpen] = useState(false); const [publishedName, setPublishedName] = useState(data.publishedVersionName); const tabs: { id: Tab; label: string; Icon: LucideIcon }[] = [ { id: 'catalog', label: t('catalog'), Icon: ClipboardList }, { id: 'palette', label: t('palette'), Icon: Palette }, { id: 'brand', label: t('brand'), Icon: Store }, { id: 'orders', label: t('orders'), Icon: Bell }, { id: 'qr', label: t('qr'), Icon: QrCode }, ]; return (

{data.name}

{publishedName ? `${t('publishedVersion')}: ${publishedName}` : t('noVersion')}

{tab === 'catalog' && ( setPublishOpen(true)} onRestored={(name) => setPublishedName(name)} /> )} {tab === 'palette' && } {tab === 'brand' && ( )} {tab === 'orders' && ( )} {tab === 'qr' && ( )} {/* Bottom dock navigation */} {publishOpen && ( setPublishOpen(false)} onPublished={(name) => { setPublishedName(name); setPublishOpen(false); }} /> )}
); }