/** * CommandPillar.tsx — 4 Pillar Navigation System * Sostituisce il menu laterale con 4 bottoni principali (Pillar) che espandono sottocategorie logiche. * * Pillar 1: 🔍 RICERCA & ANALISI * - Web Search, News, Meteo, Analisi Dati * * Pillar 2: 💻 SVILUPPO & CODING * - Code Review, Refactor, Debug, Test * * Pillar 3: 🤖 AUTOMAZIONE & TASK * - Task Automation, Workflow, Scheduling, Integration * * Pillar 4: 🎨 CREATIVITÀ & CONTENUTI * - Generazione Testo, Immagini, Audio, Brainstorming */ import React, { useState } from "react"; import { Search, Code2, Zap, Sparkles, ChevronDown, X } from "lucide-react"; export interface PillarCommand { id: string; label: string; description?: string; icon?: React.ReactNode; shortcut?: string; action: () => void; } export interface Pillar { id: string; name: string; icon: React.ReactNode; color: string; commands: PillarCommand[]; } interface CommandPillarProps { onCommandSelect: (cmd: PillarCommand) => void; isOpen?: boolean; onClose?: () => void; } const PILLARS: Pillar[] = [ { id: "search", name: "Ricerca & Analisi", icon: , color: "#3b82f6", commands: [ { id: "web-search", label: "Web Search", description: "Cerca il web in tempo reale", action: () => {} }, { id: "news", label: "Notizie", description: "Ultime notizie e trend", action: () => {} }, { id: "weather", label: "Meteo", description: "Previsioni meteo per città", action: () => {} }, { id: "data-analysis", label: "Analisi Dati", description: "Elabora e visualizza dati", action: () => {} }, ], }, { id: "coding", name: "Sviluppo & Coding", icon: , color: "#10b981", commands: [ { id: "code-review", label: "Code Review", description: "Analizza e migliora codice", action: () => {} }, { id: "refactor", label: "Refactor", description: "Rifattorizza il codice", action: () => {} }, { id: "debug", label: "Debug", description: "Trova e risolvi bug", action: () => {} }, { id: "test", label: "Test", description: "Genera test e verifica", action: () => {} }, ], }, { id: "automation", name: "Automazione & Task", icon: , color: "#f59e0b", commands: [ { id: "task-auto", label: "Task Automation", description: "Automatizza compiti ripetitivi", action: () => {} }, { id: "workflow", label: "Workflow", description: "Crea flussi di lavoro", action: () => {} }, { id: "scheduling", label: "Scheduling", description: "Pianifica esecuzioni", action: () => {} }, { id: "integration", label: "Integrazione", description: "Connetti servizi esterni", action: () => {} }, ], }, { id: "creative", name: "Creatività & Contenuti", icon: , color: "#a855f7", commands: [ { id: "text-gen", label: "Generazione Testo", description: "Crea contenuti scritti", action: () => {} }, { id: "image-gen", label: "Generazione Immagini", description: "Crea immagini con IA", action: () => {} }, { id: "audio-gen", label: "Generazione Audio", description: "Crea audio e musica", action: () => {} }, { id: "brainstorm", label: "Brainstorming", description: "Genera idee creative", action: () => {} }, ], }, ]; export const CommandPillar: React.FC = ({ onCommandSelect, isOpen = false, onClose }) => { const [expandedPillar, setExpandedPillar] = useState(null); const handlePillarClick = (pillarId: string) => { setExpandedPillar(expandedPillar === pillarId ? null : pillarId); }; const handleCommandClick = (cmd: PillarCommand) => { onCommandSelect(cmd); setExpandedPillar(null); onClose?.(); }; if (!isOpen) return null; return ( e.stopPropagation()} > {/* Header */} Comandi Rapidi {/* Pillars */} {PILLARS.map((pillar) => ( {/* Pillar Button */} handlePillarClick(pillar.id)} style={{ width: "100%", display: "flex", alignItems: "center", gap: "12px", padding: "12px 16px", background: expandedPillar === pillar.id ? `${pillar.color}20` : "rgba(99,102,241,0.05)", border: expandedPillar === pillar.id ? `2px solid ${pillar.color}` : "1px solid rgba(99,102,241,0.1)", borderRadius: "12px", cursor: "pointer", transition: "all 0.2s ease", color: expandedPillar === pillar.id ? pillar.color : "var(--text-primary)", fontWeight: expandedPillar === pillar.id ? 600 : 500, fontSize: "1rem", }} > {pillar.icon} {pillar.name} {/* Expanded Commands */} {expandedPillar === pillar.id && ( {pillar.commands.map((cmd) => ( handleCommandClick(cmd)} style={{ display: "flex", flexDirection: "column", gap: "4px", padding: "10px 16px", marginLeft: "12px", background: "rgba(99,102,241,0.08)", border: "1px solid rgba(99,102,241,0.15)", borderRadius: "8px", cursor: "pointer", transition: "all 0.15s ease", textAlign: "left", color: "var(--text-primary)", }} onMouseEnter={(e) => { (e.currentTarget as HTMLButtonElement).style.background = `${pillar.color}25`; (e.currentTarget as HTMLButtonElement).style.borderColor = pillar.color; }} onMouseLeave={(e) => { (e.currentTarget as HTMLButtonElement).style.background = "rgba(99,102,241,0.08)"; (e.currentTarget as HTMLButtonElement).style.borderColor = "rgba(99,102,241,0.15)"; }} > {cmd.label} {cmd.description && ( {cmd.description} )} ))} )} ))} ); }; export default CommandPillar;