import React from "react";
import { useState } from "react";
import NewNav from "@/Components/Dashboard/NewNav";
import MainContentArea from "@/Components/Dashboard/MainContentArea";
import Sidebar from "@/Components/Dashboard/Sidebar";

function NewDash() {
    const [sidebarOpen, setSidebarOpen] = useState(false);
    const [selectedSection, setSelectedSection] = useState("Dashboard");
    return (
        <>
            <div className="min-h-screen bg-gray-100 flex flex-col">
                {/* Top Navbar */}
                <NewNav onSidebarToggle={() => setSidebarOpen(!sidebarOpen)} />

                {/* Main Content Area */}
                <div className="flex flex-1">
                    {/* Left Sidebar */}
                    <Sidebar
                        isOpen={sidebarOpen}
                        onClose={() => setSidebarOpen(false)}
                        onSectionSelect={(section) => {
                            setSelectedSection(section); // Update the selected section
                            setSidebarOpen(false); // Close the sidebar after selection
                        }}
                    />

                    {/* Right Content Area */}
                    <MainContentArea selectedSection={selectedSection} />
                </div>
            </div>
        </>
    );
}

export default NewDash;
