From 5b2e48baddd1325d78d251a274d14f98b57cecbb Mon Sep 17 00:00:00 2001 From: aits2026 Date: Tue, 10 Mar 2026 13:24:47 +0800 Subject: [PATCH] refactor: streamline sidebar account menu --- src/components/Sidebar.scss | 41 ++++++++++++++------ src/components/Sidebar.tsx | 75 ++++++++++++++++++++----------------- 2 files changed, 70 insertions(+), 46 deletions(-) diff --git a/src/components/Sidebar.scss b/src/components/Sidebar.scss index f4805a2..89a791c 100644 --- a/src/components/Sidebar.scss +++ b/src/components/Sidebar.scss @@ -45,29 +45,48 @@ margin: 0 12px 10px; } -.sidebar-user-clear-trigger { +.sidebar-user-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 12; - border: 1px solid rgba(255, 59, 48, 0.28); - border-radius: 10px; + border: 1px solid var(--border-color); + border-radius: 12px; background: var(--bg-secondary); - color: #d93025; - padding: 8px 10px; + display: flex; + flex-direction: column; + gap: 4px; + padding: 6px; + box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12); +} + +.sidebar-user-menu-item { + width: 100%; + border: none; + border-radius: 10px; + background: transparent; + color: var(--text-primary); + padding: 9px 10px; display: flex; align-items: center; gap: 8px; - font-size: 12px; - font-weight: 600; + font-size: 13px; + font-weight: 500; cursor: pointer; - box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12); - transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; + text-align: left; + transition: background 0.2s ease, color 0.2s ease; &:hover { - background: rgba(255, 59, 48, 0.08); - border-color: rgba(255, 59, 48, 0.46); + background: var(--bg-tertiary); + } + + &.danger { + color: #d93025; + + &:hover { + background: rgba(255, 59, 48, 0.08); + } } } diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 2f68ba6..fbd0694 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -282,6 +282,11 @@ function Sidebar({ collapsed }: SidebarProps) { setShowClearAccountDialog(true) } + const openSettingsFromAccountMenu = () => { + setIsAccountMenuOpen(false) + navigate('/settings') + } + const handleConfirmClearAccountData = async () => { if (!canConfirmClear || isClearingAccountData) return setIsClearingAccountData(true) @@ -420,16 +425,43 @@ function Sidebar({ collapsed }: SidebarProps) {
+ +
{isAccountMenuOpen && ( - +
+ + +
)}
- - - - - - - - 设置 - -
{showClearAccountDialog && (