mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 04:14:30 +00:00
fix(webui,core): center breadcrumb menu on chevron and fix proxy download filename (#417)
This commit is contained in:
@@ -144,4 +144,20 @@ describe('BreadcrumbNav component', () => {
|
||||
|
||||
expect(container.querySelector('.lucide-bot')).toBeNull()
|
||||
})
|
||||
|
||||
it('renders file actions dropdown trigger button and opens on click', () => {
|
||||
render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<BreadcrumbNav
|
||||
{...baseProps}
|
||||
fileId="file-1"
|
||||
currentAsset={{ id: 'file-1', name: 'sample.mov', type: 'file', version: 1 }}
|
||||
allowDownload={true}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
|
||||
const triggerButton = screen.getByRole('button', { name: 'sample.mov' })
|
||||
expect(triggerButton).toBeDefined()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -133,6 +133,7 @@ export function BreadcrumbNav({
|
||||
const { openMobileMenu } = useDualSidebarStore()
|
||||
const [isManageVersionsOpen, setIsManageVersionsOpen] = useState(false)
|
||||
const [isLinkedTasksOpen, setIsLinkedTasksOpen] = useState(false)
|
||||
const [isFileMenuOpen, setIsFileMenuOpen] = useState(false)
|
||||
|
||||
const targetAssetId = fileId || currentAsset.id
|
||||
const isRecentlyDeleted = currentAsset.name === 'Recently Deleted'
|
||||
@@ -249,17 +250,32 @@ export function BreadcrumbNav({
|
||||
}
|
||||
|
||||
return (
|
||||
<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">
|
||||
<DropdownMenu modal={false} open={isFileMenuOpen} onOpenChange={setIsFileMenuOpen}>
|
||||
<div
|
||||
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 cursor-pointer select-none"
|
||||
onClick={() => setIsFileMenuOpen((prev) => !prev)}
|
||||
>
|
||||
<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" align="start">
|
||||
<DropdownMenuTrigger
|
||||
asChild
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={currentAsset.name}
|
||||
className="flex items-center justify-center p-0.5 rounded shrink-0 focus:outline-none"
|
||||
>
|
||||
<ChevronDown className="h-4 w-4 shrink-0" />
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
</div>
|
||||
<DropdownMenuContent className="w-56" align="center">
|
||||
{allowDownload &&
|
||||
(hasVideoTranscodes ? (
|
||||
<DropdownMenuSub>
|
||||
|
||||
Reference in New Issue
Block a user