import { Clock, BarChart3, Settings, Sun, Moon } from "lucide-react"; import { Button } from "@/components/atoms/Button"; import { useTheme } from "@/lib/theme"; import { useStore } from "@/lib/store"; import { Link, useLocation } from "wouter"; interface SidebarProps { className?: string; isMobile?: boolean; onNavigate?: () => void; } export function Sidebar({ className = "", isMobile = false, onNavigate }: SidebarProps) { const { theme, toggleTheme } = useTheme(); const [location] = useLocation(); const localSessions = useStore((state) => state.localSessions); // Calculate today's stats const today = new Date(); today.setHours(0, 0, 0, 0); const todaySessions = localSessions.filter(session => { const sessionDate = new Date(session.startedAt); sessionDate.setHours(0, 0, 0, 0); return sessionDate.getTime() === today.getTime(); }); const todayFocusSessions = todaySessions.filter(s => s.type === 'focus'); const completedToday = todayFocusSessions.filter(s => s.completed); const completionRate = todayFocusSessions.length > 0 ? Math.round((completedToday.length / todayFocusSessions.length) * 100) : 0; const navItems = [ { path: "/", icon: Clock, label: "Timer", testId: "nav-timer" }, { path: "/history", icon: BarChart3, label: "History", testId: "nav-history" }, { path: "/settings", icon: Settings, label: "Settings", testId: "nav-settings" }, ]; const isActive = (path: string) => { if (path === "/" && location === "/") return true; if (path !== "/" && location.startsWith(path)) return true; return false; }; return ( ); }