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

View File

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

View File

@ -163,7 +163,10 @@
"filesAndCollections": "Files & Collections", "filesAndCollections": "Files & Collections",
"tools": "Tools", "tools": "Tools",
"modelIncompatibleWithTools": "Model is not compatible with 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": { "contentType": {

View File

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

View File

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