mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
chore: make eslint happy (part 1) (#4890)
This commit is contained in:
@@ -24,6 +24,8 @@ export const RuleItem = (props: Props) => {
|
||||
const proxyPolicy = rule.match(/[^,]+$/)?.[0] ?? "";
|
||||
const ruleContent = rule.slice(ruleType.length + 1, -proxyPolicy.length - 1);
|
||||
|
||||
const $sortable = useSortable({ id: ruleRaw });
|
||||
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
@@ -32,7 +34,7 @@ export const RuleItem = (props: Props) => {
|
||||
transition,
|
||||
isDragging,
|
||||
} = sortable
|
||||
? useSortable({ id: ruleRaw })
|
||||
? $sortable
|
||||
: {
|
||||
attributes: {},
|
||||
listeners: {},
|
||||
|
||||
@@ -31,9 +31,15 @@ interface Props {
|
||||
onHeadState: (val: Partial<HeadState>) => void;
|
||||
}
|
||||
|
||||
export const ProxyHead = (props: Props) => {
|
||||
const { sx = {}, url, groupName, headState, onHeadState } = props;
|
||||
|
||||
export const ProxyHead = ({
|
||||
sx = {},
|
||||
url,
|
||||
groupName,
|
||||
headState,
|
||||
onHeadState,
|
||||
onLocation,
|
||||
onCheckDelay,
|
||||
}: Props) => {
|
||||
const { showType, sortType, filterText, textState, testUrl } = headState;
|
||||
|
||||
const { t } = useTranslation();
|
||||
@@ -46,13 +52,11 @@ export const ProxyHead = (props: Props) => {
|
||||
}, []);
|
||||
|
||||
const { verge } = useVerge();
|
||||
const default_latency_test = verge!.default_latency_test!;
|
||||
|
||||
useEffect(() => {
|
||||
delayManager.setUrl(
|
||||
groupName,
|
||||
testUrl || url || verge?.default_latency_test!,
|
||||
);
|
||||
}, [groupName, testUrl, verge?.default_latency_test]);
|
||||
delayManager.setUrl(groupName, testUrl || url || default_latency_test);
|
||||
}, [groupName, testUrl, default_latency_test, url]);
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5, ...sx }}>
|
||||
@@ -60,7 +64,7 @@ export const ProxyHead = (props: Props) => {
|
||||
size="small"
|
||||
color="inherit"
|
||||
title={t("locate")}
|
||||
onClick={props.onLocation}
|
||||
onClick={onLocation}
|
||||
>
|
||||
<MyLocationRounded />
|
||||
</IconButton>
|
||||
@@ -76,7 +80,7 @@ export const ProxyHead = (props: Props) => {
|
||||
console.log(`[ProxyHead] 使用自定义测试URL: ${testUrl}`);
|
||||
onHeadState({ textState: "url" });
|
||||
}
|
||||
props.onCheckDelay();
|
||||
onCheckDelay();
|
||||
}}
|
||||
>
|
||||
<NetworkCheckRounded />
|
||||
|
||||
@@ -61,12 +61,12 @@ export const ProxyItem = (props: Props) => {
|
||||
return () => {
|
||||
delayManager.removeListener(proxy.name, group.name);
|
||||
};
|
||||
}, [proxy.name, group.name]);
|
||||
}, [proxy.name, group.name, isPreset]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!proxy) return;
|
||||
setDelay(delayManager.getDelayFix(proxy, group.name));
|
||||
}, [proxy]);
|
||||
}, [group.name, proxy]);
|
||||
|
||||
const onDelay = useLockFn(async () => {
|
||||
setDelay(-2);
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function useFilterSort(
|
||||
filterText: string,
|
||||
sortType: ProxySortType,
|
||||
) {
|
||||
const [refresh, setRefresh] = useState({});
|
||||
const [, setRefresh] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
let last = 0;
|
||||
@@ -34,7 +34,7 @@ export default function useFilterSort(
|
||||
const fp = filterProxies(proxies, groupName, filterText);
|
||||
const sp = sortProxies(fp, groupName, sortType);
|
||||
return sp;
|
||||
}, [proxies, groupName, filterText, sortType, refresh]);
|
||||
}, [proxies, groupName, filterText, sortType]);
|
||||
}
|
||||
|
||||
export function filterSort(
|
||||
|
||||
@@ -90,13 +90,11 @@ export const HotkeyInput = (props: Props) => {
|
||||
|
||||
<div className="list">
|
||||
{keys.map((key, index) => (
|
||||
<Box display="flex">
|
||||
<Box display="flex" key={key}>
|
||||
<span className="delimiter" hidden={index === 0}>
|
||||
+
|
||||
</span>
|
||||
<div key={key} className="item">
|
||||
{key}
|
||||
</div>
|
||||
<div className="item">{key}</div>
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -59,13 +59,13 @@ const SettingVergeAdvanced = ({ onError: _ }: Props) => {
|
||||
const onExportDiagnosticInfo = useCallback(async () => {
|
||||
await exportDiagnosticInfo();
|
||||
showNotice("success", t("Copy Success"), 1000);
|
||||
}, []);
|
||||
}, [t]);
|
||||
|
||||
const copyVersion = useCallback(() => {
|
||||
navigator.clipboard.writeText(`v${version}`).then(() => {
|
||||
showNotice("success", t("Version copied to clipboard"), 1000);
|
||||
});
|
||||
}, [version, t]);
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<SettingList title={t("Verge Advanced Setting")}>
|
||||
|
||||
@@ -77,7 +77,7 @@ const SettingVergeBasic = ({ onError }: Props) => {
|
||||
const onCopyClashEnv = useCallback(async () => {
|
||||
await copyClashEnv();
|
||||
showNotice("success", t("Copy Success"), 1000);
|
||||
}, []);
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<SettingList title={t("Verge Basic Setting")}>
|
||||
|
||||
@@ -87,7 +87,7 @@ export async function getRuntimeLogs() {
|
||||
return invoke<Record<string, [string, string][]>>("get_runtime_logs");
|
||||
}
|
||||
|
||||
export async function getRuntimeProxyChainConfig(proxyChainExitNode: String) {
|
||||
export async function getRuntimeProxyChainConfig(proxyChainExitNode: string) {
|
||||
return invoke<string>("get_runtime_proxy_chain_config", {
|
||||
proxyChainExitNode,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user