'use client'; import { Search, Bell, Plus, Menu } from 'lucide-react'; import { usePathname } from 'next/navigation'; import { Button } from '@/components/ui/button'; import { useSidebarStore } from '@/lib/stores/use-sidebar-store'; import { useCreateDialogStore } from '@/lib/stores/use-create-dialog-store'; import { CommandPalette } from '@/components/command-palette'; export function TopBar() { const pathname = usePathname(); const { setMobileOpen } = useSidebarStore(); const openCreate = useCreateDialogStore((s) => s.openCreate); function handleCreate() { if (pathname.startsWith('/projects')) openCreate('project'); else if (pathname.startsWith('/habits')) openCreate('habit'); else if (pathname.startsWith('/tasks')) openCreate('task'); else { document.dispatchEvent(new KeyboardEvent('keydown', { key: 'k', metaKey: true })); } } const label = pathname.startsWith('/projects') ? 'New project' : pathname.startsWith('/habits') ? 'New habit' : pathname.startsWith('/tasks') ? 'New task' : 'Quick add'; return ( <>
); }