fix(webui): show archive icon in front of file name in breadcrumb bar

This commit is contained in:
yiling
2026-11-02 15:27:50 +08:00
parent 9097ec12bb
commit 10cb8b5097
4 changed files with 67 additions and 21 deletions
@@ -184,4 +184,20 @@ describe('MobileFileHeader', () => {
expect(items.some((i) => i.textContent?.includes('1080p'))).toBe(true)
expect(items.some((i) => i.textContent?.includes('1920p'))).toBe(false)
})
it('renders archive icon in front of file name without archived text when status is archived', () => {
render(
<MobileFileHeader
fileName="video.mp4"
activeFileId="file-archived"
status="archived"
onBack={vi.fn()}
/>,
)
const archiveIcon = screen.getByTestId('detail-header-archived-badge')
expect(archiveIcon).toBeDefined()
expect(screen.queryByText('Archived')).toBeNull()
expect(screen.queryByText('已归档')).toBeNull()
})
})
@@ -155,6 +155,15 @@ export function MobileFileHeader({
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<button className="flex items-center gap-1 min-w-0 truncate text-xs font-medium text-foreground hover:bg-accent rounded px-1 py-0.5 transition-colors cursor-pointer">
{status === 'archived' && (
<span
data-testid="detail-header-archived-badge"
title={m.archived_status()}
className="inline-flex items-center shrink-0"
>
<Archive className="h-3 w-3 text-muted-foreground" />
</span>
)}
<span className="truncate max-w-[120px] font-semibold">{fileName}</span>
{version !== undefined && (
<Badge variant="outline" className="px-1 py-0 text-[10px] shrink-0 font-normal">
@@ -185,6 +194,15 @@ export function MobileFileHeader({
</DropdownMenu>
) : (
<div className="flex items-center gap-1 min-w-0 truncate">
{status === 'archived' && (
<span
data-testid="detail-header-archived-badge"
title={m.archived_status()}
className="inline-flex items-center shrink-0"
>
<Archive className="h-3 w-3 text-muted-foreground" />
</span>
)}
<span className="truncate text-xs font-semibold text-foreground max-w-[140px]">
{fileName}
</span>
@@ -195,16 +213,6 @@ export function MobileFileHeader({
)}
</div>
)}
{status === 'archived' && (
<Badge
variant="secondary"
data-testid="detail-header-archived-badge"
className="ml-1 gap-0.5 px-1 py-0 text-[10px] shrink-0"
>
<Archive className="h-2.5 w-2.5" />
<span>{m.archived_status()}</span>
</Badge>
)}
{status === 'archiving' && (
<Badge
variant="secondary"