import { useState } from "react";
import { Sidebar } from "./components/crm/Sidebar";
import { Dashboard } from "./components/crm/Dashboard";
import { InvoiceTracking } from "./components/crm/InvoiceTracking";
import { AccountsReceivablePayable } from "./components/crm/AccountsReceivablePayable";
import { Companies } from "./components/crm/Companies";
import { Residents } from "./components/crm/Residents";
import { Schedules } from "./components/crm/Schedules";
import { Reports } from "./components/crm/Reports";
import { EmailManagement } from "./components/crm/EmailManagement";
type View = "dashboard" | "invoices" | "accounts" | "companies" | "residents" | "schedules" | "reports" | "emails";
export default function App() {
const [currentView, setCurrentView] = useState("dashboard");
const [highlightId, setHighlightId] = useState(undefined);
const [selectedEmailId, setSelectedEmailId] = useState(undefined);
const handleNavigate = (view: View, highlight?: string) => {
setCurrentView(view);
setHighlightId(highlight);
};
const handleViewChange = (view: View) => {
setCurrentView(view);
setHighlightId(undefined);
setSelectedEmailId(undefined);
};
const handleNavigateToEmail = (emailId?: number) => {
setCurrentView("emails");
setSelectedEmailId(emailId);
};
const handleBackFromEmail = () => {
setCurrentView("invoices");
setSelectedEmailId(undefined);
};
return (
{currentView === "dashboard" && }
{currentView === "invoices" && }
{currentView === "accounts" && }
{currentView === "companies" && }
{currentView === "residents" && }
{currentView === "schedules" && }
{currentView === "reports" && }
{currentView === "emails" && }
);
}