import React, { useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { Home, FileInput, FileOutput, Users, Package, Settings, Menu, X, TrendingUp } from 'lucide-react'; interface LayoutProps { children: React.ReactNode; } const Layout: React.FC = ({ children }) => { const [isSidebarOpen, setSidebarOpen] = useState(false); const location = useLocation(); const navItems = [ { path: '/', label: 'डॅशबोर्ड (Home)', icon: Home }, { path: '/jawaak', label: 'जावक बिल (Sales)', icon: FileOutput }, { path: '/awaak', label: 'आवक बिल (Purchase)', icon: FileInput }, { path: '/ledger', label: 'पार्टी लेजर (Ledger)', icon: Users }, // { path: '/patti-ledger', label: 'पट्टी लेजर (Patti Ledger)', icon: Users }, { path: '/stock', label: 'स्टॉक रिपोर्ट (Stock)', icon: Package }, { path: '/patti-stock', label: 'पट्टी स्टॉक (Patti Stock)', icon: Package }, { path: '/analysis', label: 'अ‍ॅनालिसीस (Analysis)', icon: TrendingUp }, { path: '/patti-analysis', label: 'पट्टी अ‍ॅनालिसीस (Patti Analysis)', icon: TrendingUp }, { path: '/settings', label: 'सेटिंग्स (Settings)', icon: Settings }, ]; const isActive = (path: string) => { if (path === '/') { return location.pathname === '/'; } return location.pathname.startsWith(path); }; return (
{/* Mobile Sidebar Overlay */} {isSidebarOpen && (
setSidebarOpen(false)} /> )} {/* Sidebar */} {/* Main Content */}
{/* Top Header */}

{navItems.find(i => isActive(i.path))?.label.split(' (')[0] || 'Mirchi Vyapar'}

{new Date().toLocaleDateString('mr-IN', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}
{/* Page Content */}
{children}
); }; export default Layout;