import { BookOpenIcon, BracesIcon, ExternalLinkIcon, GitForkIcon, InfoIcon, type LucideIcon } from "lucide-react"; import { Link, matchPath, useLocation } from "react-router-dom"; import { useAppSidebar } from "@/contexts/AppSidebarContext"; import { MEMOS_API_DOCUMENTATION_URL, MEMOS_DOCUMENTATION_URL, MEMOS_GITHUB_URL } from "@/lib/constants"; import { cn } from "@/lib/utils"; import { ROUTES } from "@/router/routes"; import { useTranslate } from "@/utils/i18n"; import { SIDEBAR_ROW_CLASSES, SidebarRowIconSlot, sidebarRowStateClasses } from "./SidebarRow"; import SidebarSection, { SIDEBAR_SECTION_STACK_CLASSES } from "./SidebarSection"; interface ResourceLink { labelKey: "about.documents" | "about.api-docs" | "about.github-repository"; href: string; icon: LucideIcon; } const RESOURCE_LINKS: ResourceLink[] = [ { labelKey: "about.documents", href: MEMOS_DOCUMENTATION_URL, icon: BookOpenIcon }, { labelKey: "about.api-docs", href: MEMOS_API_DOCUMENTATION_URL, icon: BracesIcon }, { labelKey: "about.github-repository", href: MEMOS_GITHUB_URL, icon: GitForkIcon }, ]; const CommonSidebarContent = () => { const t = useTranslate(); const location = useLocation(); const { setMobileOpen } = useAppSidebar(); const aboutActive = Boolean(matchPath(ROUTES.ABOUT, location.pathname)); return (
setMobileOpen(false)} className={cn(SIDEBAR_ROW_CLASSES, sidebarRowStateClasses(aboutActive ? "current" : "idle"))} > {t("common.about")} {RESOURCE_LINKS.map((resource) => ( setMobileOpen(false)} className={cn(SIDEBAR_ROW_CLASSES, sidebarRowStateClasses())} > {t(resource.labelKey)} ))}
); }; export default CommonSidebarContent;