fixed an issue with the dialog box when the profile name is long.
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
// Новые импорты из shadcn/ui
|
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogAction,
|
AlertDialogAction,
|
||||||
@@ -18,7 +17,7 @@ interface Props {
|
|||||||
open: boolean;
|
open: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
onOpenChange: (open: boolean) => void; // shadcn использует этот коллбэк
|
onOpenChange: (open: boolean) => void;
|
||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ export const ConfirmViewer = (props: Props) => {
|
|||||||
<AlertDialog open={open} onOpenChange={onOpenChange}>
|
<AlertDialog open={open} onOpenChange={onOpenChange}>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>{title}</AlertDialogTitle>
|
<AlertDialogTitle className="truncate">{title}</AlertDialogTitle>
|
||||||
<AlertDialogDescription>{description}</AlertDialogDescription>
|
<AlertDialogDescription>{description}</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import { open } from "@tauri-apps/plugin-shell";
|
|||||||
import { ProxiesEditorViewer } from "./proxies-editor-viewer";
|
import { ProxiesEditorViewer } from "./proxies-editor-viewer";
|
||||||
import { cn } from "@root/lib/utils";
|
import { cn } from "@root/lib/utils";
|
||||||
|
|
||||||
// --- Компоненты shadcn/ui ---
|
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { Progress } from "@/components/ui/progress";
|
import { Progress } from "@/components/ui/progress";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@@ -46,7 +45,6 @@ import {
|
|||||||
ContextMenuTrigger,
|
ContextMenuTrigger,
|
||||||
} from "@/components/ui/context-menu";
|
} from "@/components/ui/context-menu";
|
||||||
|
|
||||||
// --- Иконки ---
|
|
||||||
import {
|
import {
|
||||||
GripVertical,
|
GripVertical,
|
||||||
File as FileIcon,
|
File as FileIcon,
|
||||||
@@ -71,10 +69,8 @@ import {
|
|||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
|
|
||||||
// Активируем плагин для dayjs
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
// --- Вспомогательные функции ---
|
|
||||||
const parseUrl = (url?: string): string | undefined => {
|
const parseUrl = (url?: string): string | undefined => {
|
||||||
if (!url) return undefined;
|
if (!url) return undefined;
|
||||||
try {
|
try {
|
||||||
@@ -302,6 +298,11 @@ export const ProfileItem = (props: Props) => {
|
|||||||
isDestructive: true,
|
isDestructive: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const MAX_NAME_LENGTH = 25;
|
||||||
|
const truncatedName = name.length > MAX_NAME_LENGTH
|
||||||
|
? `${name.slice(0, MAX_NAME_LENGTH)}...`
|
||||||
|
: name;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={setNodeRef} style={style} {...attributes}>
|
<div ref={setNodeRef} style={style} {...attributes}>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
@@ -459,7 +460,6 @@ export const ProfileItem = (props: Props) => {
|
|||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
|
|
||||||
{/* Модальные окна для редактирования */}
|
|
||||||
{fileOpen && (
|
{fileOpen && (
|
||||||
<EditorViewer
|
<EditorViewer
|
||||||
open={true}
|
open={true}
|
||||||
@@ -479,10 +479,10 @@ export const ProfileItem = (props: Props) => {
|
|||||||
<RulesEditorViewer
|
<RulesEditorViewer
|
||||||
open={true}
|
open={true}
|
||||||
onClose={() => setRulesOpen(false)}
|
onClose={() => setRulesOpen(false)}
|
||||||
profileUid={uid} // <-- Был 'uid', стал 'profileUid'
|
profileUid={uid}
|
||||||
property={option?.rules ?? ""}
|
property={option?.rules ?? ""}
|
||||||
groupsUid={option?.groups ?? ""} // <-- Добавлен недостающий пропс
|
groupsUid={option?.groups ?? ""}
|
||||||
mergeUid={option?.merge ?? ""} // <-- Добавлен недостающий пропс
|
mergeUid={option?.merge ?? ""}
|
||||||
onSave={onSave}
|
onSave={onSave}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -491,7 +491,7 @@ export const ProfileItem = (props: Props) => {
|
|||||||
<ProxiesEditorViewer
|
<ProxiesEditorViewer
|
||||||
open={true}
|
open={true}
|
||||||
onClose={() => setProxiesOpen(false)}
|
onClose={() => setProxiesOpen(false)}
|
||||||
profileUid={uid} // <-- Был 'uid', стал 'profileUid'
|
profileUid={uid}
|
||||||
property={option?.proxies ?? ""}
|
property={option?.proxies ?? ""}
|
||||||
onSave={onSave}
|
onSave={onSave}
|
||||||
/>
|
/>
|
||||||
@@ -501,20 +501,20 @@ export const ProfileItem = (props: Props) => {
|
|||||||
<GroupsEditorViewer
|
<GroupsEditorViewer
|
||||||
open={true}
|
open={true}
|
||||||
onClose={() => setGroupsOpen(false)}
|
onClose={() => setGroupsOpen(false)}
|
||||||
profileUid={uid} // <-- Был 'uid', стал 'profileUid'
|
profileUid={uid}
|
||||||
property={option?.groups ?? ""}
|
property={option?.groups ?? ""}
|
||||||
proxiesUid={option?.proxies ?? ""} // <-- Добавлен недостающий пропс
|
proxiesUid={option?.proxies ?? ""}
|
||||||
mergeUid={option?.merge ?? ""} // <-- Добавлен недостающий пропс
|
mergeUid={option?.merge ?? ""}
|
||||||
onSave={onSave}
|
onSave={onSave}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<ConfirmViewer
|
<ConfirmViewer
|
||||||
open={confirmOpen}
|
open={confirmOpen}
|
||||||
onOpenChange={setConfirmOpen}
|
onOpenChange={setConfirmOpen}
|
||||||
onConfirm={onDelete}
|
onConfirm={onDelete}
|
||||||
title={t("Delete Profile", { name })}
|
title={t("Delete Profile", { name: truncatedName })}
|
||||||
description={t("This action cannot be undone.")}
|
description={t("This action cannot be undone.")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user