This commit is contained in:
hailin 2025-04-19 01:19:56 +08:00
parent 106b240a15
commit 509a0ea3d7
5 changed files with 71 additions and 18 deletions

View File

@ -8,12 +8,17 @@ import { WorkspaceSwitcher } from "../utility/workspace-switcher"
import { WorkspaceSettings } from "../workspace/workspace-settings"
import { SidebarContent } from "./sidebar-content"
import { useTranslation } from "react-i18next";
interface SidebarProps {
contentType: ContentType
showSidebar: boolean
}
export const Sidebar: FC<SidebarProps> = ({ contentType, showSidebar }) => {
const { t } = useTranslation();
const {
folders,
chats,

View File

@ -28,9 +28,14 @@ import { TextareaAutosize } from "../ui/textarea-autosize"
import { WithTooltip } from "../ui/with-tooltip"
import { DeleteWorkspace } from "./delete-workspace"
import { useTranslation } from "react-i18next";
interface WorkspaceSettingsProps {}
export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
const { t } = useTranslation();
const {
profile,
selectedWorkspace,
@ -168,7 +173,7 @@ export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
<Sheet open={isOpen} onOpenChange={setIsOpen}>
<SheetTrigger asChild>
<WithTooltip
display={<div>Workspace Settings</div>}
display={<div>{t("side.workspaceSettings")}</div>}
trigger={
<IconSettings
className="ml-3 cursor-pointer pr-[5px] hover:opacity-50"
@ -187,30 +192,30 @@ export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
<div className="grow overflow-auto">
<SheetHeader>
<SheetTitle className="flex items-center justify-between">
Workspace Settings
{t("side.workspaceSettings")}
{selectedWorkspace?.is_home && <IconHome />}
</SheetTitle>
{selectedWorkspace?.is_home && (
<div className="text-sm font-light">
This is your home workspace for personal use.
{t("side.workspaceDescription")}
</div>
)}
</SheetHeader>
<Tabs defaultValue="main">
<TabsList className="mt-4 grid w-full grid-cols-2">
<TabsTrigger value="main">Main</TabsTrigger>
<TabsTrigger value="defaults">Defaults</TabsTrigger>
<TabsTrigger value="main">{t("side.main")}</TabsTrigger>
<TabsTrigger value="defaults">{t("side.defaults")}</TabsTrigger>
</TabsList>
<TabsContent className="mt-4 space-y-4" value="main">
<>
<div className="space-y-1">
<Label>Workspace Name</Label>
<Label>{t("side.workspaceName")}</Label>
<Input
placeholder="Name..."
placeholder={t("side.workspaceNamePlaceholder")}
value={name}
onChange={e => setName(e.target.value)}
/>
@ -227,7 +232,7 @@ export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
</div> */}
<div className="space-y-1">
<Label>Workspace Image</Label>
<Label>{t("side.workspaceImage")}</Label>
<ImagePicker
src={imageLink}
@ -242,11 +247,11 @@ export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
<div className="space-y-1">
<Label>
How would you like the AI to respond in this workspace?
{t("side.aiResponseInstructions")}
</Label>
<TextareaAutosize
placeholder="Instructions... (optional)"
placeholder={t("side.workspaceInstructionsPlaceholder")}
value={instructions}
onValueChange={setInstructions}
minRows={5}
@ -263,7 +268,7 @@ export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
<TabsContent className="mt-5" value="defaults">
<div className="mb-4 text-sm">
These are the settings your workspace begins with when selected.
{t("side.workspaceBeginSettings")}
</div>
<ChatSettingsForm
@ -287,10 +292,11 @@ export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
<div className="space-x-2">
<Button variant="ghost" onClick={() => setIsOpen(false)}>
Cancel
{t("side.cancel")}
</Button>
<Button ref={buttonRef} onClick={handleSave}>
Save
{t("side.save")}
</Button>
</div>
</div>

View File

@ -130,7 +130,21 @@
"selectWorkspace": "Select workspace...",
"newWorkspace": "New Workspace",
"searchWorkspaces": "Search workspaces...",
"noWorkspacesFound": "No workspaces found"
"noWorkspacesFound": "No workspaces found",
"workspaceSettings": "Workspace Settings",
"workspaceImage": "Workspace Image",
"workspaceName": "Workspace Name",
"workspaceInstructions": "Workspace Instructions",
"workspaceDescription": "This is your home workspace for personal use.",
"save": "Save",
"cancel": "Cancel",
"howToRespond": "How would you like the AI to respond in this workspace?",
"main": "Main",
"defaults": "Defaults",
"aiResponseInstructions": "How would you like the AI to respond in this workspace?",
"workspaceNamePlaceholder": "Name...",
"workspaceBeginSettings": "These are the settings your workspace begins with when selected.",
"workspaceInstructionsPlaceholder": "Instructions... (optional)"
}
}

View File

@ -129,8 +129,22 @@
"selectWorkspace": "ワークスペースを選択...",
"newWorkspace": "新しいワークスペース",
"searchWorkspaces": "ワークスペースを検索...",
"noWorkspacesFound": "ワークスペースが見つかりません"
"noWorkspacesFound": "ワークスペースが見つかりません",
"workspaceSettings": "ワークスペース設定",
"workspaceImage": "ワークスペース画像",
"workspaceName": "ワークスペース名",
"workspaceInstructions": "ワークスペース指示",
"workspaceDescription": "これはあなたの個人用のホームワークスペースです",
"save": "保存",
"cancel": "キャンセル",
"howToRespond": "このワークスペースでAIにどのように応答してほしいですか",
"main": "メイン",
"defaults": "デフォルト",
"aiResponseInstructions": "このワークスペースでAIにどのように応答してほしいですか",
"workspaceNamePlaceholder": "名前を入力...",
"workspaceBeginSettings": "これらはワークスペースを選択したときに始まる設定です。",
"workspaceInstructionsPlaceholder": "説明...(オプション)"
}
}

View File

@ -129,7 +129,21 @@
"selectWorkspace": "选择工作区...",
"newWorkspace": "新建工作区",
"searchWorkspaces": "搜索工作区...",
"noWorkspacesFound": "未找到工作区"
"noWorkspacesFound": "未找到工作区",
"workspaceSettings": "工作区设置",
"workspaceImage": "工作区图片",
"workspaceName": "工作区名称",
"workspaceInstructions": "工作区说明",
"workspaceDescription": "这是您的个人专用工作区",
"save": "保存",
"cancel": "取消",
"howToRespond": "您希望 AI 如何在此工作区内回应?",
"main": "主设置",
"defaults": "默认设置",
"aiResponseInstructions": "您希望 AI 在此工作区内如何回应?",
"workspaceNamePlaceholder": "请输入名称...",
"workspaceBeginSettings": "这些是选择此工作区时的初始设置。",
"workspaceInstructionsPlaceholder": "说明...(可选)"
}
}