From 0a3998530e72a72af1ab861b4e250fbc12c73a1b Mon Sep 17 00:00:00 2001 From: coolcoala Date: Sat, 26 Jul 2025 06:54:25 +0300 Subject: [PATCH] the alphabetical index has been removed, and additional information about proxies is now hidden by default --- src/components/proxy/proxy-groups.tsx | 91 +------------------------- src/components/proxy/use-head-state.ts | 2 +- 2 files changed, 2 insertions(+), 91 deletions(-) diff --git a/src/components/proxy/proxy-groups.tsx b/src/components/proxy/proxy-groups.tsx index e67a92fd..8b5b1952 100644 --- a/src/components/proxy/proxy-groups.tsx +++ b/src/components/proxy/proxy-groups.tsx @@ -23,14 +23,8 @@ import { ProxyRender } from "./proxy-render"; import delayManager from "@/services/delay"; import { useTranslation } from "react-i18next"; import { ScrollTopButton } from "../layout/scroll-top-button"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip"; -// Вспомогательная функция для плавного скролла (взята из вашего оригинального файла) + function throttle any>( func: T, wait: number, @@ -59,36 +53,6 @@ function throttle any>( }; } -// Компонент для одной буквы в навигаторе, переписанный на Tailwind и shadcn/ui -const LetterItem = memo( - ({ - name, - onClick, - getFirstChar, - }: { - name: string; - onClick: (name: string) => void; - getFirstChar: (str: string) => string; - }) => { - return ( - - - -
onClick(name)} - > - {getFirstChar(name)} -
-
- -

{name}

-
-
-
- ); - }, -); interface Props { mode: string; @@ -108,33 +72,6 @@ export const ProxyGroups = memo((props: Props) => { const scrollerRef = useRef(null); const [showScrollTop, setShowScrollTop] = useState(false); - // Мемоизация вычисления букв и индексов для навигатора - const { groupFirstLetters, letterIndexMap } = useMemo(() => { - const letters = new Set(); - const indexMap: Record = {}; - renderList.forEach((item, index) => { - if (item.type === 0) { - // type 0 - это заголовок группы - const fullName = item.group.name; - letters.add(fullName); - if (!(fullName in indexMap)) { - indexMap[fullName] = index; - } - } - }); - return { - groupFirstLetters: Array.from(letters), - letterIndexMap: indexMap, - }; - }, [renderList]); - - // Мемоизация функции для получения первой буквы (поддерживает эмодзи) - const getFirstChar = useCallback((str: string) => { - const match = str.match( - /\p{Regional_Indicator}{2}|\p{Extended_Pictographic}|\p{L}|\p{N}|./u, - ); - return match ? match[0] : str.charAt(0); - }, []); // Обработчик скролла для показа/скрытия кнопки "Наверх" const handleScroll = useCallback( @@ -161,20 +98,6 @@ export const ProxyGroups = memo((props: Props) => { virtuosoRef.current?.scrollTo({ top: 0, behavior: "smooth" }); }, []); - const handleLetterClick = useCallback( - (name: string) => { - const index = letterIndexMap[name]; - if (index !== undefined) { - virtuosoRef.current?.scrollToIndex({ - index, - align: "start", - behavior: "smooth", - }); - } - }, - [letterIndexMap], - ); - // Вся бизнес-логика из оригинального файла const handleChangeProxy = useLockFn( async (group: IProxyGroupItem, proxy: IProxyItem) => { @@ -288,18 +211,6 @@ export const ProxyGroups = memo((props: Props) => { )} /> - - {/* Алфавитный указатель */} -
- {groupFirstLetters.map((name) => ( - - ))} -
); }); diff --git a/src/components/proxy/use-head-state.ts b/src/components/proxy/use-head-state.ts index d6c31135..df46bb0f 100644 --- a/src/components/proxy/use-head-state.ts +++ b/src/components/proxy/use-head-state.ts @@ -16,7 +16,7 @@ type HeadStateStorage = Record>; const HEAD_STATE_KEY = "proxy-head-state"; export const DEFAULT_STATE: HeadState = { open: false, - showType: true, + showType: false, sortType: 0, filterText: "", textState: null,