From a1daf81f81aee5a9a2bf0cccbb13b5c0ed03643f Mon Sep 17 00:00:00 2001 From: yiling Date: Sun, 24 May 2026 11:35:39 +0800 Subject: [PATCH] fix(ui): address PR feedback on unified header --- src/ui/components/file-system-manager.tsx | 2 +- src/ui/components/top-nav.tsx | 24 +++++++++++++------ src/ui/routes/__root.tsx | 2 +- .../projects/$projectId/files/$fileId.tsx | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/ui/components/file-system-manager.tsx b/src/ui/components/file-system-manager.tsx index 1760ba94..bf707ba7 100644 --- a/src/ui/components/file-system-manager.tsx +++ b/src/ui/components/file-system-manager.tsx @@ -340,7 +340,7 @@ export default function FileSystemManager({ onDragStart={handleDragStart} onDragEnd={handleDragEnd} > -
+
{!isLeftSidebarCollapsed && (
s.location.pathname }) + const matches = useMatches() const { teamId } = useTeamContextStore() - // Match exact team page: /teams/$teamId or /teams/$teamId/ - const isTeamDashboard = teamId && (pathname === `/teams/${teamId}` || pathname === `/teams/${teamId}/`) + const currentRouteId = matches[matches.length - 1]?.routeId + + // Match exact team page: /teams/$teamId/ + const isTeamDashboard = teamId && currentRouteId === '/teams/$teamId/' if (isTeamDashboard) { return } - if (pathname.startsWith('/projects/')) { + // Ensure it's a project route but NOT the share management route + if ( + currentRouteId === '/projects/$projectId/' || + currentRouteId === '/projects/$projectId/folders/$folderId' || + currentRouteId === '/projects/$projectId/files/$fileId' || + currentRouteId === '/projects/$projectId/recently-deleted' + ) { return } @@ -143,8 +151,10 @@ function ProjectTopNav() { ? uiStore.setFileViewRightSidebarCollapsed(!uiStore.fileViewRightSidebarCollapsed) : uiStore.setFileListRightSidebarCollapsed(!uiStore.fileListRightSidebarCollapsed) - const displayStyle = uiStore.viewModes[projectId!] ?? 'card' - const onDisplayStyleChange = (style: 'card' | 'list') => uiStore.setViewMode(projectId!, style) + const displayStyle = projectId ? (uiStore.viewModes[projectId] ?? 'card') : 'card' + const onDisplayStyleChange = (style: 'card' | 'list') => { + if (projectId) uiStore.setViewMode(projectId, style) + } const handleFolderClick = (id: string) => { navigate({ diff --git a/src/ui/routes/__root.tsx b/src/ui/routes/__root.tsx index 871ba569..054c635b 100644 --- a/src/ui/routes/__root.tsx +++ b/src/ui/routes/__root.tsx @@ -80,7 +80,7 @@ function RootComponent() {
-
+
diff --git a/src/ui/routes/projects/$projectId/files/$fileId.tsx b/src/ui/routes/projects/$projectId/files/$fileId.tsx index 2d2d5ac0..2fed1d98 100644 --- a/src/ui/routes/projects/$projectId/files/$fileId.tsx +++ b/src/ui/routes/projects/$projectId/files/$fileId.tsx @@ -152,7 +152,7 @@ function FileViewPage() { } return ( -
+
{!isLeftSidebarCollapsed && ( <>