import { type ReactNode, useEffect, useState } from "react"; import { NavLink, useLocation } from "react-router-dom"; import { Activity, AudioLines, Clock3, Database, Download, FolderOpen, Heart, Library, Settings2, ShieldCheck, } from "lucide-react"; import { getDesktopBridge } from "../helpers/desktopBridge"; import styles from "./AppShell.module.css"; const NAV_ITEMS = [ { to: "/", label: "Playlist", icon: Library, end: true }, { to: "/spotify-library", label: "My Spotify", icon: Heart, also: ["/artist/", "/album/"] }, { to: "/identify", label: "Identify Files", icon: AudioLines }, { to: "/convert", label: "Convert Audio", icon: Download }, { to: "/library", label: "Local Library", icon: Database }, { to: "/analyze", label: "Audio Analyzer", icon: Activity }, { to: "/history", label: "History", icon: Clock3 }, { to: "/settings", label: "Settings", icon: Settings2 }, ]; export function AppShell({ children }: { children: ReactNode }) { const { pathname } = useLocation(); const desktop = getDesktopBridge(); const [downloadFolder, setDownloadFolder] = useState(); useEffect(() => { desktop?.getDownloadFolder().then(setDownloadFolder).catch(() => undefined); }, [pathname]); async function chooseDownloadFolder() { const chosen = await desktop?.chooseDownloadFolder(); if (chosen) setDownloadFolder(chosen); } return (
{children}
); }