'use client'; import type { CompanyId } from '@/core/auth/types'; import type { SignatureConfig, SignatureColors, SignatureLayout, SignatureVariant } from '../types'; import { COMPANY_BRANDING, BELETAGE_ADDRESSES, US_ADDRESSES, SDT_ADDRESSES } from '../services/company-branding'; import { Input } from '@/shared/components/ui/input'; import { Label } from '@/shared/components/ui/label'; import { Switch } from '@/shared/components/ui/switch'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/shared/components/ui/select'; import { Separator } from '@/shared/components/ui/separator'; import { cn } from '@/shared/lib/utils'; interface SignatureConfiguratorProps { config: SignatureConfig; onUpdateField: (key: K, value: SignatureConfig[K]) => void; onUpdateColor: (key: keyof SignatureColors, value: string) => void; onUpdateLayout: (key: keyof SignatureLayout, value: number) => void; onSetVariant: (variant: SignatureVariant) => void; onSetCompany: (company: CompanyId) => void; onSetAddress?: (address: string[]) => void; } /** Color palette per company */ const COMPANY_PALETTES: Record> = { beletage: { verde: '#22B5AB', griInchis: '#54504F', griDeschis: '#A7A9AA', negru: '#323232', }, 'urban-switch': { indigo: '#6366f1', violet: '#4F46E5', griInchis: '#2D2D2D', griDeschis: '#6B7280', albastru: '#3B82F6', negru: '#1F2937', }, 'studii-de-teren': { amber: '#f59e0b', portocaliu: '#D97706', griInchis: '#2D2D2D', griDeschis: '#6B7280', maro: '#92400E', negru: '#1F2937', }, group: { gri: '#64748b', griInchis: '#334155', griDeschis: '#94a3b8', negru: '#1e293b', }, }; const COLOR_LABELS: Record = { prefix: 'Titulatură', name: 'Nume', title: 'Funcție', address: 'Adresă', phone: 'Telefon', website: 'Website', motto: 'Motto', }; const LAYOUT_CONTROLS: { key: keyof SignatureLayout; label: string; min: number; max: number }[] = [ { key: 'greenLineWidth', label: 'Lungime linie accent', min: 50, max: 300 }, { key: 'sectionSpacing', label: 'Spațiere secțiuni', min: 0, max: 30 }, { key: 'logoSpacing', label: 'Spațiere logo', min: 0, max: 30 }, { key: 'titleSpacing', label: 'Spațiere funcție', min: 0, max: 20 }, { key: 'gutterWidth', label: 'Aliniere contact', min: 0, max: 150 }, { key: 'iconTextSpacing', label: 'Spațiu icon-text', min: -10, max: 30 }, { key: 'iconVerticalOffset', label: 'Aliniere verticală iconițe', min: -10, max: 10 }, { key: 'mottoSpacing', label: 'Spațiere motto', min: 0, max: 20 }, ]; export function SignatureConfigurator({ config, onUpdateField, onUpdateColor, onUpdateLayout, onSetVariant, onSetCompany, onSetAddress, }: SignatureConfiguratorProps) { const palette = COMPANY_PALETTES[config.company]; return (
{/* Company selector */}
{/* Address selector (for Beletage) */} {config.company === 'beletage' && onSetAddress && (
)} {/* Address selector (for Urban Switch) */} {config.company === 'urban-switch' && onSetAddress && (
)} {/* Address selector (for Studii de Teren) */} {config.company === 'studii-de-teren' && onSetAddress && (
)} {/* Personal data */}

Date personale

onUpdateField('prefix', e.target.value)} className="mt-1" />
onUpdateField('name', e.target.value)} className="mt-1" />
onUpdateField('title', e.target.value)} className="mt-1" />
onUpdateField('phone', e.target.value)} className="mt-1" />
{/* Variant */}

Variantă

onUpdateField('useSvg', v)} id="svg-toggle" />
{/* Colors — company-specific palette */}

Culori text

{(Object.keys(COLOR_LABELS) as (keyof SignatureColors)[]).map((colorKey) => (
{COLOR_LABELS[colorKey]}
{Object.values(palette).map((color) => (
))}
{/* Layout sliders */}

Stil & Aranjare

{LAYOUT_CONTROLS.map(({ key, label, min, max }) => (
{config.layout[key]}px
onUpdateLayout(key, parseInt(e.target.value, 10))} className="mt-1 w-full accent-primary" />
))}
); }