"use client" import { useNotification } from "@/app/(app)/context" import { UploadButton } from "@/components/files/upload-button" import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarRail, SidebarTrigger, useSidebar, } from "@/components/ui/sidebar" import { UserProfile } from "@/lib/auth" import { APP_TITLE, IS_SELF_HOSTED_MODE } from "@/lib/constants" import { ClockArrowUp, FileText, Import, LayoutDashboard, Settings, Sparkles, Upload } from "lucide-react" import Image from "next/image" import Link from "next/link" import { usePathname } from "next/navigation" import { useEffect } from "react" import { ColoredText } from "../ui/colored-text" import { Blinker } from "./blinker" import { SidebarMenuItemWithHighlight } from "./sidebar-item" import SidebarUser from "./sidebar-user" export function AppSidebar({ unsortedFilesCount, profile }: { unsortedFilesCount: number; profile: UserProfile }) { const { open, setOpenMobile } = useSidebar() const pathname = usePathname() const { notification } = useNotification() // Hide sidebar on mobile when clicking an item useEffect(() => { setOpenMobile(false) }, [pathname, setOpenMobile]) return ( <> Logo
{APP_TITLE}
{open ? Upload : ""} Home Transactions {notification && notification.code === "sidebar.transactions" && notification.message && ( )} Unsorted {unsortedFilesCount > 0 && ( {unsortedFilesCount} )} {notification && notification.code === "sidebar.unsorted" && notification.message && } Settings Import from CSV {IS_SELF_HOSTED_MODE && ( Thank the author )} {!open && ( )}
) }