fix(ui): address PR feedback on unified header

This commit is contained in:
yiling
2026-05-24 11:35:39 +08:00
parent 8b1e86c41a
commit a1daf81f81
4 changed files with 20 additions and 10 deletions
+1 -1
View File
@@ -340,7 +340,7 @@ export default function FileSystemManager({
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
>
<div className="flex h-full flex-col bg-background">
<div className="flex flex-1 flex-col bg-background">
<div ref={containerRef} className="flex flex-1 overflow-hidden relative">
{!isLeftSidebarCollapsed && (
<div
+17 -7
View File
@@ -2,23 +2,31 @@ import { client } from '@/ui/api/client'
import { useTeamContextStore } from '@/ui/stores/team-context'
import { useUiStore } from '@/ui/stores/ui'
import { useQuery } from '@tanstack/react-query'
import { useNavigate, useParams, useRouterState, useSearch } from '@tanstack/react-router'
import { useMatches, useNavigate, useParams, useRouterState, useSearch } from '@tanstack/react-router'
import { BreadcrumbNav } from './breadcrumb-nav'
import { ShumaiLogo } from '@/ui/components/ui/icons'
import type { AncestorFolder } from '@/dtos/asset'
export function TopNav() {
const pathname = useRouterState({ select: (s) => 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 <TeamHeader />
}
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 <ProjectTopNav />
}
@@ -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({
+1 -1
View File
@@ -80,7 +80,7 @@ function RootComponent() {
</DualSidebar>
<div className="flex flex-col flex-1 md:pl-16 overflow-hidden relative">
<TopNav />
<main className="flex-1 overflow-hidden relative">
<main className="flex-1 overflow-y-auto overflow-x-hidden relative flex flex-col">
<Outlet />
</main>
</div>
@@ -152,7 +152,7 @@ function FileViewPage() {
}
return (
<div className="flex h-full flex-col bg-background">
<div className="flex flex-1 flex-col bg-background">
<div className="flex flex-1 overflow-hidden">
{!isLeftSidebarCollapsed && (
<>