import { useState } from "react";
import Sidebar from "./components/Sidebar";
import Leads from "./pages/Leads";
import OtrosGeneral from "./pages/OtrosGeneral";
import CampanitaAlertas from "./components/CampanitaAlertas";
import ConfigModal from "./components/ConfigModal";

export default function App() {
  const [pagina, setPagina] = useState("leads");
  const [config, setConfig] = useState(false);

  function render() {
    switch (pagina) {
      case "leads": return <Leads />;
      case "otros": return <OtrosGeneral />;
      default: return null;
    }
  }

  return (
    <div className="app">
      <Sidebar active={pagina} onChange={setPagina} onConfig={() => setConfig(true)} />
      <main className="main">{render()}</main>
      <CampanitaAlertas />
      {config && <ConfigModal onClose={() => setConfig(false)} />}
    </div>
  );
}
