mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:53:44 +08:00
fix: missing proxy group delay check animations (#788)
* fix: missing proxy group delay check animation * chore: cleanup * chore: adjust content style
This commit is contained in:
parent
8b67fb7290
commit
fd84e56c00
@ -157,8 +157,8 @@ const SettingVerge = ({ onError }: Props) => {
|
|||||||
onGuard={(e) => patchVerge({ start_page: e })}
|
onGuard={(e) => patchVerge({ start_page: e })}
|
||||||
>
|
>
|
||||||
<Select size="small" sx={{ width: 140, "> div": { py: "7.5px" } }}>
|
<Select size="small" sx={{ width: 140, "> div": { py: "7.5px" } }}>
|
||||||
{routers.map((page: { label: string; link: string }) => {
|
{routers.map((page: { label: string; path: string }) => {
|
||||||
return <MenuItem value={page.link}>{t(page.label)}</MenuItem>;
|
return <MenuItem value={page.path}>{t(page.label)}</MenuItem>;
|
||||||
})}
|
})}
|
||||||
</Select>
|
</Select>
|
||||||
</GuardState>
|
</GuardState>
|
||||||
|
@ -4,9 +4,8 @@ import relativeTime from "dayjs/plugin/relativeTime";
|
|||||||
import { SWRConfig, mutate } from "swr";
|
import { SWRConfig, mutate } from "swr";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Route, Routes, useLocation } from "react-router-dom";
|
import { useLocation, useRoutes } from "react-router-dom";
|
||||||
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
import { List, Paper, ThemeProvider } from "@mui/material";
|
||||||
import { alpha, List, Paper, ThemeProvider } from "@mui/material";
|
|
||||||
import { listen } from "@tauri-apps/api/event";
|
import { listen } from "@tauri-apps/api/event";
|
||||||
import { appWindow } from "@tauri-apps/api/window";
|
import { appWindow } from "@tauri-apps/api/window";
|
||||||
import { routers } from "./_routers";
|
import { routers } from "./_routers";
|
||||||
@ -16,7 +15,7 @@ import LogoSvg from "@/assets/image/logo.svg?react";
|
|||||||
import LogoSvg_dark from "@/assets/image/logo_dark.svg?react";
|
import LogoSvg_dark from "@/assets/image/logo_dark.svg?react";
|
||||||
import { atomThemeMode } from "@/services/states";
|
import { atomThemeMode } from "@/services/states";
|
||||||
import { useRecoilState } from "recoil";
|
import { useRecoilState } from "recoil";
|
||||||
import { BaseErrorBoundary, Notice } from "@/components/base";
|
import { Notice } from "@/components/base";
|
||||||
import { LayoutItem } from "@/components/layout/layout-item";
|
import { LayoutItem } from "@/components/layout/layout-item";
|
||||||
import { LayoutControl } from "@/components/layout/layout-control";
|
import { LayoutControl } from "@/components/layout/layout-control";
|
||||||
import { LayoutTraffic } from "@/components/layout/layout-traffic";
|
import { LayoutTraffic } from "@/components/layout/layout-traffic";
|
||||||
@ -27,6 +26,8 @@ import "dayjs/locale/ru";
|
|||||||
import "dayjs/locale/zh-cn";
|
import "dayjs/locale/zh-cn";
|
||||||
import { getPortableFlag } from "@/services/cmds";
|
import { getPortableFlag } from "@/services/cmds";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import React from "react";
|
||||||
|
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
||||||
export let portableFlag = false;
|
export let portableFlag = false;
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
@ -43,6 +44,8 @@ const Layout = () => {
|
|||||||
const { language, start_page } = verge || {};
|
const { language, start_page } = verge || {};
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const routersEles = useRoutes(routers);
|
||||||
|
if (!routersEles) return null;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener("keydown", (e) => {
|
window.addEventListener("keydown", (e) => {
|
||||||
@ -142,7 +145,7 @@ const Layout = () => {
|
|||||||
{routers.map((router) => (
|
{routers.map((router) => (
|
||||||
<LayoutItem
|
<LayoutItem
|
||||||
key={router.label}
|
key={router.label}
|
||||||
to={router.link}
|
to={router.path}
|
||||||
icon={router.icon}
|
icon={router.icon}
|
||||||
>
|
>
|
||||||
{t(router.label)}
|
{t(router.label)}
|
||||||
@ -173,19 +176,7 @@ const Layout = () => {
|
|||||||
timeout={300}
|
timeout={300}
|
||||||
classNames="page"
|
classNames="page"
|
||||||
>
|
>
|
||||||
<Routes>
|
{React.cloneElement(routersEles, { key: location.pathname })}
|
||||||
{routers.map(({ label, link, ele: Ele }) => (
|
|
||||||
<Route
|
|
||||||
key={label}
|
|
||||||
path={link}
|
|
||||||
element={
|
|
||||||
<BaseErrorBoundary key={label}>
|
|
||||||
<Ele />
|
|
||||||
</BaseErrorBoundary>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Routes>
|
|
||||||
</CSSTransition>
|
</CSSTransition>
|
||||||
</TransitionGroup>
|
</TransitionGroup>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,6 +5,7 @@ import ProfilesPage from "./profiles";
|
|||||||
import SettingsPage from "./settings";
|
import SettingsPage from "./settings";
|
||||||
import ConnectionsPage from "./connections";
|
import ConnectionsPage from "./connections";
|
||||||
import RulesPage from "./rules";
|
import RulesPage from "./rules";
|
||||||
|
import { BaseErrorBoundary } from "@/components/base";
|
||||||
|
|
||||||
import ProxiesSvg from "@/assets/image/itemicon/proxies.svg?react";
|
import ProxiesSvg from "@/assets/image/itemicon/proxies.svg?react";
|
||||||
import ProfilesSvg from "@/assets/image/itemicon/profiles.svg?react";
|
import ProfilesSvg from "@/assets/image/itemicon/profiles.svg?react";
|
||||||
@ -25,44 +26,49 @@ import SettingsRoundedIcon from "@mui/icons-material/SettingsRounded";
|
|||||||
export const routers = [
|
export const routers = [
|
||||||
{
|
{
|
||||||
label: "Label-Proxies",
|
label: "Label-Proxies",
|
||||||
link: "/",
|
path: "/",
|
||||||
icon: [<WifiRoundedIcon />, <ProxiesSvg />],
|
icon: [<WifiRoundedIcon />, <ProxiesSvg />],
|
||||||
ele: ProxiesPage,
|
element: <ProxiesPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Label-Profiles",
|
label: "Label-Profiles",
|
||||||
link: "/profile",
|
path: "/profile",
|
||||||
icon: [<DnsRoundedIcon />, <ProfilesSvg />],
|
icon: [<DnsRoundedIcon />, <ProfilesSvg />],
|
||||||
ele: ProfilesPage,
|
element: <ProfilesPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Label-Connections",
|
label: "Label-Connections",
|
||||||
link: "/connections",
|
path: "/connections",
|
||||||
icon: [<LanguageRoundedIcon />, <ConnectionsSvg />],
|
icon: [<LanguageRoundedIcon />, <ConnectionsSvg />],
|
||||||
ele: ConnectionsPage,
|
element: <ConnectionsPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Label-Rules",
|
label: "Label-Rules",
|
||||||
link: "/rules",
|
path: "/rules",
|
||||||
icon: [<ForkRightRoundedIcon />, <RulesSvg />],
|
icon: [<ForkRightRoundedIcon />, <RulesSvg />],
|
||||||
ele: RulesPage,
|
element: <RulesPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Label-Logs",
|
label: "Label-Logs",
|
||||||
link: "/logs",
|
path: "/logs",
|
||||||
icon: [<SubjectRoundedIcon />, <LogsSvg />],
|
icon: [<SubjectRoundedIcon />, <LogsSvg />],
|
||||||
ele: LogsPage,
|
element: <LogsPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Label-Test",
|
label: "Label-Test",
|
||||||
link: "/test",
|
path: "/test",
|
||||||
icon: [<WifiTetheringRoundedIcon />, <TestSvg />],
|
icon: [<WifiTetheringRoundedIcon />, <TestSvg />],
|
||||||
ele: TestPage,
|
element: <TestPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Label-Settings",
|
label: "Label-Settings",
|
||||||
link: "/settings",
|
path: "/settings",
|
||||||
icon: [<SettingsRoundedIcon />, <SettingsSvg />],
|
icon: [<SettingsRoundedIcon />, <SettingsSvg />],
|
||||||
ele: SettingsPage,
|
element: <SettingsPage />,
|
||||||
},
|
},
|
||||||
];
|
].map((router) => ({
|
||||||
|
...router,
|
||||||
|
element: (
|
||||||
|
<BaseErrorBoundary key={router.label}>{router.element}</BaseErrorBoundary>
|
||||||
|
),
|
||||||
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user