import { useCallback, useRef } from "react"; import { useTranslation } from "react-i18next"; import { check as checkUpdate } from "@tauri-apps/plugin-updater"; import { version } from "@root/package.json"; // Сервисы и хуки import { exitApp, openAppDir, openCoreDir, openLogsDir, openDevTools, exportDiagnosticInfo, } from "@/services/cmds"; import { showNotice } from "@/services/noticeService"; // Компоненты import { DialogRef } from "@/components/base"; import { TooltipIcon } from "@/components/base/base-tooltip-icon"; import { Button } from "@/components/ui/button"; // --- НАЧАЛО ИЗМЕНЕНИЙ 1: Импортируем все нужные иконки --- import { Settings, Copy, Info, Archive, FileCode, Folder, FolderCog, FolderClock, RefreshCw, Terminal, Feather, LogOut, ClipboardList, } from "lucide-react"; // Модальные окна import { ConfigViewer } from "./mods/config-viewer"; import { HotkeyViewer } from "./mods/hotkey-viewer"; import { MiscViewer } from "./mods/misc-viewer"; import { ThemeViewer } from "./mods/theme-viewer"; import { LayoutViewer } from "./mods/layout-viewer"; import { UpdateViewer } from "./mods/update-viewer"; import { BackupViewer } from "./mods/backup-viewer"; import { LiteModeViewer } from "./mods/lite-mode-viewer"; interface Props { onError?: (err: Error) => void; } // Наш переиспользуемый компонент для строки настроек const SettingRow = ({ label, extra, children, onClick, }: { label: React.ReactNode; extra?: React.ReactNode; children?: React.ReactNode; onClick?: () => void; }) => (
{/* Мы ожидаем, что label теперь может быть сложным компонентом */}
{label}
{extra &&
{extra}
}
{children}
); const SettingVergeAdvanced = ({ onError }: Props) => { const { t } = useTranslation(); const configRef = useRef(null); const hotkeyRef = useRef(null); const miscRef = useRef(null); const themeRef = useRef(null); const layoutRef = useRef(null); const updateRef = useRef(null); const backupRef = useRef(null); const liteModeRef = useRef(null); const onCheckUpdate = async () => { try { const info = await checkUpdate(); if (!info?.available) { showNotice("success", t("Currently on the Latest Version")); } else { updateRef.current?.open(); } } catch (err: any) { showNotice("error", err.message || err.toString()); } }; const onExportDiagnosticInfo = useCallback(async () => { await exportDiagnosticInfo(); showNotice("success", t("Copy Success"), 1000); }, []); // Вспомогательная функция для создания лейбла с иконкой const LabelWithIcon = ({ icon, text, }: { icon: React.ElementType; text: string; }) => { const Icon = icon; return ( {text} ); }; return (

{t("Verge Advanced Setting")}

{/* --- НАЧАЛО ИЗМЕНЕНИЙ 2: Добавляем иконки к каждому пункту --- */} backupRef.current?.open()} label={} extra={} /> configRef.current?.open()} label={} /> } extra={} /> } /> } /> } /> } /> } extra={} onClick={() => liteModeRef.current?.open()} /> } /> } > } onClick={onExportDiagnosticInfo} /> } >

v{version}

{/* --- КОНЕЦ ИЗМЕНЕНИЙ 2 --- */}
); }; export default SettingVergeAdvanced;