import { ChevronRightIcon } from "lucide-react" import { useTranslation } from "react-i18next" import { AppMainCard } from "@/components/common/app-main-card" import { MainCardHeader } from "@/components/common/main-card-header" import { Button } from "@/components/ui/button" import { ScrollArea } from "@/components/ui/scroll-area" import { settingsStoreActions } from "@/store" import { SettingsSectionAbout } from "./settings-section-about" import { SettingsSectionAdvanced } from "./settings-section-advanced" import { SettingsSectionAppearance } from "./settings-section-appearance" import { SettingsSectionGeneral } from "./settings-section-general" import { SettingsSectionNetwork } from "./settings-section-network" import { SettingsSectionUploadWorkflow } from "./settings-section-upload-workflow" import { sectionHasMatchedItems, settingsSectionId, type SettingsSectionId, } from "./utils" interface SettingsPanelProps { selectedSection: SettingsSectionId hasSearch: boolean matchedItemIds: Set isMac: boolean onNavigateUrlRewrite: () => void } export function SettingsPanel({ selectedSection, hasSearch, matchedItemIds, isMac, onNavigateUrlRewrite, }: SettingsPanelProps) { const { t } = useTranslation() const isItemVisible = (itemId: string) => !hasSearch || matchedItemIds.has(itemId) const isAnyItemVisible = (itemIds: string[]) => itemIds.some((itemId) => isItemVisible(itemId)) const hasVisibleContent = !hasSearch || sectionHasMatchedItems(selectedSection, matchedItemIds) const sectionTitleMap: Record = { [settingsSectionId.General]: t("SETTINGS_SECTION_GENERAL"), [settingsSectionId.Appearance]: t("SETTINGS_SECTION_APPEARANCE"), [settingsSectionId.UploadWorkflow]: t("SETTINGS_SECTION_UPLOAD_WORKFLOW"), [settingsSectionId.Network]: t("SETTINGS_SECTION_NETWORK"), [settingsSectionId.Advanced]: t("SETTINGS_SECTION_ADVANCED"), [settingsSectionId.About]: t("SETTINGS_SECTION_ABOUT"), } const sectionTitle = sectionTitleMap[selectedSection] const renderSectionContent = () => { if (selectedSection === settingsSectionId.General) { return ( ) } if (selectedSection === settingsSectionId.Appearance) { return ( ) } if (selectedSection === settingsSectionId.UploadWorkflow) { return } if (selectedSection === settingsSectionId.Network) { return ( ) } if (selectedSection === settingsSectionId.Advanced) { return ( ) } return } return (
{t("SETTINGS")} {sectionTitle} } />
{hasSearch && !hasVisibleContent ? (
{t("SETTINGS_NO_RESULTS_TITLE")}

{t("SETTINGS_NO_RESULTS_DESCRIPTION")}

) : null} {!hasSearch || hasVisibleContent ? renderSectionContent() : null}
) }