'use client' import { browserSettingsAtom, habitsAtom, settingsAtom } from '@/lib/atoms' import { HabitIcon, TaskIcon } from '@/lib/constants' import { cn, isHabitDueToday } from '@/lib/utils' import { useAtom } from 'jotai' import { useTranslations } from 'next-intl' import { usePathname, useRouter } from 'next/navigation' import { NotificationBadge } from './ui/notification-badge' interface ViewToggleProps { className?: string } export function ViewToggle({ className }: ViewToggleProps) { const t = useTranslations('ViewToggle') const [browserSettings, setBrowserSettings] = useAtom(browserSettingsAtom) const [habits] = useAtom(habitsAtom) const [settings] = useAtom(settingsAtom) const pathname = usePathname(); const router = useRouter(); const handleViewChange = () => { router.push(pathname.includes("habits") ? "/tasks" : "/habits"); } // Calculate due tasks count const dueTasksCount = habits.habits.filter(habit => habit.isTask && isHabitDueToday({ habit, timezone: settings.system.timezone }) ).length return (
0} variant={pathname.includes('tasks') ? 'secondary' : 'default'} className="shadow-md" >
) }