Files
shumai/packages/webui/stores/top-nav.ts
T
Yiling-J d16e31c0e5 feat(webui): add simplified mobile-friendly layout for file and share lists (#356)
* feat(webui): add simplified mobile-friendly layout for file and share lists

* refactor(webui): switch mobile file list layout to 1-column grid

* feat(webui): show foldertree by default in child sidebar and add close button

* feat(webui): add collapsible section headers and fix folder card full-width on mobile

* feat(webui): improve mobile breadcrumb bar with middle truncation and dual ellipsis

* fix(webui): unify breadcrumb DOM structure across desktop and mobile

* fix(webui): remove unused breadcrumbs variable in BreadcrumbNav

* fix(webui): complete and confirm file uploads on mobile and handle errors properly

* fix(webui): remove active scale animation on mobile FAB to stabilize dropdown menu anchor

* refactor(webui): use PresignedUrl type from dtos for uploadFiles and eliminate any cast

* fix(webui): scope folder card max width to desktop with responsive md:max-w-[340px]
2026-08-27 20:44:08 +08:00

75 lines
1.9 KiB
TypeScript

import { create } from 'zustand'
import type { AncestorFolder } from '@shumai/dtos'
export interface TopNavProjectState {
teamId: string
projectId: string
projectName: string
rootFolderId?: string
ancestorFolders: AncestorFolder[]
currentAsset: {
id?: string
name?: string
type: 'file' | 'folder'
version?: number
proxyType?: 'image' | 'video' | 'audio' | 'pdf' | null
}
isRootFolder: boolean
customTerminalBreadcrumb?: string
fileId?: string
downloadInfo?: {
originalKey?: string
videoTranscodes?: Array<{
key: string
width: number
height: number
}>
}
versions?: Array<{
id: string
version: number
name?: string | null
previewUrl?: string | null
creator?: { id: string; name: string | null } | null
}>
isPublic?: boolean
shareId?: string
/** When false, the public share hides download affordances. Defaults to true. */
allowDownload?: boolean
onFolderClick?: (folderId: string) => void
onRename?: () => void
onDelete?: () => void
isRightSidebarCollapsed?: boolean
onRightSidebarToggle?: () => void
// Compare Versions
compareMode?: boolean
canCompareVersions?: boolean
onCompareVersions?: () => void
}
interface TopNavStore {
projectState: TopNavProjectState | null
setProjectState: (state: TopNavProjectState | null) => void
clearProjectState: () => void
}
let timeoutId: ReturnType<typeof setTimeout> | null = null
export const useTopNavStore = create<TopNavStore>((set) => ({
projectState: null,
setProjectState: (state) => {
if (timeoutId) {
clearTimeout(timeoutId)
timeoutId = null
}
set({ projectState: state })
},
clearProjectState: () => {
if (timeoutId) clearTimeout(timeoutId)
timeoutId = setTimeout(() => {
set({ projectState: null })
timeoutId = null
}, 10) // Small debounce to prevent flicker during transitions
},
}))