diff --git a/src/renderer/src/components/settings/general-config.tsx b/src/renderer/src/components/settings/general-config.tsx index 397a564..30d1c2c 100644 --- a/src/renderer/src/components/settings/general-config.tsx +++ b/src/renderer/src/components/settings/general-config.tsx @@ -51,6 +51,7 @@ const GeneralConfig: React.FC = () => { proxyInTray = true, disableTray = false, disableTrayIconColor = false, + disableAnimations = false, showFloatingWindow: showFloating = false, spinFloatingIcon = true, floatingWindowCompatMode = true, @@ -388,6 +389,15 @@ const GeneralConfig: React.FC = () => { }, 1000)} /> + + { + await patchAppConfig({ disableAnimations: v }) + }} + /> + = (props) => { const { iconOnly } = props const { appConfig } = useAppConfig() - const { showTraffic = false, connectionCardStatus = 'col-span-2' } = appConfig || {} + const { showTraffic = false, connectionCardStatus = 'col-span-2', disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/connections') @@ -187,7 +187,7 @@ const ConnCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
@@ -234,7 +234,7 @@ const ConnCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/dns-card.tsx b/src/renderer/src/components/sider/dns-card.tsx index eafc5d9..6cf68ff 100644 --- a/src/renderer/src/components/sider/dns-card.tsx +++ b/src/renderer/src/components/sider/dns-card.tsx @@ -17,7 +17,7 @@ const DNSCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig, patchAppConfig } = useAppConfig() const { iconOnly } = props - const { dnsCardStatus = 'col-span-1', controlDns = true } = appConfig || {} + const { dnsCardStatus = 'col-span-1', controlDns = true, disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/dns') @@ -78,7 +78,7 @@ const DNSCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/log-card.tsx b/src/renderer/src/components/sider/log-card.tsx index a8ba461..7def1a5 100644 --- a/src/renderer/src/components/sider/log-card.tsx +++ b/src/renderer/src/components/sider/log-card.tsx @@ -15,7 +15,7 @@ const LogCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig } = useAppConfig() const { iconOnly } = props - const { logCardStatus = 'col-span-1' } = appConfig || {} + const { logCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/logs') @@ -65,7 +65,7 @@ const LogCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/mihomo-core-card.tsx b/src/renderer/src/components/sider/mihomo-core-card.tsx index ca91fe3..27e1b23 100644 --- a/src/renderer/src/components/sider/mihomo-core-card.tsx +++ b/src/renderer/src/components/sider/mihomo-core-card.tsx @@ -19,7 +19,7 @@ interface Props { const MihomoCoreCard: React.FC = (props) => { const { appConfig } = useAppConfig() const { iconOnly } = props - const { mihomoCoreCardStatus = 'col-span-2' } = appConfig || {} + const { mihomoCoreCardStatus = 'col-span-2', disableAnimations = false } = appConfig || {} const { data: version, mutate } = useSWR('mihomoVersion', mihomoVersion) const location = useLocation() const navigate = useNavigate() @@ -87,7 +87,7 @@ const MihomoCoreCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
= (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/override-card.tsx b/src/renderer/src/components/sider/override-card.tsx index 8b86438..5698f23 100644 --- a/src/renderer/src/components/sider/override-card.tsx +++ b/src/renderer/src/components/sider/override-card.tsx @@ -15,7 +15,7 @@ const OverrideCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig } = useAppConfig() const { iconOnly } = props - const { overrideCardStatus = 'col-span-1' } = appConfig || {} + const { overrideCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/override') @@ -64,7 +64,7 @@ const OverrideCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/profile-card.tsx b/src/renderer/src/components/sider/profile-card.tsx index 8222ab4..a1ba451 100644 --- a/src/renderer/src/components/sider/profile-card.tsx +++ b/src/renderer/src/components/sider/profile-card.tsx @@ -26,7 +26,7 @@ const ProfileCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig, patchAppConfig } = useAppConfig() const { iconOnly } = props - const { profileCardStatus = 'col-span-2', profileDisplayDate = 'expire' } = appConfig || {} + const { profileCardStatus = 'col-span-2', profileDisplayDate = 'expire', disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/profiles') @@ -92,7 +92,7 @@ const ProfileCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
= (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/proxy-card.tsx b/src/renderer/src/components/sider/proxy-card.tsx index 34c2498..2b6c238 100644 --- a/src/renderer/src/components/sider/proxy-card.tsx +++ b/src/renderer/src/components/sider/proxy-card.tsx @@ -16,7 +16,7 @@ const ProxyCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig } = useAppConfig() const { iconOnly } = props - const { proxyCardStatus = 'col-span-1' } = appConfig || {} + const { proxyCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/proxies') @@ -67,7 +67,7 @@ const ProxyCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/resource-card.tsx b/src/renderer/src/components/sider/resource-card.tsx index 317a630..3318c3a 100644 --- a/src/renderer/src/components/sider/resource-card.tsx +++ b/src/renderer/src/components/sider/resource-card.tsx @@ -15,7 +15,7 @@ const ResourceCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig } = useAppConfig() const { iconOnly } = props - const { resourceCardStatus = 'col-span-1' } = appConfig || {} + const { resourceCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/resources') @@ -65,7 +65,7 @@ const ResourceCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/rule-card.tsx b/src/renderer/src/components/sider/rule-card.tsx index ff37576..618545b 100644 --- a/src/renderer/src/components/sider/rule-card.tsx +++ b/src/renderer/src/components/sider/rule-card.tsx @@ -16,7 +16,7 @@ const RuleCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig } = useAppConfig() const { iconOnly } = props - const { ruleCardStatus = 'col-span-1' } = appConfig || {} + const { ruleCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/rules') @@ -67,7 +67,7 @@ const RuleCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/sniff-card.tsx b/src/renderer/src/components/sider/sniff-card.tsx index 7d38bca..7af5ef6 100644 --- a/src/renderer/src/components/sider/sniff-card.tsx +++ b/src/renderer/src/components/sider/sniff-card.tsx @@ -17,7 +17,7 @@ const SniffCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig, patchAppConfig } = useAppConfig() const { iconOnly } = props - const { sniffCardStatus = 'col-span-1', controlSniff = true } = appConfig || {} + const { sniffCardStatus = 'col-span-1', controlSniff = true, disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/sniffer') @@ -78,7 +78,7 @@ const SniffCard: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/substore-card.tsx b/src/renderer/src/components/sider/substore-card.tsx index 77b6cff..9f849ab 100644 --- a/src/renderer/src/components/sider/substore-card.tsx +++ b/src/renderer/src/components/sider/substore-card.tsx @@ -15,7 +15,7 @@ const SubStoreCard: React.FC = (props) => { const { t } = useTranslation() const { appConfig } = useAppConfig() const { iconOnly } = props - const { substoreCardStatus = 'col-span-1', useSubStore = true } = appConfig || {} + const { substoreCardStatus = 'col-span-1', useSubStore = true, disableAnimations = false } = appConfig || {} const location = useLocation() const navigate = useNavigate() const match = location.pathname.includes('/substore') @@ -66,7 +66,7 @@ const SubStoreCard: React.FC = (props) => { {...attributes} {...listeners} fullWidth - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/sysproxy-switcher.tsx b/src/renderer/src/components/sider/sysproxy-switcher.tsx index 81efd7e..cd6b183 100644 --- a/src/renderer/src/components/sider/sysproxy-switcher.tsx +++ b/src/renderer/src/components/sider/sysproxy-switcher.tsx @@ -22,7 +22,7 @@ const SysproxySwitcher: React.FC = (props) => { const match = location.pathname.includes('/sysproxy') const { appConfig, patchAppConfig } = useAppConfig() const { controledMihomoConfig } = useControledMihomoConfig() - const { sysProxy, sysproxyCardStatus = 'col-span-1' } = appConfig || {} + const { sysProxy, sysproxyCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {} const { tun } = controledMihomoConfig || {} const { enable } = sysProxy || {} const { @@ -93,7 +93,7 @@ const SysproxySwitcher: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/components/sider/tun-switcher.tsx b/src/renderer/src/components/sider/tun-switcher.tsx index 0389b1a..54533e2 100644 --- a/src/renderer/src/components/sider/tun-switcher.tsx +++ b/src/renderer/src/components/sider/tun-switcher.tsx @@ -21,7 +21,7 @@ const TunSwitcher: React.FC = (props) => { const navigate = useNavigate() const match = location.pathname.includes('/tun') || false const { appConfig } = useAppConfig() - const { tunCardStatus = 'col-span-1' } = appConfig || {} + const { tunCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {} const sysProxyEnabled = appConfig?.sysProxy?.enable ?? false const { controledMihomoConfig, patchControledMihomoConfig } = useControledMihomoConfig() const { tun } = controledMihomoConfig || {} @@ -127,7 +127,7 @@ const TunSwitcher: React.FC = (props) => { ref={setNodeRef} {...attributes} {...listeners} - className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} + className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`} >
diff --git a/src/renderer/src/locales/en-US.json b/src/renderer/src/locales/en-US.json index 71310b2..9888b4f 100644 --- a/src/renderer/src/locales/en-US.json +++ b/src/renderer/src/locales/en-US.json @@ -62,6 +62,7 @@ "settings.disableTray": "Disable Tray Icon", "settings.proxyInTray": "Show Proxy Info in Tray Menu", "settings.disableTrayIconColor": "Disable Tray Icon Color Changes", + "settings.disableAnimations": "Disable Animation Effects", "settings.showTraffic_windows": "Show Network Speed in Taskbar", "settings.showTraffic_mac": "Show Network Speed in Status Bar", "settings.showDockIcon": "Show Dock Icon", diff --git a/src/renderer/src/locales/fa-IR.json b/src/renderer/src/locales/fa-IR.json index 057fcbd..055f0d0 100644 --- a/src/renderer/src/locales/fa-IR.json +++ b/src/renderer/src/locales/fa-IR.json @@ -59,6 +59,7 @@ "settings.disableTray": "غیرفعال کردن آیکون سیستم‌تری", "settings.proxyInTray": "نمایش اطلاعات پراکسی در منوی سیستم‌تری", "settings.disableTrayIconColor": "غیرفعال کردن تغییر رنگ آیکون تری", + "settings.disableAnimations": "غیرفعال کردن جلوه‌های انیمیشن", "settings.showTraffic_windows": "نمایش سرعت شبکه در نوار وظیفه", "settings.showTraffic_mac": "نمایش سرعت شبکه در نوار وضعیت", "settings.showDockIcon": "نمایش آیکون Dock", diff --git a/src/renderer/src/locales/ru-RU.json b/src/renderer/src/locales/ru-RU.json index ce27fb8..91ca742 100644 --- a/src/renderer/src/locales/ru-RU.json +++ b/src/renderer/src/locales/ru-RU.json @@ -59,6 +59,7 @@ "settings.disableTray": "Отключить значок в трее", "settings.proxyInTray": "Показывать информацию о прокси в трее", "settings.disableTrayIconColor": "Отключить смену цвета значка в трее", + "settings.disableAnimations": "Отключить анимационные эффекты", "settings.showTraffic_windows": "Показывать скорость в панели задач", "settings.showTraffic_mac": "Показывать скорость в строке состояния", "settings.showDockIcon": "Показывать значок в доке", diff --git a/src/renderer/src/locales/zh-CN.json b/src/renderer/src/locales/zh-CN.json index 7e42388..f45abd9 100644 --- a/src/renderer/src/locales/zh-CN.json +++ b/src/renderer/src/locales/zh-CN.json @@ -62,6 +62,7 @@ "settings.disableTray": "禁用托盘图标", "settings.proxyInTray": "在托盘菜单显示代理信息", "settings.disableTrayIconColor": "禁用托盘图标颜色变化", + "settings.disableAnimations": "禁用动画效果", "settings.showTraffic_windows": "在任务栏显示网速", "settings.showTraffic_mac": "在状态栏显示网速", "settings.showDockIcon": "显示 Dock 图标", diff --git a/src/shared/types.d.ts b/src/shared/types.d.ts index 5ddf88e..0afea9e 100644 --- a/src/shared/types.d.ts +++ b/src/shared/types.d.ts @@ -288,6 +288,7 @@ interface IAppConfig { useDockIcon?: boolean showTraffic?: boolean disableTrayIconColor?: boolean + disableAnimations?: boolean webdavUrl?: string webdavDir?: string webdavUsername?: string