'use client' import Link from 'next/link' import { Home, Calendar, List, Gift, Coins, Settings, Info, CheckSquare } from 'lucide-react' import { useAtom } from 'jotai' import { browserSettingsAtom } from '@/lib/atoms' import { useEffect, useState } from 'react' import AboutModal from './AboutModal' import { HabitIcon, TaskIcon } from '@/lib/constants' import { useHelpers } from '@/lib/client-helpers' type ViewPort = 'main' | 'mobile' const navItems = (isTasksView: boolean) => [ { icon: Home, label: 'Dashboard', href: '/', position: 'main' }, { icon: isTasksView ? TaskIcon : HabitIcon, label: isTasksView ? 'Tasks' : 'Habits', href: '/habits', position: 'main' }, { icon: Calendar, label: 'Calendar', href: '/calendar', position: 'main' }, { icon: Gift, label: 'Wishlist', href: '/wishlist', position: 'main' }, { icon: Coins, label: 'Coins', href: '/coins', position: 'main' }, ] interface NavigationProps { className?: string viewPort: ViewPort } export default function Navigation({ className, viewPort }: NavigationProps) { const [showAbout, setShowAbout] = useState(false) const [isMobileView, setIsMobileView] = useState(false) const [browserSettings] = useAtom(browserSettingsAtom) const isTasksView = browserSettings.viewType === 'tasks' const { isIOS } = useHelpers() useEffect(() => { const handleResize = () => { setIsMobileView(window.innerWidth < 1024) } // Set initial value handleResize() // Add event listener window.addEventListener('resize', handleResize) // Cleanup return () => window.removeEventListener('resize', handleResize) }, []) if (viewPort === 'mobile' && isMobileView) { return ( <>
{/* Add padding at the bottom to prevent content from being hidden */} setShowAbout(false)} /> ) } if (viewPort === 'main' && !isMobileView) { return (
setShowAbout(false)} />
) } }