import { useStore } from "@nanostores/react"; import { Bell, Bookmark, Folder, Highlighter, Home, LogOut, MessageSquareText, MoreHorizontal, PenSquare, Search, Settings, User, X, } from "lucide-react"; import React, { useEffect, useState } from "react"; import { Link, useLocation } from "react-router-dom"; import { getUnreadNotificationCount } from "../../api/client"; import { $user, logout } from "../../store/auth"; import { AppleIcon } from "../common/Icons"; export default function MobileNav() { const user = useStore($user); const location = useLocation(); const [isMenuOpen, setIsMenuOpen] = useState(false); const [unreadCount, setUnreadCount] = useState(0); const isAuthenticated = !!user; const isActive = (path: string) => { if (path === "/") return location.pathname === "/"; return location.pathname.startsWith(path); }; useEffect(() => { if (isAuthenticated) { getUnreadNotificationCount() .then((count) => setUnreadCount(count || 0)) .catch(() => {}); } }, [isAuthenticated]); const closeMenu = () => setIsMenuOpen(false); return ( <> {isMenuOpen && (
)} {isMenuOpen && (