import React, { useState, useCallback } from 'react'; import { Save, AlertCircle, Crown } from 'lucide-react'; import { DesignMD, CompanyProfile } from '../types'; import { BrandTabGeneral } from './brand/BrandTabGeneral'; import { BrandTabVisual } from './brand/BrandTabVisual'; import { BrandTabTypography } from './brand/BrandTabTypography'; import { BrandTabMedia } from './brand/BrandTabMedia'; import { BrandPreview } from './brand/BrandPreview'; import { Toast } from './ui/Toast'; interface BrandArchitectureProps { company: CompanyProfile; handleCompanyChange: (company: CompanyProfile) => void; designMD: DesignMD; handleDesignChange: (key: keyof DesignMD, value: string | number | string[] | boolean) => void; onContinue: () => void; } const TABS = [ { id: 'general', label: 'Información', icon: '📋' }, { id: 'visual', label: 'Visual y Colores', icon: '🎨' }, { id: 'typography', label: 'Tipografía', icon: '🔤' }, { id: 'media', label: 'Video y Audio', icon: '🎬' }, ] as const; type TabId = typeof TABS[number]['id']; export const BrandArchitecture: React.FC = ({ company, handleCompanyChange, designMD, handleDesignChange, onContinue }) => { const [zoom, setZoom] = useState(1); const [aspectRatio, setAspectRatio] = useState<'16:9'|'1:1'|'9:16'>('9:16'); const [activeTab, setActiveTab] = useState('general'); const [showToast, setShowToast] = useState(false); const [validationErrors, setValidationErrors] = useState([]); const validate = useCallback((): string[] => { const errors: string[] = []; if (!company?.name || company.name.trim().length < 2) { errors.push('El nombre de la marca es requerido (mín. 2 caracteres)'); } if (!designMD.logoUrl || designMD.logoUrl.trim().length === 0) { errors.push('El logo de la marca es requerido'); } return errors; }, [company, designMD]); const handleSave = () => { const errors = validate(); if (errors.length > 0) { setValidationErrors(errors); setTimeout(() => setValidationErrors([]), 5000); return; } setValidationErrors([]); setShowToast(true); setTimeout(() => { onContinue(); }, 800); }; return (
{/* ═══ Sticky Header: Title + Brand Identity ═══ */}
{/* Left: Title + Description */}

Reglas de tu Marca (Design MD)

Establece el plano arquitectónico visual de la empresa. Todos los videos y renders futuros adoptarán estrictamente estos parámetros sin intervención de IA.

{/* Right: Brand Identity Card + Save */}
{/* Brand Identity Card */}
{/* Logo / Avatar */}
{designMD.logoUrl ? ( {company.name} ) : ( {company.name?.charAt(0)?.toUpperCase() || '?'} )}
{/* Name + Plan */}

{company.name || 'Sin nombre'}

{company.industry || 'Marca'}
{/* Brand color dot indicator */}
{/* Save Button */}
{/* ═══ Full-Width Tabbar ═══ */}
{TABS.map((tab, idx) => { const isActive = activeTab === tab.id; return ( ); })}
{/* ═══ Main Content: Form + Preview Split ═══ */}
{/* Form Column */}
{/* Validation Errors */} {validationErrors.length > 0 && (
{validationErrors.map((err, i) => (

{err}

))}
)} {/* Tab Content */} {activeTab === 'general' && ( )} {activeTab === 'visual' && ( )} {activeTab === 'typography' && ( )} {activeTab === 'media' && ( )}
{/* Preview Column */}
{/* Success Toast */} {showToast && ( setShowToast(false)} /> )}
); };