import { useRef, useState } from "react"; import { editor } from "monaco-editor"; import { useMount, useLocalStorage } from "react-use"; import { toast } from "react-toastify"; import Sidebar, { View } from "./sidebar/Sidebar"; import EditorPanel from "./panels/EditorPanel"; import FilesPanel from "./panels/FilesPanel"; import PreviewPanel from "./panels/PreviewPanel"; import APIKeysConfig from "./panels/APIKeysConfig"; import AgentConfig from "./panels/AgentConfig"; import SystemPromptConfig from "./panels/SystemPromptConfig"; import AskAI from "./ask-ai/ask-ai"; import agents from "../../agents.json"; import { defaultHTML } from "../../utils/consts"; function App() { const [htmlStorage, , removeHtmlStorage] = useLocalStorage("html_content", ""); const [html, setHtml] = useState(htmlStorage || defaultHTML); const [error, setError] = useState(false); const [isAiWorking, setIsAiWorking] = useState(false); const [selectedAgent, setSelectedAgent] = useLocalStorage( "selectedAgent", agents[0].id ); const agentId = selectedAgent || agents[0].id; // ← nunca undefined const [activePanel, setActivePanel] = useState("editor"); const [prompts, setPrompts] = useState([]); const [activeViewer, setActiveViewer] = useState("viewer1"); const editorRef = useRef(null); useMount(() => { if (htmlStorage) { removeHtmlStorage(); toast.warn("Conteúdo HTML restaurado do storage."); } }); return (
{/* Team/Agentes - Barra lateral esquerda */}
Logo
{agents.slice(0, 5).map((agent) => (
setSelectedAgent(agent.id)} title={agent.name} > {agent.name.charAt(0)}
))}
{/* Chat / agentes */}

Agentes IA

Selecione um agente para ajudar no seu projeto

setPrompts((ps) => [...ps, p])} onScrollToBottom={() => { editorRef.current?.revealLine( editorRef.current?.getModel()?.getLineCount() ?? 0 ); }} />
{/* Painéis principais */}
{activePanel === "editor" && ( )} {activePanel === "files" && } {activePanel === "preview" && } {activePanel === "apikeys" && } {activePanel === "agents" && } {activePanel === "system" && }
); } export default App;