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} onDragStart={handleDragStart}
onDragEnd={handleDragEnd} 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"> <div ref={containerRef} className="flex flex-1 overflow-hidden relative">
{!isLeftSidebarCollapsed && ( {!isLeftSidebarCollapsed && (
<div <div
+17 -7
View File
@@ -2,23 +2,31 @@ import { client } from '@/ui/api/client'
import { useTeamContextStore } from '@/ui/stores/team-context' import { useTeamContextStore } from '@/ui/stores/team-context'
import { useUiStore } from '@/ui/stores/ui' import { useUiStore } from '@/ui/stores/ui'
import { useQuery } from '@tanstack/react-query' 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 { BreadcrumbNav } from './breadcrumb-nav'
import { ShumaiLogo } from '@/ui/components/ui/icons' import { ShumaiLogo } from '@/ui/components/ui/icons'
import type { AncestorFolder } from '@/dtos/asset' import type { AncestorFolder } from '@/dtos/asset'
export function TopNav() { export function TopNav() {
const pathname = useRouterState({ select: (s) => s.location.pathname }) const matches = useMatches()
const { teamId } = useTeamContextStore() const { teamId } = useTeamContextStore()
// Match exact team page: /teams/$teamId or /teams/$teamId/ const currentRouteId = matches[matches.length - 1]?.routeId
const isTeamDashboard = teamId && (pathname === `/teams/${teamId}` || pathname === `/teams/${teamId}/`)
// Match exact team page: /teams/$teamId/
const isTeamDashboard = teamId && currentRouteId === '/teams/$teamId/'
if (isTeamDashboard) { if (isTeamDashboard) {
return <TeamHeader /> 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 /> return <ProjectTopNav />
} }
@@ -143,8 +151,10 @@ function ProjectTopNav() {
? uiStore.setFileViewRightSidebarCollapsed(!uiStore.fileViewRightSidebarCollapsed) ? uiStore.setFileViewRightSidebarCollapsed(!uiStore.fileViewRightSidebarCollapsed)
: uiStore.setFileListRightSidebarCollapsed(!uiStore.fileListRightSidebarCollapsed) : uiStore.setFileListRightSidebarCollapsed(!uiStore.fileListRightSidebarCollapsed)
const displayStyle = uiStore.viewModes[projectId!] ?? 'card' const displayStyle = projectId ? (uiStore.viewModes[projectId] ?? 'card') : 'card'
const onDisplayStyleChange = (style: 'card' | 'list') => uiStore.setViewMode(projectId!, style) const onDisplayStyleChange = (style: 'card' | 'list') => {
if (projectId) uiStore.setViewMode(projectId, style)
}
const handleFolderClick = (id: string) => { const handleFolderClick = (id: string) => {
navigate({ navigate({
+1 -1
View File
@@ -80,7 +80,7 @@ function RootComponent() {
</DualSidebar> </DualSidebar>
<div className="flex flex-col flex-1 md:pl-16 overflow-hidden relative"> <div className="flex flex-col flex-1 md:pl-16 overflow-hidden relative">
<TopNav /> <TopNav />
<main className="flex-1 overflow-hidden relative"> <main className="flex-1 overflow-y-auto overflow-x-hidden relative flex flex-col">
<Outlet /> <Outlet />
</main> </main>
</div> </div>
@@ -152,7 +152,7 @@ function FileViewPage() {
} }
return ( 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"> <div className="flex flex-1 overflow-hidden">
{!isLeftSidebarCollapsed && ( {!isLeftSidebarCollapsed && (
<> <>