mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 23:24:21 +00:00
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]
This commit is contained in:
@@ -41,9 +41,11 @@ import {
|
||||
History,
|
||||
LayoutGrid,
|
||||
List,
|
||||
Menu,
|
||||
SquareKanban,
|
||||
} from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { useDualSidebarStore } from '@/ui/stores/dual-sidebar'
|
||||
import { ManageVersionsDialog } from './manage-versions-dialog'
|
||||
import { AssetLinkedTasksDialog } from './kanban/asset-linked-tasks-dialog'
|
||||
|
||||
@@ -127,6 +129,7 @@ export function BreadcrumbNav({
|
||||
}: BreadcrumbNavProps) {
|
||||
const navigate = useNavigate()
|
||||
const { canEdit } = usePermissions(projectId)
|
||||
const { openMobileMenu } = useDualSidebarStore()
|
||||
const [isManageVersionsOpen, setIsManageVersionsOpen] = useState(false)
|
||||
const [isLinkedTasksOpen, setIsLinkedTasksOpen] = useState(false)
|
||||
|
||||
@@ -203,239 +206,375 @@ export function BreadcrumbNav({
|
||||
const isAudio = currentAsset.proxyType === 'audio'
|
||||
const hasVideoTranscodes = !isAudio && (downloadInfo?.videoTranscodes?.length ?? 0) > 0
|
||||
|
||||
const breadcrumbs: { name: string; path?: string; id?: string; isMuted?: boolean }[] = isPublic
|
||||
? [
|
||||
{
|
||||
name: projectName,
|
||||
id: 'root', // Special ID for share root
|
||||
},
|
||||
...ancestorFolders
|
||||
.slice()
|
||||
.reverse()
|
||||
.map((folder) => ({
|
||||
name: folder.name || '',
|
||||
id: folder.id,
|
||||
})),
|
||||
]
|
||||
: [
|
||||
{ name: m.all_projects(), path: `/teams/${teamId}`, isMuted: true },
|
||||
{ name: projectName, path: `/projects/${projectId}` },
|
||||
...ancestorFolders
|
||||
.slice()
|
||||
.reverse()
|
||||
.map((folder) => ({
|
||||
name: folder.name || '',
|
||||
path: `/projects/${projectId}/folders/${folder.id}`,
|
||||
})),
|
||||
]
|
||||
const hasTerminal = Boolean(customTerminalBreadcrumb || (!isRootFolder && !compareMode))
|
||||
|
||||
const mobileProjectItem = {
|
||||
name: projectName,
|
||||
path: isPublic ? undefined : `/projects/${projectId}`,
|
||||
id: 'root',
|
||||
}
|
||||
|
||||
const mobileAncestorItems = ancestorFolders
|
||||
.slice()
|
||||
.reverse()
|
||||
.map((folder) => ({
|
||||
name: folder.name || '',
|
||||
path: isPublic ? undefined : `/projects/${projectId}/folders/${folder.id}`,
|
||||
id: folder.id,
|
||||
}))
|
||||
|
||||
const mobileMiddleItems = hasTerminal ? mobileAncestorItems : mobileAncestorItems.slice(0, -1)
|
||||
const mobileTerminalDirect =
|
||||
!hasTerminal && mobileAncestorItems.length > 0
|
||||
? mobileAncestorItems[mobileAncestorItems.length - 1]
|
||||
: null
|
||||
|
||||
const renderTerminal = (isMobile = false) => {
|
||||
if (customTerminalBreadcrumb) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'truncate rounded px-2 py-1 text-sm font-medium text-foreground',
|
||||
isMobile && 'min-w-0 flex-1',
|
||||
)}
|
||||
>
|
||||
{customTerminalBreadcrumb}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
if (!isRootFolder && !compareMode) {
|
||||
if (currentAsset.type === 'folder') {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'truncate rounded px-2 py-1 text-sm font-medium text-foreground',
|
||||
isMobile && 'min-w-0 flex-1',
|
||||
)}
|
||||
>
|
||||
{currentAsset.name}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger
|
||||
className={cn(
|
||||
'flex items-center gap-1 truncate rounded px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground',
|
||||
isMobile && 'min-w-0 flex-1',
|
||||
)}
|
||||
>
|
||||
<span className="truncate">{currentAsset.name}</span>
|
||||
{currentAsset.version !== undefined && (
|
||||
<Badge variant="outline" className="px-1 py-0 text-xs shrink-0">
|
||||
v{currentAsset.version}
|
||||
</Badge>
|
||||
)}
|
||||
<ChevronDown className="h-4 w-4 shrink-0" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="w-56">
|
||||
{allowDownload &&
|
||||
(hasVideoTranscodes ? (
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger className="flex items-center gap-2">
|
||||
<span>{m.download()}</span>
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuPortal>
|
||||
<DropdownMenuSubContent className="w-48">
|
||||
<DropdownMenuLabel>{m.download()}</DropdownMenuLabel>
|
||||
{downloadInfo?.videoTranscodes?.map((t) => {
|
||||
const longSide = Math.max(t.width, t.height)
|
||||
let resolution = `${t.height}p`
|
||||
if (longSide >= 3840) resolution = '2160p'
|
||||
else if (longSide >= 1920) resolution = '1080p'
|
||||
else if (longSide >= 1280) resolution = '720p'
|
||||
else if (longSide >= 960) resolution = '540p'
|
||||
else if (longSide >= 640) resolution = '360p'
|
||||
else if (longSide >= 320) resolution = '180p'
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
key={resolution}
|
||||
onClick={() => handleDownload(t.key)}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span>{resolution}</span>
|
||||
<span className="text-xs text-muted-foreground">MP4</span>
|
||||
</DropdownMenuItem>
|
||||
)
|
||||
})}
|
||||
{downloadInfo?.originalKey && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onClick={() => handleDownload(downloadInfo.originalKey!)}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span>Original</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{currentAsset.name?.split('.').pop()?.toUpperCase() || 'RAW'}
|
||||
</span>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuPortal>
|
||||
</DropdownMenuSub>
|
||||
) : (
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
downloadInfo?.originalKey && handleDownload(downloadInfo.originalKey)
|
||||
}
|
||||
disabled={!downloadInfo?.originalKey}
|
||||
>
|
||||
{m.download()}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
{canEdit && onRename && (
|
||||
<DropdownMenuItem onClick={onRename}>{m.rename()}</DropdownMenuItem>
|
||||
)}
|
||||
{canEdit && onDelete && (
|
||||
<DropdownMenuItem
|
||||
onClick={onDelete}
|
||||
className="text-destructive focus:text-destructive"
|
||||
>
|
||||
{m.delete()}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
|
||||
{canCompareVersions && onCompareVersions && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={() => onCompareVersions()}>
|
||||
<Columns2 className="h-4 w-4" />
|
||||
<span>{m.compare_versions()}</span>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
|
||||
{versions && versions.length > 0 && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger className="flex items-center gap-2">
|
||||
<History className="h-4 w-4" />
|
||||
<span>Versions</span>
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuPortal>
|
||||
<DropdownMenuSubContent className="w-80 p-1">
|
||||
<div className="flex flex-col gap-1 max-h-96 overflow-y-auto">
|
||||
{versions.map((v) => {
|
||||
const isActive = currentAsset.version === v.version
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
key={v.id}
|
||||
onClick={() => handleVersionClick(v.id)}
|
||||
className="flex items-center gap-3 py-2 px-3 rounded-md cursor-pointer focus:bg-accent focus:text-accent-foreground"
|
||||
>
|
||||
<div className="flex-shrink-0 flex items-center justify-center bg-muted dark:bg-muted-foreground/20 text-muted-foreground dark:text-muted-foreground rounded-full px-2 py-0.5 text-xs font-semibold select-none min-w-[2rem]">
|
||||
v{v.version}
|
||||
</div>
|
||||
|
||||
<div className="h-10 w-16 flex-shrink-0 overflow-hidden rounded-md border border-border bg-muted flex items-center justify-center">
|
||||
{v.previewUrl ? (
|
||||
<img
|
||||
src={v.previewUrl}
|
||||
alt={v.name || undefined}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<FileIcon className="h-4 w-4 text-muted-foreground" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col flex-1 min-w-0 text-left">
|
||||
<span className="truncate text-sm font-semibold text-foreground">
|
||||
{v.name}
|
||||
</span>
|
||||
<span className="truncate text-xs text-muted-foreground">
|
||||
{v.creator?.name || 'Unknown'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{isActive && (
|
||||
<Check className="h-4 w-4 text-primary ml-auto flex-shrink-0" />
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<DropdownMenuSeparator />
|
||||
<div className="p-1">
|
||||
<button
|
||||
className="w-full text-center text-xs font-medium py-2 px-3 rounded-md bg-muted/80 hover:bg-muted text-foreground transition-colors cursor-pointer"
|
||||
onClick={() => setIsManageVersionsOpen(true)}
|
||||
>
|
||||
{m.manage_versions()}
|
||||
</button>
|
||||
</div>
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuPortal>
|
||||
</DropdownMenuSub>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex h-14 flex-wrap items-center justify-between gap-2 border-b border-border bg-card px-4 py-2">
|
||||
<div className="flex min-w-0 flex-shrink items-center gap-1">
|
||||
{breadcrumbs.map((breadcrumb, index) => (
|
||||
<div key={index} className="flex items-center gap-1">
|
||||
{index > 0 && <span className="text-muted-foreground">/</span>}
|
||||
{breadcrumb.path ? (
|
||||
<Link
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
to={breadcrumb.path as any}
|
||||
className={cn(
|
||||
'truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground',
|
||||
breadcrumb.isMuted ? 'text-muted-foreground' : 'text-foreground',
|
||||
)}
|
||||
>
|
||||
{breadcrumb.name}
|
||||
</Link>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => breadcrumb.id && onFolderClick?.(breadcrumb.id)}
|
||||
className="truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-foreground"
|
||||
>
|
||||
{breadcrumb.name}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
{customTerminalBreadcrumb ? (
|
||||
<div className="flex items-center gap-1">
|
||||
<div className="flex h-14 flex-nowrap items-center justify-between gap-2 border-b border-border bg-card px-4 py-2 overflow-hidden">
|
||||
<div className="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||
{/* Mobile menu button */}
|
||||
{!isPublic && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => openMobileMenu()}
|
||||
className="md:hidden h-8 w-8 text-foreground hover:bg-accent shrink-0 -ml-2 mr-1"
|
||||
aria-label="Open navigation menu"
|
||||
>
|
||||
<Menu className="h-5 w-5" />
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{/* Desktop-only: All Projects */}
|
||||
{!isPublic && (
|
||||
<div className="hidden md:flex items-center gap-1 shrink-0">
|
||||
<Link
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
to={`/teams/${teamId}` as any}
|
||||
className="truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-muted-foreground"
|
||||
>
|
||||
{m.all_projects()}
|
||||
</Link>
|
||||
<span className="text-muted-foreground">/</span>
|
||||
<span className="truncate rounded px-2 py-1 text-sm font-medium text-foreground">
|
||||
{customTerminalBreadcrumb}
|
||||
</span>
|
||||
</div>
|
||||
) : !isRootFolder && !compareMode ? (
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="text-muted-foreground">/</span>
|
||||
{currentAsset.type === 'folder' ? (
|
||||
<span className="truncate rounded px-2 py-1 text-sm font-medium text-foreground">
|
||||
{currentAsset.name}
|
||||
</span>
|
||||
) : (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger className="flex items-center gap-1 truncate rounded px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground">
|
||||
<span>{currentAsset.name}</span>
|
||||
{currentAsset.version !== undefined && (
|
||||
<Badge variant="outline" className="px-1 py-0 text-xs">
|
||||
v{currentAsset.version}
|
||||
</Badge>
|
||||
)}
|
||||
<ChevronDown className="h-4 w-4" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="w-56">
|
||||
{allowDownload &&
|
||||
(hasVideoTranscodes ? (
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger className="flex items-center gap-2">
|
||||
<span>{m.download()}</span>
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuPortal>
|
||||
<DropdownMenuSubContent className="w-48">
|
||||
<DropdownMenuLabel>{m.download()}</DropdownMenuLabel>
|
||||
{downloadInfo?.videoTranscodes?.map((t) => {
|
||||
const longSide = Math.max(t.width, t.height)
|
||||
let resolution = `${t.height}p`
|
||||
if (longSide >= 3840) resolution = '2160p'
|
||||
else if (longSide >= 1920) resolution = '1080p'
|
||||
else if (longSide >= 1280) resolution = '720p'
|
||||
else if (longSide >= 960) resolution = '540p'
|
||||
else if (longSide >= 640) resolution = '360p'
|
||||
else if (longSide >= 320) resolution = '180p'
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
key={resolution}
|
||||
onClick={() => handleDownload(t.key)}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span>{resolution}</span>
|
||||
<span className="text-xs text-muted-foreground">MP4</span>
|
||||
</DropdownMenuItem>
|
||||
)
|
||||
})}
|
||||
{downloadInfo?.originalKey && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onClick={() => handleDownload(downloadInfo.originalKey!)}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span>Original</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{currentAsset.name?.split('.').pop()?.toUpperCase() || 'RAW'}
|
||||
</span>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuPortal>
|
||||
</DropdownMenuSub>
|
||||
) : (
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
downloadInfo?.originalKey && handleDownload(downloadInfo.originalKey)
|
||||
}
|
||||
disabled={!downloadInfo?.originalKey}
|
||||
)}
|
||||
|
||||
{/* Project Name (Desktop & Mobile) */}
|
||||
{hasTerminal || ancestorFolders.length > 0 ? (
|
||||
mobileProjectItem.path ? (
|
||||
<Link
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
to={mobileProjectItem.path as any}
|
||||
className="min-w-0 max-w-[45%] md:max-w-none truncate rounded px-1.5 md:px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground shrink"
|
||||
>
|
||||
{mobileProjectItem.name}
|
||||
</Link>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => mobileProjectItem.id && onFolderClick?.(mobileProjectItem.id)}
|
||||
className="min-w-0 max-w-[45%] md:max-w-none truncate rounded px-1.5 md:px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground text-left shrink cursor-pointer"
|
||||
>
|
||||
{mobileProjectItem.name}
|
||||
</button>
|
||||
)
|
||||
) : (
|
||||
<span className="min-w-0 flex-1 truncate rounded px-1.5 md:px-2 py-1 text-sm font-medium text-foreground">
|
||||
{mobileProjectItem.name}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* Mobile-only: Omitted Middle Ancestors (...) dropdown */}
|
||||
{mobileMiddleItems.length > 0 && (
|
||||
<div className="flex md:hidden items-center gap-1 shrink-0">
|
||||
<span className="text-muted-foreground shrink-0">/</span>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button
|
||||
className="text-muted-foreground hover:text-foreground text-sm font-medium px-1.5 py-0.5 rounded hover:bg-accent shrink-0 cursor-pointer"
|
||||
aria-label="Show omitted folders"
|
||||
>
|
||||
...
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start">
|
||||
{mobileMiddleItems.map((item, idx) => (
|
||||
<DropdownMenuItem key={idx} asChild>
|
||||
{item.path ? (
|
||||
<Link
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
to={item.path as any}
|
||||
className="cursor-pointer"
|
||||
>
|
||||
{m.download()}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
{canEdit && onRename && (
|
||||
<DropdownMenuItem onClick={onRename}>{m.rename()}</DropdownMenuItem>
|
||||
)}
|
||||
{canEdit && onDelete && (
|
||||
<DropdownMenuItem
|
||||
onClick={onDelete}
|
||||
className="text-destructive focus:text-destructive"
|
||||
>
|
||||
{m.delete()}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
|
||||
{canCompareVersions && onCompareVersions && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={() => onCompareVersions()}>
|
||||
<Columns2 className="h-4 w-4" />
|
||||
<span>{m.compare_versions()}</span>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
|
||||
{versions && versions.length > 0 && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger className="flex items-center gap-2">
|
||||
<History className="h-4 w-4" />
|
||||
<span>Versions</span>
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuPortal>
|
||||
<DropdownMenuSubContent className="w-80 p-1">
|
||||
<div className="flex flex-col gap-1 max-h-96 overflow-y-auto">
|
||||
{versions.map((v) => {
|
||||
const isActive = currentAsset.version === v.version
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
key={v.id}
|
||||
onClick={() => handleVersionClick(v.id)}
|
||||
className="flex items-center gap-3 py-2 px-3 rounded-md cursor-pointer focus:bg-accent focus:text-accent-foreground"
|
||||
>
|
||||
<div className="flex-shrink-0 flex items-center justify-center bg-muted dark:bg-muted-foreground/20 text-muted-foreground dark:text-muted-foreground rounded-full px-2 py-0.5 text-xs font-semibold select-none min-w-[2rem]">
|
||||
v{v.version}
|
||||
</div>
|
||||
|
||||
<div className="h-10 w-16 flex-shrink-0 overflow-hidden rounded-md border border-border bg-muted flex items-center justify-center">
|
||||
{v.previewUrl ? (
|
||||
<img
|
||||
src={v.previewUrl}
|
||||
alt={v.name || undefined}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<FileIcon className="h-4 w-4 text-muted-foreground" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col flex-1 min-w-0 text-left">
|
||||
<span className="truncate text-sm font-semibold text-foreground">
|
||||
{v.name}
|
||||
</span>
|
||||
<span className="truncate text-xs text-muted-foreground">
|
||||
{v.creator?.name || 'Unknown'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{isActive && (
|
||||
<Check className="h-4 w-4 text-primary ml-auto flex-shrink-0" />
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<DropdownMenuSeparator />
|
||||
<div className="p-1">
|
||||
<button
|
||||
className="w-full text-center text-xs font-medium py-2 px-3 rounded-md bg-muted/80 hover:bg-muted text-foreground transition-colors cursor-pointer"
|
||||
onClick={() => setIsManageVersionsOpen(true)}
|
||||
>
|
||||
{m.manage_versions()}
|
||||
</button>
|
||||
</div>
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuPortal>
|
||||
</DropdownMenuSub>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)}
|
||||
{item.name}
|
||||
</Link>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => item.id && onFolderClick?.(item.id)}
|
||||
className="cursor-pointer w-full text-left"
|
||||
>
|
||||
{item.name}
|
||||
</button>
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
<span className="text-muted-foreground shrink-0">/</span>
|
||||
</div>
|
||||
) : null}
|
||||
)}
|
||||
|
||||
{/* Desktop-only: All Ancestor Folders */}
|
||||
{ancestorFolders
|
||||
.slice()
|
||||
.reverse()
|
||||
.map((folder) => {
|
||||
const path = isPublic ? undefined : `/projects/${projectId}/folders/${folder.id}`
|
||||
return (
|
||||
<div key={folder.id} className="hidden md:flex items-center gap-1">
|
||||
<span className="text-muted-foreground">/</span>
|
||||
{path ? (
|
||||
<Link
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
to={path as any}
|
||||
className="truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-foreground"
|
||||
>
|
||||
{folder.name}
|
||||
</Link>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => folder.id && onFolderClick?.(folder.id)}
|
||||
className="truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-foreground"
|
||||
>
|
||||
{folder.name}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
||||
{/* Terminal Item (Desktop & Mobile) */}
|
||||
{(hasTerminal || (!hasTerminal && ancestorFolders.length > 0)) && (
|
||||
<div className="flex items-center gap-1 min-w-0 flex-1 overflow-hidden">
|
||||
<span
|
||||
className={cn(
|
||||
'text-muted-foreground shrink-0',
|
||||
mobileMiddleItems.length > 0 ? 'hidden md:inline' : 'inline',
|
||||
)}
|
||||
>
|
||||
/
|
||||
</span>
|
||||
{hasTerminal
|
||||
? renderTerminal(true)
|
||||
: mobileTerminalDirect && (
|
||||
<span className="min-w-0 flex-1 truncate rounded px-2 py-1 text-sm font-medium text-foreground">
|
||||
{mobileTerminalDirect.name}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Linked Tasks */}
|
||||
{showKanbanLink && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-7 px-2 text-xs gap-1.5 text-muted-foreground hover:text-foreground hover:bg-muted ml-1 cursor-pointer"
|
||||
className="h-7 px-2 text-xs gap-1.5 text-muted-foreground hover:text-foreground hover:bg-muted ml-1 cursor-pointer shrink-0"
|
||||
onClick={() => setIsLinkedTasksOpen(true)}
|
||||
title={m.linked_tasks()}
|
||||
>
|
||||
@@ -447,53 +586,53 @@ export function BreadcrumbNav({
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{showKanbanLink && isLinkedTasksOpen && targetAssetId && (
|
||||
<AssetLinkedTasksDialog
|
||||
teamId={teamId}
|
||||
assetId={targetAssetId}
|
||||
assetName={currentAsset.name}
|
||||
isOpen={isLinkedTasksOpen}
|
||||
onClose={() => setIsLinkedTasksOpen(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{fileId && versions && versions.length > 0 && (
|
||||
<ManageVersionsDialog
|
||||
open={isManageVersionsOpen}
|
||||
onOpenChange={setIsManageVersionsOpen}
|
||||
stackId={fileId}
|
||||
canEdit={canEdit}
|
||||
onStackDissolved={(remainingFileId) => {
|
||||
setIsManageVersionsOpen(false)
|
||||
navigate({
|
||||
to: '/projects/$projectId/files/$fileId',
|
||||
params: { projectId, fileId: remainingFileId },
|
||||
})
|
||||
}}
|
||||
onVersionRemoved={(removedVersionId, remainingVersions) => {
|
||||
const currentVersionId = currentAsset.version
|
||||
? versions.find((v) => v.version === currentAsset.version)?.id
|
||||
: undefined
|
||||
if (currentVersionId === removedVersionId) {
|
||||
const topVersion = remainingVersions[0]
|
||||
if (topVersion) {
|
||||
navigate({
|
||||
to: '/projects/$projectId/files/$fileId',
|
||||
params: { projectId, fileId },
|
||||
search: (prev: Record<string, unknown>) => ({
|
||||
...prev,
|
||||
version: topVersion.id,
|
||||
}),
|
||||
})
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
{showKanbanLink && isLinkedTasksOpen && targetAssetId && (
|
||||
<AssetLinkedTasksDialog
|
||||
teamId={teamId}
|
||||
assetId={targetAssetId}
|
||||
assetName={currentAsset.name}
|
||||
isOpen={isLinkedTasksOpen}
|
||||
onClose={() => setIsLinkedTasksOpen(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{fileId && versions && versions.length > 0 && (
|
||||
<ManageVersionsDialog
|
||||
open={isManageVersionsOpen}
|
||||
onOpenChange={setIsManageVersionsOpen}
|
||||
stackId={fileId}
|
||||
canEdit={canEdit}
|
||||
onStackDissolved={(remainingFileId) => {
|
||||
setIsManageVersionsOpen(false)
|
||||
navigate({
|
||||
to: '/projects/$projectId/files/$fileId',
|
||||
params: { projectId, fileId: remainingFileId },
|
||||
})
|
||||
}}
|
||||
onVersionRemoved={(removedVersionId, remainingVersions) => {
|
||||
const currentVersionId = currentAsset.version
|
||||
? versions.find((v) => v.version === currentAsset.version)?.id
|
||||
: undefined
|
||||
if (currentVersionId === removedVersionId) {
|
||||
const topVersion = remainingVersions[0]
|
||||
if (topVersion) {
|
||||
navigate({
|
||||
to: '/projects/$projectId/files/$fileId',
|
||||
params: { projectId, fileId },
|
||||
search: (prev: Record<string, unknown>) => ({
|
||||
...prev,
|
||||
version: topVersion.id,
|
||||
}),
|
||||
})
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="hidden md:flex items-center gap-2">
|
||||
<div className="flex flex-shrink-0 items-center gap-1 rounded-md border border-border bg-background p-1">
|
||||
{/* Left Sidebar Toggle */}
|
||||
{!fileId && !isPublic && onLeftSidebarToggle && (
|
||||
|
||||
Reference in New Issue
Block a user