mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 01:23:43 +08:00
refactor: simplify useConnectionSetting
(#1141)
This commit is contained in:
parent
7cf256dc7c
commit
3a9a1439d9
@ -33,7 +33,7 @@
|
|||||||
"ahooks": "^3.8.0",
|
"ahooks": "^3.8.0",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"dayjs": "1.11.5",
|
"dayjs": "1.11.5",
|
||||||
"foxact": "^0.2.34",
|
"foxact": "^0.2.35",
|
||||||
"i18next": "^23.11.5",
|
"i18next": "^23.11.5",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"meta-json-schema": "1.18.5-alpha4",
|
"meta-json-schema": "1.18.5-alpha4",
|
||||||
|
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@ -53,8 +53,8 @@ importers:
|
|||||||
specifier: 1.11.5
|
specifier: 1.11.5
|
||||||
version: 1.11.5
|
version: 1.11.5
|
||||||
foxact:
|
foxact:
|
||||||
specifier: ^0.2.34
|
specifier: ^0.2.35
|
||||||
version: 0.2.34(react@18.3.1)
|
version: 0.2.35(react@18.3.1)
|
||||||
i18next:
|
i18next:
|
||||||
specifier: ^23.11.5
|
specifier: ^23.11.5
|
||||||
version: 23.11.5
|
version: 23.11.5
|
||||||
@ -2842,10 +2842,10 @@ packages:
|
|||||||
}
|
}
|
||||||
engines: { node: ">=12.20.0" }
|
engines: { node: ">=12.20.0" }
|
||||||
|
|
||||||
foxact@0.2.34:
|
foxact@0.2.35:
|
||||||
resolution:
|
resolution:
|
||||||
{
|
{
|
||||||
integrity: sha512-9GrB4NPhTjaJ5pzMkfYFatLGgt5LWq3hhVhYR7zG/PaHhtt3ObOzdRVmmO/whh5E7W8JBykiS6RLtnjeLZLSeg==,
|
integrity: sha512-5e2p34TcBETZTTMhmf4WuljS07lgtv3laimqJer9OGOqYgOpYHgKfR0Cie8Q2IxH1FFhVkm1l0+2W/XL8nBL7Q==,
|
||||||
}
|
}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: "*"
|
react: "*"
|
||||||
@ -6237,7 +6237,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
fetch-blob: 3.2.0
|
fetch-blob: 3.2.0
|
||||||
|
|
||||||
foxact@0.2.34(react@18.3.1):
|
foxact@0.2.35(react@18.3.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
client-only: 0.0.1
|
client-only: 0.0.1
|
||||||
server-only: 0.0.1
|
server-only: 0.0.1
|
||||||
|
@ -5,10 +5,7 @@ import { Virtuoso } from "react-virtuoso";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { TableChartRounded, TableRowsRounded } from "@mui/icons-material";
|
import { TableChartRounded, TableRowsRounded } from "@mui/icons-material";
|
||||||
import { closeAllConnections } from "@/services/api";
|
import { closeAllConnections } from "@/services/api";
|
||||||
import {
|
import { useConnectionSetting } from "@/services/states";
|
||||||
defaultConnectionSetting,
|
|
||||||
useConnectionSetting,
|
|
||||||
} from "@/services/states";
|
|
||||||
import { useClashInfo } from "@/hooks/use-clash";
|
import { useClashInfo } from "@/hooks/use-clash";
|
||||||
import { BaseEmpty, BasePage } from "@/components/base";
|
import { BaseEmpty, BasePage } from "@/components/base";
|
||||||
import { useWebsocket } from "@/hooks/use-websocket";
|
import { useWebsocket } from "@/hooks/use-websocket";
|
||||||
@ -38,8 +35,7 @@ const ConnectionsPage = () => {
|
|||||||
|
|
||||||
const [setting, setSetting] = useConnectionSetting();
|
const [setting, setSetting] = useConnectionSetting();
|
||||||
|
|
||||||
const isTableLayout =
|
const isTableLayout = setting.layout === "table";
|
||||||
(setting || defaultConnectionSetting).layout === "table";
|
|
||||||
|
|
||||||
const orderOpts: Record<string, OrderFunc> = {
|
const orderOpts: Record<string, OrderFunc> = {
|
||||||
Default: (list) =>
|
Default: (list) =>
|
||||||
|
@ -15,7 +15,7 @@ interface IConnectionSetting {
|
|||||||
layout: "table" | "list";
|
layout: "table" | "list";
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultConnectionSetting: IConnectionSetting = { layout: "table" };
|
const defaultConnectionSetting: IConnectionSetting = { layout: "table" };
|
||||||
|
|
||||||
export const useConnectionSetting = () =>
|
export const useConnectionSetting = () =>
|
||||||
useLocalStorage<IConnectionSetting>(
|
useLocalStorage<IConnectionSetting>(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user