diff --git a/apps/web/src/components/NotebookPane.tsx b/apps/web/src/components/NotebookPane.tsx index a1596f3c..53861976 100644 --- a/apps/web/src/components/NotebookPane.tsx +++ b/apps/web/src/components/NotebookPane.tsx @@ -384,57 +384,19 @@ export const NotebookPane = ({ onSyncNow={onSyncQueuedChanges} />
- - - - - -
-
个人中心
-
{user?.username ?? "本地用户"}
-
- event.preventDefault()} - > - 压缩笔记内图片 - - - - - MCP / API 设置 - - {authRequired && ( - <> - - - - {isLoggingOut ? "退出中..." : "退出登录"} - - - )} -
-
+
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsx index 114c7088..d98afc01 100644 --- a/apps/web/src/components/SettingsPane.tsx +++ b/apps/web/src/components/SettingsPane.tsx @@ -1,19 +1,34 @@ import { useState, type FormEvent } from "react"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; -import { KeyRound, ShieldCheck, Trash2, ChevronLeft, Plus } from "lucide-react"; +import { KeyRound, ShieldCheck, Trash2, ChevronLeft, Plus, User, Image, LogOut } from "lucide-react"; import { Button } from "@/components/ui/button"; +import { Switch } from "@/components/ui/switch"; import { api } from "@/lib/api"; import { cn, formatDateTime } from "@/lib/utils"; import { AppConfirmDialog } from "./dialogs/ConfirmDialogs"; -import type { ApiToken } from "@edgeever/shared"; +import type { ApiToken, AuthUser } from "@edgeever/shared"; const DEFAULT_TOKEN_SCOPES = ["read:notebooks", "read:memos", "read:tags"]; interface SettingsPaneProps { + user: AuthUser | null; onClose: () => void; + imageCompressionEnabled: boolean; + onImageCompressionChange: (enabled: boolean) => void; + onLogout: () => void; + isLoggingOut: boolean; + authRequired: boolean; } -export const SettingsPane = ({ onClose }: SettingsPaneProps) => { +export const SettingsPane = ({ + user, + onClose, + imageCompressionEnabled, + onImageCompressionChange, + onLogout, + isLoggingOut, + authRequired, +}: SettingsPaneProps) => { const queryClient = useQueryClient(); const [name, setName] = useState("MCP Agent"); const [selectedScopes, setSelectedScopes] = useState>(() => new Set(DEFAULT_TOKEN_SCOPES)); @@ -94,55 +109,90 @@ export const SettingsPane = ({ onClose }: SettingsPaneProps) => {

- - API & MCP 设置 + + 个人中心 & 设置

- 管理用于本地 MCP 客户端或第三方 API 访问的身份凭证 + 管理个人偏好设置、第三方 API 凭证及登录会话

-
- {createdToken && ( -
-
- - API Token 已成功生成 -
-
- - -
-

- ⚠️ 安全警告:为了您的账户安全,明文 Token 仅在此处展示一次,关闭后将无法再次找回! -

+
+ {/* Section 1: User Profile */} +
+
+ {user?.username?.charAt(0) ?? "U"}
- )} +
+
{user?.username ?? "本地用户"}
+
+ + 在线工作区已连接 +
+
+
+ {/* Section 2: Preferences */}

- - 新建 API Token + + 偏好设置

-
+
+
+
压缩笔记内图片
+
上传大图时在本地进行无损或有损压缩以节省资源占用
+
+ +
+
+ + {/* Section 3: API & MCP */} +
+

+ + API & MCP 授权设置 +

+ + {createdToken && ( +
+
+ + API Token 已成功生成 +
+
+ + +
+

+ ⚠️ 安全警告:明文 Token 仅在此处展示一次,关闭后将无法再次找回! +

+
+ )} + +
setName(event.target.value)} placeholder="Token 用途描述,例如: Cline Agent" @@ -150,11 +200,11 @@ export const SettingsPane = ({ onClose }: SettingsPaneProps) => {
@@ -166,7 +216,7 @@ export const SettingsPane = ({ onClose }: SettingsPaneProps) => {
-
-
-

活跃的 Token 列表

+ 活跃的 Token 列表: {tokensQuery.isLoading ? ( -
正在加载 Token 列表...
+
正在加载 Token 列表...
) : tokens.length === 0 ? ( -
+
暂无活跃的 API Token
) : ( @@ -228,6 +276,27 @@ export const SettingsPane = ({ onClose }: SettingsPaneProps) => { )}
+ + {/* Section 4: System / Danger zone */} + {authRequired && ( +
+

+ + 会话管理 +

+

退出登录将清理您在这台设备上的本地 session 状态。

+ +
+ )}
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx index 6fe11966..6edf0810 100644 --- a/apps/web/src/components/WorkspaceApp.tsx +++ b/apps/web/src/components/WorkspaceApp.tsx @@ -1551,7 +1551,15 @@ export const WorkspaceApp = ({
{rightView === "settings" ? ( - + ) : rightView === "assets" ? ( ) : (