From 32bf42cbb90f805cb25b4dadcb0a7a1bfad1f43d Mon Sep 17 00:00:00 2001 From: coolcoala Date: Sat, 9 Aug 2025 02:37:58 +0300 Subject: [PATCH] fixed an issue with the dialog box when the profile name is long. --- src/components/profile/confirm-viewer.tsx | 5 ++-- src/components/profile/profile-item.tsx | 34 +++++++++++------------ 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/components/profile/confirm-viewer.tsx b/src/components/profile/confirm-viewer.tsx index 6f6dbd59..96426f95 100644 --- a/src/components/profile/confirm-viewer.tsx +++ b/src/components/profile/confirm-viewer.tsx @@ -1,6 +1,5 @@ import { useTranslation } from "react-i18next"; -// Новые импорты из shadcn/ui import { AlertDialog, AlertDialogAction, @@ -18,7 +17,7 @@ interface Props { open: boolean; title: string; description: string; - onOpenChange: (open: boolean) => void; // shadcn использует этот коллбэк + onOpenChange: (open: boolean) => void; onConfirm: () => void; } @@ -30,7 +29,7 @@ export const ConfirmViewer = (props: Props) => { - {title} + {title} {description} diff --git a/src/components/profile/profile-item.tsx b/src/components/profile/profile-item.tsx index 19b7f6da..932034c8 100644 --- a/src/components/profile/profile-item.tsx +++ b/src/components/profile/profile-item.tsx @@ -23,7 +23,6 @@ import { open } from "@tauri-apps/plugin-shell"; import { ProxiesEditorViewer } from "./proxies-editor-viewer"; import { cn } from "@root/lib/utils"; -// --- Компоненты shadcn/ui --- import { Card } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; import { Badge } from "@/components/ui/badge"; @@ -46,7 +45,6 @@ import { ContextMenuTrigger, } from "@/components/ui/context-menu"; -// --- Иконки --- import { GripVertical, File as FileIcon, @@ -71,10 +69,8 @@ import { } from "lucide-react"; import { t } from "i18next"; -// Активируем плагин для dayjs dayjs.extend(relativeTime); -// --- Вспомогательные функции --- const parseUrl = (url?: string): string | undefined => { if (!url) return undefined; try { @@ -302,6 +298,11 @@ export const ProfileItem = (props: Props) => { isDestructive: true, }; + const MAX_NAME_LENGTH = 25; + const truncatedName = name.length > MAX_NAME_LENGTH + ? `${name.slice(0, MAX_NAME_LENGTH)}...` + : name; + return (
@@ -459,7 +460,6 @@ export const ProfileItem = (props: Props) => { - {/* Модальные окна для редактирования */} {fileOpen && ( { setRulesOpen(false)} - profileUid={uid} // <-- Был 'uid', стал 'profileUid' + profileUid={uid} property={option?.rules ?? ""} - groupsUid={option?.groups ?? ""} // <-- Добавлен недостающий пропс - mergeUid={option?.merge ?? ""} // <-- Добавлен недостающий пропс + groupsUid={option?.groups ?? ""} + mergeUid={option?.merge ?? ""} onSave={onSave} /> )} @@ -491,7 +491,7 @@ export const ProfileItem = (props: Props) => { setProxiesOpen(false)} - profileUid={uid} // <-- Был 'uid', стал 'profileUid' + profileUid={uid} property={option?.proxies ?? ""} onSave={onSave} /> @@ -501,20 +501,20 @@ export const ProfileItem = (props: Props) => { setGroupsOpen(false)} - profileUid={uid} // <-- Был 'uid', стал 'profileUid' + profileUid={uid} property={option?.groups ?? ""} - proxiesUid={option?.proxies ?? ""} // <-- Добавлен недостающий пропс - mergeUid={option?.merge ?? ""} // <-- Добавлен недостающий пропс + proxiesUid={option?.proxies ?? ""} + mergeUid={option?.merge ?? ""} onSave={onSave} /> )}
);