mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
feat: show connections with table layout
This commit is contained in:
@@ -21,14 +21,45 @@ export const atomEnableLog = atom<boolean>({
|
||||
({ setSelf, onSet }) => {
|
||||
const key = "enable-log";
|
||||
|
||||
setSelf(localStorage.getItem(key) !== "false");
|
||||
try {
|
||||
setSelf(localStorage.getItem(key) !== "false");
|
||||
} catch {}
|
||||
|
||||
onSet((newValue, _, isReset) => {
|
||||
if (isReset) {
|
||||
localStorage.removeItem(key);
|
||||
} else {
|
||||
localStorage.setItem(key, newValue.toString());
|
||||
}
|
||||
try {
|
||||
if (isReset) {
|
||||
localStorage.removeItem(key);
|
||||
} else {
|
||||
localStorage.setItem(key, newValue.toString());
|
||||
}
|
||||
} catch {}
|
||||
});
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
interface IConnectionSetting {
|
||||
layout: "table" | "list";
|
||||
}
|
||||
|
||||
export const atomConnectionSetting = atom<IConnectionSetting>({
|
||||
key: "atomConnectionSetting",
|
||||
effects: [
|
||||
({ setSelf, onSet }) => {
|
||||
const key = "connections-setting";
|
||||
|
||||
try {
|
||||
const value = localStorage.getItem(key);
|
||||
const data = value == null ? { layout: "list" } : JSON.parse(value);
|
||||
setSelf(data);
|
||||
} catch {
|
||||
setSelf({ layout: "list" });
|
||||
}
|
||||
|
||||
onSet((newValue) => {
|
||||
try {
|
||||
localStorage.setItem(key, JSON.stringify(newValue));
|
||||
} catch {}
|
||||
});
|
||||
},
|
||||
],
|
||||
|
||||
1
src/services/types.d.ts
vendored
1
src/services/types.d.ts
vendored
@@ -68,6 +68,7 @@ declare namespace ApiType {
|
||||
destinationPort: string;
|
||||
destinationIP?: string;
|
||||
process?: string;
|
||||
processPath?: string;
|
||||
};
|
||||
upload: number;
|
||||
download: number;
|
||||
|
||||
Reference in New Issue
Block a user