From c108070696bc7deb45426d36eb7151e3a5050128 Mon Sep 17 00:00:00 2001 From: aits2026 Date: Fri, 6 Mar 2026 12:55:08 +0800 Subject: [PATCH] feat(sidebar): surface unlock entry --- src/components/Sidebar.tsx | 29 +++++++++++++++++------------ src/pages/SettingsPage.tsx | 8 ++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index b72ddcd..76547fb 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -1,6 +1,6 @@ import { useState, useEffect, useRef } from 'react' -import { NavLink, useLocation } from 'react-router-dom' -import { Home, MessageSquare, BarChart3, Users, FileText, Settings, ChevronLeft, ChevronRight, Download, Aperture, UserCircle, Lock, ChevronUp, Trash2 } from 'lucide-react' +import { NavLink, useLocation, useNavigate } from 'react-router-dom' +import { Home, MessageSquare, BarChart3, Users, FileText, Settings, ChevronLeft, ChevronRight, Download, Aperture, UserCircle, Lock, LockOpen, ChevronUp, Trash2 } from 'lucide-react' import { useAppStore } from '../stores/appStore' import * as configService from '../services/config' import { onExportSessionStatus, requestExportSessionStatus } from '../services/exportBridge' @@ -64,6 +64,7 @@ const normalizeAccountId = (value?: string | null): string => { function Sidebar() { const location = useLocation() + const navigate = useNavigate() const [collapsed, setCollapsed] = useState(false) const [authEnabled, setAuthEnabled] = useState(false) const [activeExportTaskCount, setActiveExportTaskCount] = useState(0) @@ -465,16 +466,20 @@ function Sidebar() { - {authEnabled && ( - - )} + { + const initialTab = (location.state as { initialTab?: SettingsTab } | null)?.initialTab + if (!initialTab) return + setActiveTab(initialTab) + }, [location.state]) + // 点击外部关闭下拉框 useEffect(() => { const handleClickOutside = (e: MouseEvent) => {