import { SearchIcon, XIcon } from "lucide-react" import { useTranslation } from "react-i18next" import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from "@/components/ui/input-group" import { ScrollArea } from "@/components/ui/scroll-area" import { cn } from "@/lib/utils" import { settingsStoreActions, useSettingsStore } from "@/store" import { filterSettingsNavItemsBySearch, settingsNavItemKind, settingsSectionId, type SettingsSectionId, } from "./utils" interface SettingsSidebarProps { selectedSection: SettingsSectionId matchedSections: SettingsSectionId[] matchedItemIds: Set isAdvancedRoute: boolean activeAdvancedRoute: "shortcuts" | "url-rewrite" | null onSelectSection: (section: SettingsSectionId) => void onNavigateRoute: (to: "/main/settings/shortcuts") => void } export function SettingsSidebar({ selectedSection, matchedSections, matchedItemIds, isAdvancedRoute, activeAdvancedRoute, onSelectSection, onNavigateRoute, }: SettingsSidebarProps) { const { t } = useTranslation() const searchValue = useSettingsStore.use.searchValue() const resolveSectionLabel = (sectionId: SettingsSectionId) => { if (sectionId === settingsSectionId.General) { return t("SETTINGS_SECTION_GENERAL") } if (sectionId === settingsSectionId.Appearance) { return t("SETTINGS_SECTION_APPEARANCE") } if (sectionId === settingsSectionId.UploadWorkflow) { return t("SETTINGS_SECTION_UPLOAD_WORKFLOW") } if (sectionId === settingsSectionId.Network) { return t("SETTINGS_SECTION_NETWORK") } if (sectionId === settingsSectionId.Advanced) { return t("SETTINGS_SECTION_ADVANCED") } return t("SETTINGS_SECTION_ABOUT") } const normalizedSearch = searchValue.trim().toLowerCase() const hasSearch = normalizedSearch.length > 0 const filteredNavItems = filterSettingsNavItemsBySearch( searchValue, matchedSections, matchedItemIds ) return ( ) }