import React from 'react'; import { ScrollArea } from '../../ui/scroll-area'; import type { ElementType } from '../../../types/labelTemplate'; /** Left element library: four categories; input-at-print items can have config for correct display */ const ELEMENT_CATEGORIES: { title: string; subtitle?: string; items: { label: string; type: ElementType; config?: Record }[]; }[] = [ { title: 'Template Info', items: [ { label: 'Text', type: 'TEXT_STATIC' }, { label: 'QR Code', type: 'QRCODE' }, { label: 'Barcode', type: 'BARCODE' }, { label: 'Blank Space', type: 'BLANK' }, { label: 'Price', type: 'TEXT_PRICE' }, { label: 'Image', type: 'IMAGE' }, { label: 'Logo', type: 'IMAGE' }, ], }, { title: 'Label Info', items: [ { label: 'Label Name', type: 'TEXT_PRODUCT' }, { label: 'Text', type: 'TEXT_STATIC' }, { label: 'QR Code', type: 'QRCODE' }, { label: 'Barcode', type: 'BARCODE' }, { label: 'Nutrition Facts', type: 'NUTRITION' }, { label: 'Price', type: 'TEXT_PRICE' }, { label: 'Duration Date', type: 'DATE' }, { label: 'Duration Time', type: 'TIME' }, { label: 'Duration', type: 'DURATION' }, { label: 'Image', type: 'IMAGE' }, { label: 'Label Type', type: 'TEXT_STATIC' }, { label: 'How-to', type: 'TEXT_STATIC' }, { label: 'Expiration Alert', type: 'TEXT_STATIC' }, ], }, { title: 'Auto-generated', items: [ { label: 'Company', type: 'TEXT_STATIC' }, { label: 'Employee', type: 'TEXT_STATIC' }, { label: 'Current Date', type: 'DATE' }, { label: 'Current Time', type: 'TIME' }, { label: 'Label ID', type: 'TEXT_STATIC' }, ], }, { title: 'Input at Print', subtitle: 'Click to add to canvas', items: [ { label: 'Text', type: 'TEXT_STATIC', config: { inputType: 'text' } }, { label: 'Weight', type: 'WEIGHT' }, { label: 'Number', type: 'TEXT_STATIC', config: { inputType: 'number', text: '0' } }, { label: 'Date & Time', type: 'DATE', config: { inputType: 'datetime' } }, { label: 'Multiple Options', type: 'TEXT_STATIC', config: { inputType: 'options' } }, ], }, ]; interface ElementsPanelProps { onAddElement: (type: ElementType, configOverride?: Partial>) => void; } const CATEGORY_STYLES = [ { bg: 'bg-gray-50', border: 'border-gray-200', header: 'bg-gray-100' }, { bg: 'bg-gray-50/80', border: 'border-gray-200', header: 'bg-gray-100/90' }, { bg: 'bg-gray-50', border: 'border-gray-200', header: 'bg-gray-100' }, { bg: 'bg-gray-50/80', border: 'border-gray-200', header: 'bg-gray-100/90' }, ]; export function ElementsPanel({ onAddElement }: ElementsPanelProps) { return (
Elements
{ELEMENT_CATEGORIES.map((cat, idx) => { const style = CATEGORY_STYLES[idx % CATEGORY_STYLES.length]; return (
{cat.title}
{cat.subtitle && (
{cat.subtitle}
)}
{cat.items.map((item, i) => ( ))}
); })}
); }