diff --git a/src/components/proxy/proxy-groups.tsx b/src/components/proxy/proxy-groups.tsx index 94b8992132f1c5427c2f1550bae9e52bab662ca1..47dbf7dcbb95dd5da95498e6a4ac863020198a20 100644 --- a/src/components/proxy/proxy-groups.tsx +++ b/src/components/proxy/proxy-groups.tsx @@ -174,7 +174,7 @@ function ProxyRenderItem(props: RenderProps) { if (type === 1) { return ( <ProxyHead - sx={{ pl: indent ? 4.5 : 2.5, pr: 3, my: 1, button: { mr: 0.5 } }} + sx={{ pl: indent ? 4.5 : 2.5, pr: 3, mt: indent ? 1 : 0.5, mb: 1 }} groupName={group.name} headState={headState!} onLocation={() => onLocation(group)} diff --git a/src/components/proxy/proxy-head.tsx b/src/components/proxy/proxy-head.tsx index 0515f9999d2fe00b229cadcf4a01c23fd5f84d6f..fe29cb83bffa4b93903398c4869d56e4f92b8642 100644 --- a/src/components/proxy/proxy-head.tsx +++ b/src/components/proxy/proxy-head.tsx @@ -49,7 +49,7 @@ export const ProxyHead = (props: Props) => { }, [groupName, testUrl, verge?.default_latency_test]); return ( - <Box sx={{ display: "flex", alignItems: "center", ...sx }}> + <Box sx={{ display: "flex", alignItems: "center", gap: 0.5, ...sx }}> <IconButton size="small" color="inherit" @@ -86,7 +86,7 @@ export const ProxyHead = (props: Props) => { onHeadState({ sortType: ((sortType + 1) % 3) as ProxySortType }) } > - {sortType === 0 && <SortRounded />} + {sortType !== 1 && sortType !== 2 && <SortRounded />} {sortType === 1 && <AccessTimeRounded />} {sortType === 2 && <SortByAlphaRounded />} </IconButton> diff --git a/src/components/proxy/use-render-list.ts b/src/components/proxy/use-render-list.ts index 5fdf52e6566e6f54605154beff8257eb9deddee1..8518a7a8c8d005306244c4e597b0ae1cc405ed3a 100644 --- a/src/components/proxy/use-render-list.ts +++ b/src/components/proxy/use-render-list.ts @@ -2,7 +2,11 @@ import useSWR from "swr"; import { getProxies } from "@/services/api"; import { useEffect, useMemo } from "react"; import { filterSort } from "./use-filter-sort"; -import { useHeadStateNew, type HeadState } from "./use-head-state"; +import { + useHeadStateNew, + DEFAULT_STATE, + type HeadState, +} from "./use-head-state"; export interface IRenderItem { type: 0 | 1 | 2 | 3; // 组 | head | item | empty @@ -36,17 +40,19 @@ export const useRenderList = (mode: string) => { const renderList: IRenderItem[] = useMemo(() => { if (!proxiesData) return []; + + // global å’Œ direct ä½¿ç”¨å±•å¼€çš„æ ·å¼ const useRule = mode === "rule" || mode === "script"; const renderGroups = (useRule ? proxiesData?.groups : [proxiesData?.global!]) || []; const retList = renderGroups.flatMap((group) => { - const headState = headStates[group.name]; + const headState = headStates[group.name] || DEFAULT_STATE; const ret: IRenderItem[] = [ { type: 0, key: group.name, group, headState }, ]; - if (headState?.open) { + if (headState?.open || !useRule) { const proxies = filterSort( group.all, group.name,