mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 03:32:36 +08:00
refactor: simplify useConnectionSetting
(#1141)
Some checks are pending
Alpha Build / alpha (macos-latest, aarch64-apple-darwin) (push) Waiting to run
Alpha Build / alpha (macos-latest, x86_64-apple-darwin) (push) Waiting to run
Alpha Build / alpha (windows-latest, aarch64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha (windows-latest, i686-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha (windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, aarch64-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, armv7-unknown-linux-gnueabihf) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, i686-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (arm64, windows-latest, aarch64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (x64, windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (x86, windows-latest, i686-pc-windows-msvc) (push) Waiting to run
Alpha Build / Update tag (push) Blocked by required conditions
Some checks are pending
Alpha Build / alpha (macos-latest, aarch64-apple-darwin) (push) Waiting to run
Alpha Build / alpha (macos-latest, x86_64-apple-darwin) (push) Waiting to run
Alpha Build / alpha (windows-latest, aarch64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha (windows-latest, i686-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha (windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, aarch64-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, armv7-unknown-linux-gnueabihf) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, i686-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (arm64, windows-latest, aarch64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (x64, windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (x86, windows-latest, i686-pc-windows-msvc) (push) Waiting to run
Alpha Build / Update tag (push) Blocked by required conditions
This commit is contained in:
parent
5768b01786
commit
7a1f4f9abe
|
@ -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",
|
||||||
|
|
|
@ -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…
Reference in New Issue
Block a user