This commit is contained in:
hailin 2025-04-19 17:24:28 +08:00
parent 2a4be6ea33
commit 9faf912c8b
5 changed files with 26 additions and 12 deletions

View File

@ -22,6 +22,8 @@ import { Tables } from "@/supabase/types"
import { ContentType, DataItemType } from "@/types"
import { FC, useContext, useRef, useState } from "react"
import { useTranslation } from 'react-i18next'
interface SidebarDeleteItemProps {
item: DataItemType
contentType: ContentType
@ -31,6 +33,9 @@ export const SidebarDeleteItem: FC<SidebarDeleteItemProps> = ({
item,
contentType
}) => {
const { t } = useTranslation()
const {
setChats,
setPresets,
@ -114,26 +119,26 @@ export const SidebarDeleteItem: FC<SidebarDeleteItemProps> = ({
<Dialog open={showDialog} onOpenChange={setShowDialog}>
<DialogTrigger asChild>
<Button className="text-red-500" variant="ghost">
Delete
{t("side.delete")}
</Button>
</DialogTrigger>
<DialogContent onKeyDown={handleKeyDown}>
<DialogHeader>
<DialogTitle>Delete {contentType.slice(0, -1)}</DialogTitle>
<DialogTitle>{t("side.delete")} {contentType.slice(0, -1)}</DialogTitle>
<DialogDescription>
Are you sure you want to delete {item.name}?
{t("side.confirmDelete")} {item.name}?
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button variant="ghost" onClick={() => setShowDialog(false)}>
Cancel
{t("side.cancel")}
</Button>
<Button ref={buttonRef} variant="destructive" onClick={handleDelete}>
Delete
{t("side.delete")}
</Button>
</DialogFooter>
</DialogContent>

View File

@ -641,14 +641,14 @@ export const SidebarUpdateItem: FC<SidebarUpdateItemProps> = ({
<div className="grow overflow-auto">
<SheetHeader>
<SheetTitle className="text-2xl font-bold">
Edit {contentType.slice(0, -1)}
{t("side.edit")} {contentType.slice(0, -1)}
</SheetTitle>
</SheetHeader>
<div className="mt-4 space-y-3">
{workspaces.length > 1 && (
<div className="space-y-1">
<Label>Assigned Workspaces</Label>
<Label>{t("side.assignedWorkspaces")}</Label>
<AssignWorkspaces
selectedWorkspaces={selectedWorkspaces}
@ -666,11 +666,11 @@ export const SidebarUpdateItem: FC<SidebarUpdateItemProps> = ({
<div className="flex grow justify-end space-x-2">
<Button variant="outline" onClick={() => setIsOpen(false)}>
Cancel
{t("side.cancel")}
</Button>
<Button ref={buttonRef} onClick={handleUpdate}>
Save
{t("side.save")}
</Button>
</div>
</SheetFooter>

View File

@ -163,7 +163,10 @@
"filesAndCollections": "Files & Collections",
"tools": "Tools",
"modelIncompatibleWithTools": "Model is not compatible with tools.",
"editChat": "Edit Chat"
"editChat": "Edit Chat",
"confirmDelete": "Are you sure you want to delete?",
"edit": "Edit",
"assignedWorkspaces": "Assigned Workspaces"
},
"contentType": {

View File

@ -162,7 +162,10 @@
"filesAndCollections": "ファイルとコレクション",
"tools": "ツール",
"modelIncompatibleWithTools": "このモデルはツールと互換性がありません。",
"editChat": "チャットを編集"
"editChat": "チャットを編集",
"confirmDelete": "本当に削除しますか?",
"edit": "編集",
"assignedWorkspaces": "割り当てられたワークスペース"
},
"contentType": {

View File

@ -162,7 +162,10 @@
"filesAndCollections": "文件与集合",
"tools": "工具",
"modelIncompatibleWithTools": "该模型不支持工具功能。",
"editChat": "编辑对话"
"editChat": "编辑对话",
"confirmDelete": "你确定要删除吗?",
"edit": "编辑",
"assignedWorkspaces": "已分配的工作区"
},
"contentType": {