This commit is contained in:
hailin 2025-04-19 15:02:54 +08:00
parent 80d3ee9260
commit 875d0df052
5 changed files with 28 additions and 8 deletions

View File

@ -16,11 +16,16 @@ import { Tables } from "@/supabase/types"
import { IconTrash } from "@tabler/icons-react"
import { FC, useContext, useRef, useState } from "react"
import { useTranslation } from 'react-i18next'
interface DeleteChatProps {
chat: Tables<"chats">
}
export const DeleteChat: FC<DeleteChatProps> = ({ chat }) => {
const { t } = useTranslation()
useHotkey("Backspace", () => setShowChatDialog(true))
const { setChats } = useContext(ChatbotUIContext)
@ -54,16 +59,16 @@ export const DeleteChat: FC<DeleteChatProps> = ({ chat }) => {
<DialogContent onKeyDown={handleKeyDown}>
<DialogHeader>
<DialogTitle>Delete {chat.name}</DialogTitle>
<DialogTitle>t("side.deleteChatTitle") {chat.name}</DialogTitle>
<DialogDescription>
Are you sure you want to delete this chat?
{t("side.deleteChatConfirm")}
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button variant="ghost" onClick={() => setShowChatDialog(false)}>
Cancel
{t("side.cancel")}
</Button>
<Button
@ -71,7 +76,7 @@ export const DeleteChat: FC<DeleteChatProps> = ({ chat }) => {
variant="destructive"
onClick={handleDeleteChat}
>
Delete
{t("side.delete")}
</Button>
</DialogFooter>
</DialogContent>

View File

@ -15,6 +15,8 @@ import { WithTooltip } from "../ui/with-tooltip"
import { ProfileSettings } from "../utility/profile-settings"
import { SidebarSwitchItem } from "./sidebar-switch-item"
import { useTranslation } from 'react-i18next'
export const SIDEBAR_ICON_SIZE = 28
interface SidebarSwitcherProps {
@ -24,6 +26,7 @@ interface SidebarSwitcherProps {
export const SidebarSwitcher: FC<SidebarSwitcherProps> = ({
onContentTypeChange
}) => {
const { t } = useTranslation()
return (
<div className="flex flex-col justify-between border-r-2 pb-5">
<TabsList className="bg-background grid h-[440px] grid-rows-7">
@ -84,7 +87,7 @@ export const SidebarSwitcher: FC<SidebarSwitcherProps> = ({
{/* <Alerts /> */}
<WithTooltip
display={<div>Profile Settings</div>}
display={<div>{t("side.profileSettings")}</div>}
trigger={<ProfileSettings />}
/>
</div>

View File

@ -147,7 +147,11 @@
"workspaceInstructionsPlaceholder": "Instructions... (optional)",
"sidebarCreateNew": "New",
"sidebarNoContentType": "No {{contentType}}",
"searchPlaceholder": "Search {{contentType}}..."
"searchPlaceholder": "Search {{contentType}}...",
"profileSettings": "Profile Settings",
"deleteChatTitle": "Delete",
"deleteChatConfirm": "Are you sure you want to delete this chat?",
"delete": "Delete"
},
"contentType": {

View File

@ -146,7 +146,11 @@
"workspaceInstructionsPlaceholder": "説明...(オプション)",
"sidebarCreateNew": "新規作成",
"sidebarNoContentType": "{{contentType}} はありません",
"searchPlaceholder": "{{contentType}} を検索..."
"searchPlaceholder": "{{contentType}} を検索...",
"profileSettings": "プロフィール設定",
"deleteChatTitle": "削除",
"deleteChatConfirm": "このチャットを削除してもよろしいですか?",
"delete": "削除"
},
"contentType": {

View File

@ -146,7 +146,11 @@
"workspaceInstructionsPlaceholder": "说明...(可选)",
"sidebarCreateNew": "新建",
"sidebarNoContentType": "没有 {{contentType}}",
"searchPlaceholder": "搜索{{contentType}}..."
"searchPlaceholder": "搜索{{contentType}}...",
"profileSettings": "个人资料设置",
"deleteChatTitle": "删除",
"deleteChatConfirm": "您确定要删除此聊天记录吗?",
"delete": "删除"
},
"contentType": {