Compare commits

...
3 Commits
7 changed files with 168 additions and 54 deletions
+2
View File
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Fixed
- **asset**: Fix an issue where version cards in the manage versions dialog horizontally overflowed when containing long file names
### Changed
## [0.6.3] - 2026-11-01
+1
View File
@@ -90,6 +90,7 @@ apps/web/e2e/
| Owner removes version from 2-version stack which dissolves into standalone files | `tests/project/version-stack-manage.spec.ts` |
| Dissolving a shared version stack renders the remaining standalone file name on the share page | `tests/project/version-stack-manage.spec.ts` |
| Moving a shared file into a shared version stack leaves only 1 stack card on the share page | `tests/project/version-stack-manage.spec.ts` |
| Manage versions dialog constrains card width and truncates long file names without dialog overflow | `tests/project/version-stack-manage.spec.ts` |
| Owner searches the file list by an English name keyword | `tests/project/search-file-list.spec.ts` |
| Owner searches the file list by Chinese, Japanese, and Korean name keywords | `tests/project/search-file-list.spec.ts` |
| Owner searches the file list with a keyword and a filter condition | `tests/project/search-file-list.spec.ts` |
@@ -231,3 +231,76 @@ test('moving a shared file into a shared version stack leaves only 1 stack card
const updatedShareRoot = await prisma.asset.findUnique({ where: { id: share.rootFolderId } })
expect(updatedShareRoot?.fileCount).toBe(1)
})
test('manage versions dialog constrains card width and truncates long file names without dialog overflow', async ({
project,
prisma,
}) => {
const { page, projectId, rootFolderId } = project
const longName =
'super-extremely-long-asset-name-for-testing-manage-versions-dialog-card-overflow-issue-that-keeps-expanding-without-truncating-properly.mp4'
const fileA = await seedFile(prisma, projectId, rootFolderId, longName)
const fileB = await seedFile(prisma, projectId, rootFolderId, `short-${Date.now()}.mp4`)
await page.goto(`/projects/${projectId}`)
await expect(fileCard(page, fileA.name)).toBeVisible()
await expect(fileCard(page, fileB.name)).toBeVisible()
// Create version stack: drag B on A
await dragCard(page, fileCard(page, fileB.name), fileCard(page, fileA.name))
await expect(page.getByText('v2', { exact: true })).toBeVisible()
const stack = await prisma.asset.findFirstOrThrow({
where: { projectId, parentId: rootFolderId, type: 'version_stack' },
})
// Navigate to file viewer for the stack
await page.goto(`/projects/${projectId}/files/${stack.id}`)
// Open breadcrumb menu and click "Manage versions..."
await page.getByRole('button', { name: new RegExp(fileB.name) }).click()
await page.getByRole('menuitem', { name: 'Versions', exact: true }).hover()
await page.getByRole('button', { name: /manage versions$/i }).click()
const dialog = page.getByRole('dialog')
await expect(dialog).toBeVisible()
const rowA = dialog.locator('div.group', { hasText: longName })
await expect(rowA).toBeVisible()
// Measure the dialog and version row
const metrics = await page.evaluate(() => {
const dialogEl = document.querySelector('[role="dialog"]') as HTMLElement | null
if (!dialogEl) return null
const row = dialogEl.querySelector('div.group') as HTMLElement | null
return {
dialogScrollWidth: dialogEl.scrollWidth,
dialogClientWidth: dialogEl.clientWidth,
dialogOffsetWidth: dialogEl.offsetWidth,
rowScrollWidth: row?.scrollWidth,
rowClientWidth: row?.clientWidth,
}
})
expect(metrics).not.toBeNull()
// Dialog should not horizontally scroll or overflow
expect(metrics!.dialogScrollWidth).toBeLessThanOrEqual(metrics!.dialogClientWidth)
// Row clientWidth should be bounded within the dialog
expect(metrics!.rowClientWidth).toBeLessThanOrEqual(metrics!.dialogClientWidth)
expect(metrics!.rowScrollWidth).toBeLessThanOrEqual(metrics!.rowClientWidth!)
// Hover over the row and verify the more-options button is visible and within bounds
await rowA.hover()
const moreButton = rowA.getByRole('button', { name: 'More options' })
await expect(moreButton).toBeVisible()
const moreBtnBox = await moreButton.boundingBox()
const dialogBox = await dialog.boundingBox()
expect(moreBtnBox).not.toBeNull()
expect(dialogBox).not.toBeNull()
expect(moreBtnBox!.x + moreBtnBox!.width).toBeLessThanOrEqual(dialogBox!.x + dialogBox!.width)
// Click more options button and verify menu opens
await moreButton.click()
await expect(page.getByRole('menuitem', { name: /remove from stack/i })).toBeVisible()
})
@@ -350,4 +350,46 @@ describe('BreadcrumbNav component', () => {
expect(screen.queryByText('Restoring...')).toBeNull()
expect(screen.queryByText('恢复中...')).toBeNull()
})
it('renders archive icon in front of version name without text in versions dropdown', () => {
render(
<QueryClientProvider client={queryClient}>
<BreadcrumbNav
{...baseProps}
fileId="file-with-versions"
currentAsset={{
id: 'file-with-versions',
name: 'v2.mp4',
type: 'file',
version: 2,
status: 'processed',
}}
versions={[
{
id: 'file-v2',
version: 2,
name: 'v2.mp4',
status: 'processed',
},
{
id: 'file-v1',
version: 1,
name: 'v1-archived.mp4',
status: 'archived',
},
]}
/>
</QueryClientProvider>,
)
const triggerButton = screen.getByRole('button', { name: 'v2.mp4' })
fireEvent.pointerDown(triggerButton, { button: 0, ctrlKey: false })
const versionsTrigger = screen.getByText('Versions')
fireEvent.click(versionsTrigger)
expect(screen.getByText('v1-archived.mp4')).toBeDefined()
expect(screen.queryByText('Archived')).toBeNull()
expect(screen.queryByText('已归档')).toBeNull()
})
})
+14 -17
View File
@@ -457,31 +457,28 @@ export function BreadcrumbNav({
<div className="flex flex-col flex-1 min-w-0 text-left">
<div className="flex items-center gap-1.5 min-w-0">
{(v.status === 'archived' || v.status === 'restoring') && (
<span
title={
v.status === 'restoring'
? m.restoring_status()
: m.archived_status()
}
className="inline-flex items-center shrink-0"
>
<Archive className="h-3.5 w-3.5 text-muted-foreground" />
</span>
)}
<span className="truncate text-sm font-semibold text-foreground">
{v.name}
</span>
{v.status === 'archived' && (
<Badge
variant="secondary"
className="gap-0.5 px-1 py-0 text-[10px] shrink-0"
>
{m.archived_status()}
</Badge>
)}
{v.status === 'archiving' && (
<Badge
variant="secondary"
className="gap-0.5 px-1 py-0 text-[10px] shrink-0"
>
{m.archiving_status()}
</Badge>
)}
{v.status === 'restoring' && (
<Badge
variant="secondary"
className="gap-0.5 px-1 py-0 text-[10px] shrink-0"
>
{m.restoring_status()}
<Loader2 className="h-2.5 w-2.5 animate-spin" />
<span>{m.archiving_status()}</span>
</Badge>
)}
</div>
@@ -189,8 +189,11 @@ export function MobileFileHeader({
)}
>
<span>v{v.version}</span>
<span className="text-[11px] text-muted-foreground truncate max-w-[120px]">
{v.name || fileName}
<span className="text-[11px] text-muted-foreground truncate max-w-[120px] flex items-center gap-1">
{(v.status === 'archived' || v.status === 'restoring') && (
<Archive className="h-2.5 w-2.5 shrink-0 text-muted-foreground" />
)}
<span className="truncate">{v.name || fileName}</span>
</span>
</DropdownMenuItem>
))}
@@ -85,7 +85,7 @@ function SortableVersionRow({
return (
<div
ref={ref}
className="group flex items-center gap-3 p-2.5 rounded-lg border border-border bg-card hover:bg-accent/40 transition-colors"
className="group flex items-center gap-3 p-2.5 rounded-lg border border-border bg-card hover:bg-accent/40 transition-colors w-full min-w-0 overflow-hidden"
>
{/* 1. Version Label */}
<div className="flex-shrink-0 flex items-center justify-center bg-muted text-muted-foreground rounded-full px-2.5 py-0.5 text-xs font-semibold select-none min-w-[2.25rem]">
@@ -96,12 +96,12 @@ function SortableVersionRow({
{canEdit ? (
<div
ref={handleRef}
className="cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground p-1 -m-1 rounded touch-none flex items-center justify-center"
className="cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground p-1 -m-1 rounded touch-none flex items-center justify-center flex-shrink-0"
>
<GripVertical className="h-4 w-4" />
</div>
) : (
<div className="w-4" />
<div className="w-4 flex-shrink-0" />
)}
{/* 3. Thumbnail Preview */}
@@ -118,22 +118,28 @@ function SortableVersionRow({
</div>
{/* 4. Name / Creator / Create Date (2 rows) */}
<div className="flex flex-col flex-1 min-w-0 text-left">
<div className="flex flex-col flex-1 min-w-0 text-left overflow-hidden">
{/* Row 1: Name */}
<div className="flex items-center gap-1.5 min-w-0">
<span className="truncate text-sm font-medium text-foreground" title={version.name || ''}>
<div className="flex items-center gap-1.5 min-w-0 w-full overflow-hidden">
{(version.status === 'archived' || version.status === 'restoring') && (
<span
data-testid={
version.status === 'restoring'
? 'version-row-restoring-badge'
: 'version-row-archived-badge'
}
title={version.status === 'restoring' ? m.restoring_status() : m.archived_status()}
className="inline-flex items-center shrink-0"
>
<Archive className="h-3.5 w-3.5 text-muted-foreground" />
</span>
)}
<span
className="truncate text-sm font-medium text-foreground min-w-0 flex-1 block"
title={version.name || ''}
>
{version.name || 'Untitled'}
</span>
{version.status === 'archived' && (
<Badge
variant="secondary"
data-testid="version-row-archived-badge"
className="gap-1 px-1.5 py-0 text-xs shrink-0"
>
<Archive className="h-3 w-3" />
<span>{m.archived_status()}</span>
</Badge>
)}
{version.status === 'archiving' && (
<Badge
variant="secondary"
@@ -144,21 +150,11 @@ function SortableVersionRow({
<span>{m.archiving_status()}</span>
</Badge>
)}
{version.status === 'restoring' && (
<Badge
variant="secondary"
data-testid="version-row-restoring-badge"
className="gap-1 px-1.5 py-0 text-xs shrink-0"
>
<Loader2 className="h-3 w-3 animate-spin" />
<span>{m.restoring_status()}</span>
</Badge>
)}
</div>
{/* Row 2: Creator & Create Date */}
<div className="flex items-center gap-1.5 text-xs text-muted-foreground truncate">
<div className="flex items-center gap-1.5 text-xs text-muted-foreground min-w-0 w-full overflow-hidden">
{version.agent ? (
<span className="flex items-center gap-1 truncate">
<span className="flex items-center gap-1 min-w-0 truncate">
<Bot className="h-3 w-3 shrink-0" />
<span className="truncate">
{m.user_via_agent({
@@ -168,12 +164,12 @@ function SortableVersionRow({
</span>
</span>
) : (
<span>{version.creator?.name || m.unknown()}</span>
<span className="truncate min-w-0">{version.creator?.name || m.unknown()}</span>
)}
{formattedDate && (
<>
<span>•</span>
<span>{formattedDate}</span>
<span className="shrink-0">•</span>
<span className="shrink-0">{formattedDate}</span>
</>
)}
</div>
@@ -415,12 +411,12 @@ export function ManageVersionsDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-lg p-0 gap-0 overflow-hidden">
<DialogHeader className="p-4 pb-3 border-b border-border">
<DialogContent className="max-w-lg p-0 gap-0 overflow-hidden grid-cols-1">
<DialogHeader className="p-4 pb-3 border-b border-border min-w-0">
<DialogTitle className="text-base font-semibold">{m.manage_versions_title()}</DialogTitle>
</DialogHeader>
<ScrollArea className="max-h-[60vh] p-4">
<ScrollArea className="max-h-[60vh] p-4 w-full min-w-0 [&>div>div]:!block">
{isLoading ? (
<div className="py-8 text-center text-sm text-muted-foreground">
{m.loading?.() || 'Loading...'}
@@ -430,7 +426,7 @@ export function ManageVersionsDialog({
{m.no_versions_found()}
</div>
) : (
<div className="space-y-2">
<div className="space-y-2 w-full min-w-0">
<DragDropProvider
sensors={[
PointerSensor.configure({