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

View File

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

View File

@ -147,7 +147,11 @@
"workspaceInstructionsPlaceholder": "Instructions... (optional)", "workspaceInstructionsPlaceholder": "Instructions... (optional)",
"sidebarCreateNew": "New", "sidebarCreateNew": "New",
"sidebarNoContentType": "No {{contentType}}", "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": { "contentType": {

View File

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

View File

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