mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 11:37:17 +00:00
* feat(asset): record and display agent provenance on assets and audit logs * style(webui): apply 30% translucent frosted glass background to bot badges * style(webui): match bot icon badge style to thumbnail media overlay (bg-black/60 text-white) * style(webui): use "AI" text badge with pdf overlay style instead of bot icon
76 lines
1.9 KiB
TypeScript
76 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
|
|
agent?: { id: string; name: string } | 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
|
|
},
|
|
}))
|