mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 05:54:44 +00:00
fix(ui): address PR feedback on unified header
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
@@ -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 && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user