diff --git a/apps/client/public/locales/de-DE/translation.json b/apps/client/public/locales/de-DE/translation.json index 7766e42b..b6caf4d6 100644 --- a/apps/client/public/locales/de-DE/translation.json +++ b/apps/client/public/locales/de-DE/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Kommentar bearbeiten", "Delete comment": "Kommentar löschen", "Are you sure you want to delete this comment?": "Sind Sie sicher, dass Sie diesen Kommentar löschen möchten?", + "Delete chat": "Chat löschen", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Sind Sie sicher, dass Sie '{{title}}' löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.", "Comment created successfully": "Kommentar erfolgreich erstellt", "Error creating comment": "Fehler beim Erstellen des Kommentars", "Comment updated successfully": "Kommentar erfolgreich aktualisiert", diff --git a/apps/client/public/locales/en-US/translation.json b/apps/client/public/locales/en-US/translation.json index 5ceeffce..3bfe7c9f 100644 --- a/apps/client/public/locales/en-US/translation.json +++ b/apps/client/public/locales/en-US/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Edit comment", "Delete comment": "Delete comment", "Are you sure you want to delete this comment?": "Are you sure you want to delete this comment?", + "Delete chat": "Delete chat", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Are you sure you want to delete '{{title}}'? This action cannot be undone.", "Comment created successfully": "Comment created successfully", "Error creating comment": "Error creating comment", "Comment updated successfully": "Comment updated successfully", diff --git a/apps/client/public/locales/es-ES/translation.json b/apps/client/public/locales/es-ES/translation.json index d563ab37..e9ceacf9 100644 --- a/apps/client/public/locales/es-ES/translation.json +++ b/apps/client/public/locales/es-ES/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Editar comentario", "Delete comment": "Eliminar comentario", "Are you sure you want to delete this comment?": "¿Está seguro de que desea eliminar este comentario?", + "Delete chat": "Eliminar chat", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "¿Está seguro de que desea eliminar '{{title}}'? Esta acción no se puede deshacer.", "Comment created successfully": "Comentario creado con éxito", "Error creating comment": "Error al crear comentario", "Comment updated successfully": "Comentario actualizado con éxito", diff --git a/apps/client/public/locales/fr-FR/translation.json b/apps/client/public/locales/fr-FR/translation.json index d48f845c..90172476 100644 --- a/apps/client/public/locales/fr-FR/translation.json +++ b/apps/client/public/locales/fr-FR/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Modifier le commentaire", "Delete comment": "Supprimer le commentaire", "Are you sure you want to delete this comment?": "Êtes-vous sûr de vouloir supprimer ce commentaire ?", + "Delete chat": "Supprimer la conversation", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Êtes-vous sûr de vouloir supprimer '{{title}}' ? Cette action est irréversible.", "Comment created successfully": "Commentaire créé avec succès", "Error creating comment": "Erreur lors de la création du commentaire", "Comment updated successfully": "Commentaire mis à jour avec succès", diff --git a/apps/client/public/locales/it-IT/translation.json b/apps/client/public/locales/it-IT/translation.json index a5375c7d..9ceec008 100644 --- a/apps/client/public/locales/it-IT/translation.json +++ b/apps/client/public/locales/it-IT/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Modifica commento", "Delete comment": "Elimina commento", "Are you sure you want to delete this comment?": "Sei sicuro di voler eliminare questo commento?", + "Delete chat": "Elimina chat", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Sei sicuro di voler eliminare '{{title}}'? Questa azione non può essere annullata.", "Comment created successfully": "Commento creato con successo", "Error creating comment": "Si è verificato un errore durante la creazione del commento", "Comment updated successfully": "Commento aggiornato con successo", diff --git a/apps/client/public/locales/ja-JP/translation.json b/apps/client/public/locales/ja-JP/translation.json index e55f58a9..14285e23 100644 --- a/apps/client/public/locales/ja-JP/translation.json +++ b/apps/client/public/locales/ja-JP/translation.json @@ -222,6 +222,8 @@ "Edit comment": "コメントを編集する", "Delete comment": "コメントを削除する", "Are you sure you want to delete this comment?": "このコメントを削除してもよろしいですか?", + "Delete chat": "チャットを削除", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "「{{title}}」を削除してもよろしいですか?この操作は元に戻せません。", "Comment created successfully": "コメントを作成しました", "Error creating comment": "コメントの作成に失敗しました", "Comment updated successfully": "コメントを更新しました", diff --git a/apps/client/public/locales/ko-KR/translation.json b/apps/client/public/locales/ko-KR/translation.json index 2b7ea329..e02f1633 100644 --- a/apps/client/public/locales/ko-KR/translation.json +++ b/apps/client/public/locales/ko-KR/translation.json @@ -222,6 +222,8 @@ "Edit comment": "댓글 수정", "Delete comment": "댓글 삭제", "Are you sure you want to delete this comment?": "이 댓글을 삭제하시겠습니까?", + "Delete chat": "채팅 삭제", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "'{{title}}'을(를) 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.", "Comment created successfully": "댓글 생성 완료", "Error creating comment": "댓글 생성 오류", "Comment updated successfully": "댓글 업데이트 완료", diff --git a/apps/client/public/locales/nl-NL/translation.json b/apps/client/public/locales/nl-NL/translation.json index f8a2d4f4..0ef2a3ba 100644 --- a/apps/client/public/locales/nl-NL/translation.json +++ b/apps/client/public/locales/nl-NL/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Bewerk reactie", "Delete comment": "Verwijder reactie", "Are you sure you want to delete this comment?": "Weet je zeker dat je deze reactie wilt verwijderen?", + "Delete chat": "Chat verwijderen", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Weet je zeker dat je '{{title}}' wilt verwijderen? Deze actie kan niet ongedaan worden gemaakt.", "Comment created successfully": "Reactie succesvol aangemaakt", "Error creating comment": "Fout bij het aanmaken van reactie", "Comment updated successfully": "Opmerking succesvol bijgewerkt", diff --git a/apps/client/public/locales/pt-BR/translation.json b/apps/client/public/locales/pt-BR/translation.json index 72504ea5..f71b2e59 100644 --- a/apps/client/public/locales/pt-BR/translation.json +++ b/apps/client/public/locales/pt-BR/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Editar comentário", "Delete comment": "Excluir comentário", "Are you sure you want to delete this comment?": "Você tem certeza de que deseja excluir este comentário?", + "Delete chat": "Excluir chat", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Tem certeza de que deseja excluir '{{title}}'? Esta ação não pode ser desfeita.", "Comment created successfully": "Comentário criado com sucesso", "Error creating comment": "Erro ao criar comentário", "Comment updated successfully": "Comentário atualizado com sucesso", diff --git a/apps/client/public/locales/ru-RU/translation.json b/apps/client/public/locales/ru-RU/translation.json index a261b092..e5ac8fe8 100644 --- a/apps/client/public/locales/ru-RU/translation.json +++ b/apps/client/public/locales/ru-RU/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Редактировать комментарий", "Delete comment": "Удалить комментарий", "Are you sure you want to delete this comment?": "Вы уверены, что хотите удалить этот комментарий?", + "Delete chat": "Удалить чат", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Вы уверены, что хотите удалить '{{title}}'? Это действие нельзя отменить.", "Comment created successfully": "Комментарий успешно создан", "Error creating comment": "Ошибка при создании комментария", "Comment updated successfully": "Комментарий успешно обновлён", diff --git a/apps/client/public/locales/uk-UA/translation.json b/apps/client/public/locales/uk-UA/translation.json index 6fbe44af..aff25b4a 100644 --- a/apps/client/public/locales/uk-UA/translation.json +++ b/apps/client/public/locales/uk-UA/translation.json @@ -222,6 +222,8 @@ "Edit comment": "Редагувати коментар", "Delete comment": "Видалити коментар", "Are you sure you want to delete this comment?": "Ви впевнені, що хочете видалити цей коментар?", + "Delete chat": "Видалити чат", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "Ви впевнені, що хочете видалити '{{title}}'? Цю дію неможливо скасувати.", "Comment created successfully": "Коментар успішно створено", "Error creating comment": "Помилка при створенні коментаря", "Comment updated successfully": "Коментар успішно оновлено", diff --git a/apps/client/public/locales/zh-CN/translation.json b/apps/client/public/locales/zh-CN/translation.json index 341e0bab..d8fd340d 100644 --- a/apps/client/public/locales/zh-CN/translation.json +++ b/apps/client/public/locales/zh-CN/translation.json @@ -222,6 +222,8 @@ "Edit comment": "编辑评论", "Delete comment": "删除评论", "Are you sure you want to delete this comment?": "你确定要删除这条评论吗?", + "Delete chat": "删除聊天", + "Are you sure you want to delete '{{title}}'? This action cannot be undone.": "您确定要删除「{{title}}」吗?此操作无法撤销。", "Comment created successfully": "成功创建评论", "Error creating comment": "创建评论时出错", "Comment updated successfully": "评论更新成功", diff --git a/apps/client/src/ee/ai-chat/components/ai-chat-sidebar-item.tsx b/apps/client/src/ee/ai-chat/components/ai-chat-sidebar-item.tsx index f59b740e..abaf4277 100644 --- a/apps/client/src/ee/ai-chat/components/ai-chat-sidebar-item.tsx +++ b/apps/client/src/ee/ai-chat/components/ai-chat-sidebar-item.tsx @@ -9,7 +9,7 @@ import classes from "../styles/chat-sidebar.module.css"; type Props = { chat: AiChat; isActive: boolean; - onDelete: (chatId: string) => void; + onDelete: (chatId: string, title: string | null) => void; onRename: (chatId: string, title: string) => void; }; @@ -153,7 +153,7 @@ export default function AiChatSidebarItem({ onClick={(e) => { e.preventDefault(); e.stopPropagation(); - onDelete(chat.id); + onDelete(chat.id, chat.title); }} > {t("Delete")} diff --git a/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx b/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx index 5d790329..8ce06e02 100644 --- a/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx +++ b/apps/client/src/ee/ai-chat/components/ai-chat-sidebar.tsx @@ -1,6 +1,14 @@ import { useState, useCallback, useEffect, useMemo, useRef } from "react"; import { Link, useNavigate, useParams } from "react-router-dom"; -import { ActionIcon, Center, TextInput, Loader, Tooltip } from "@mantine/core"; +import { + ActionIcon, + Center, + Text, + TextInput, + Loader, + Tooltip, +} from "@mantine/core"; +import { modals } from "@mantine/modals"; import { useDebouncedValue } from "@mantine/hooks"; import { IconPlus, IconSearch, IconMessageCircle2 } from "@tabler/icons-react"; import { useTranslation } from "react-i18next"; @@ -73,16 +81,31 @@ export default function AiChatSidebar() { ); const handleDelete = useCallback( - (id: string) => { - deleteMutation.mutate(id, { - onSuccess: () => { - if (chatId === id) { - navigate("/ai"); - } + (id: string, title: string | null) => { + modals.openConfirmModal({ + title: t("Delete chat"), + centered: true, + children: ( + + {t("Are you sure you want to delete '{{title}}'? This action cannot be undone.", { + title: title || t("Untitled"), + })} + + ), + labels: { confirm: t("Delete"), cancel: t("Cancel") }, + confirmProps: { color: "red" }, + onConfirm: () => { + deleteMutation.mutate(id, { + onSuccess: () => { + if (chatId === id) { + navigate("/ai"); + } + }, + }); }, }); }, - [deleteMutation, chatId, navigate], + [deleteMutation, chatId, navigate, t], ); const handleRename = useCallback(