import { useRef, useState, type RefObject } from "react"; import { HomeIcon } from "@/components/ui/home"; import { HistoryIcon } from "@/components/ui/history-icon"; import { SettingsIcon } from "@/components/ui/settings"; import { ActivityIcon, type ActivityIconHandle } from "@/components/ui/activity"; import { TerminalIcon } from "@/components/ui/terminal"; import { FileMusicIcon, type FileMusicIconHandle } from "@/components/ui/file-music"; import { FilePenIcon, type FilePenIconHandle } from "@/components/ui/file-pen"; import { FileTextIcon, type FileTextIconHandle } from "@/components/ui/file-text"; import { BugReportIcon } from "@/components/ui/bug-report-icon"; import { CoffeeIcon } from "@/components/ui/coffee"; import { BlocksIcon } from "@/components/ui/blocks-icon"; import { AudioLinesIcon, type AudioLinesIconHandle } from "@/components/ui/audio-lines"; import { ToolCaseIcon } from "@/components/ui/tool-case"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Checkbox } from "@/components/ui/checkbox"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import { Button } from "@/components/ui/button"; import { openExternal } from "@/lib/utils"; export type PageType = "main" | "settings" | "debug" | "audio-analysis" | "audio-converter" | "audio-resampler" | "file-manager" | "lyrics-manager" | "projects" | "support" | "history"; interface SidebarProps { currentPage: PageType; onPageChange: (page: PageType) => void; } interface AnimatedIconHandle { startAnimation: () => void; stopAnimation: () => void; } export function Sidebar({ currentPage, onPageChange }: SidebarProps) { const [isIssuesDialogOpen, setIsIssuesDialogOpen] = useState(false); const [hasIssueAgreement, setHasIssueAgreement] = useState(false); const analyzerIconRef = useRef(null); const resamplerIconRef = useRef(null); const converterIconRef = useRef(null); const fileManagerIconRef = useRef(null); const lyricsManagerIconRef = useRef(null); const handleIssuesDialogChange = (open: boolean) => { setIsIssuesDialogOpen(open); if (!open) { setHasIssueAgreement(false); } }; const handleOpenIssues = () => { openExternal("https://github.com/spotbye/SpotiFLAC/issues"); handleIssuesDialogChange(false); }; const getAnimatedItemHandlers = (iconRef: RefObject) => ({ onMouseEnter: () => iconRef.current?.startAnimation(), onMouseLeave: () => iconRef.current?.stopAnimation(), onFocus: () => iconRef.current?.startAnimation(), onBlur: () => iconRef.current?.stopAnimation(), }); return (

Home

History

Settings

Debug Logs

Tools

onPageChange("audio-analysis")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(analyzerIconRef)}> Audio Quality Analyzer onPageChange("audio-resampler")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(resamplerIconRef)}> Audio Resampler onPageChange("audio-converter")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(converterIconRef)}> Audio Converter onPageChange("file-manager")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(fileManagerIconRef)}> File Manager onPageChange("lyrics-manager")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(lyricsManagerIconRef)}> Lyrics Manager

Report Bugs or Request Features

Before Opening GitHub Issues

Important

Search existing issues first and use the issue template when opening a new report or request.

Other Projects

Support Me

); }