diff --git a/apps/website/e2e/workshop-api-actions.spec.ts b/apps/website/e2e/workshop-api-actions.spec.ts index de1efbdf88e..d28795b1419 100644 --- a/apps/website/e2e/workshop-api-actions.spec.ts +++ b/apps/website/e2e/workshop-api-actions.spec.ts @@ -75,3 +75,43 @@ test('the workflow API tab opens with the key action and what it needs beside th expect(action.y).toBeLessThanOrEqual(code.y) expect(action.x).toBeGreaterThanOrEqual(code.x + code.width) }) + +test('@mobile the workflow example output is as tall as its 16:9 media', async ({ + page, + context +}) => { + await allowWorkflows(context) + await page.goto(WORKFLOW_PATH) + + const output = page.getByTestId('playground-output') + await expect(output).toHaveAttribute('data-state', 'example') + const media = await frame(output.getByTestId('output-media')) + expect(media.height).toBeCloseTo((media.width * 9) / 16, 0) +}) + +test('@mobile opens a source picture full screen with its close button clear of it', async ({ + page, + context +}) => { + await allowWorkflows(context) + await page.goto(WORKFLOW_PATH) + await page + .locator('input[type=file]') + .first() + .setInputFiles('public/images/cinematic-studio/diner.jpg') + await page + .getByRole('button', { name: /^Expand / }) + .first() + .click() + + const dialog = page.getByTestId('image-source-dialog') + const viewportWidth = page.viewportSize()?.width ?? 0 + await expect + .poll(async () => (await frame(dialog)).width) + .toBeGreaterThan(viewportWidth - 2) + const [close, picture] = await Promise.all([ + frame(dialog.getByRole('button', { name: 'Close' })), + frame(dialog.getByRole('img')) + ]) + expect(close.y + close.height).toBeLessThanOrEqual(picture.y) +}) diff --git a/apps/website/e2e/workshop-apps.spec.ts b/apps/website/e2e/workshop-apps.spec.ts index 73be193df75..adc187b0cda 100644 --- a/apps/website/e2e/workshop-apps.spec.ts +++ b/apps/website/e2e/workshop-apps.spec.ts @@ -73,3 +73,48 @@ test('sends the old studio address to the app page it named', async ({ await page.goto('/cinematic-studio/?app=reshoot&ux=d&model=flux') await expect(page).toHaveURL(/\/models\/apps\/reshoot\/\?ux=d&model=flux$/) }) + +test('@mobile keeps the Re-shoot aim badges to one line on a phone', async ({ + page, + context +}) => { + await mockFlags(context, { apps: true, workflows: false }) + await page.goto('/models/apps/reshoot/') + await page.getByText('Sci-fi pilot').first().click() + + const viewport = page.getByTestId('reshoot-viewport').first() + await expect( + viewport.getByText('Drag to orbit', { exact: true }) + ).toBeVisible() + await expect(viewport.getByText(/Scroll to move closer/)).toBeHidden() + + for (const badge of [ + viewport.getByTestId('reshoot-drag-hint'), + viewport.getByTestId('reshoot-angle-readout') + ]) { + const box = await badge.boundingBox() + expect(box?.height).toBeLessThan(40) + } +}) + +test('@mobile pins the Re-shoot preview while the camera controls scroll under it', async ({ + page, + context +}) => { + await mockFlags(context, { apps: true, workflows: false }) + await page.goto('/models/apps/reshoot/') + await page.getByText('Sci-fi pilot').first().click() + + const frame = page.getByTestId('reshoot-frame') + const distance = page.getByRole('slider', { name: /Distance/ }) + await page.getByTestId('reshoot-action').scrollIntoViewIfNeeded() + const pinned = await frame.boundingBox() + expect(pinned?.y).toBeGreaterThanOrEqual(0) + expect(pinned?.y).toBeLessThan(120) + + const before = Number(await distance.inputValue()) + await page.getByRole('button', { name: 'Move the camera closer' }).tap() + await expect + .poll(async () => Number(await distance.inputValue())) + .toBeLessThan(before) +}) diff --git a/apps/website/e2e/workshop-workflows.spec.ts b/apps/website/e2e/workshop-workflows.spec.ts index 15a935092b8..a358c034202 100644 --- a/apps/website/e2e/workshop-workflows.spec.ts +++ b/apps/website/e2e/workshop-workflows.spec.ts @@ -513,3 +513,40 @@ test('keeps the workflow form inside a phone screen @mobile', async ({ const box = await footer.boundingBox() expect((box?.x ?? 0) + (box?.width ?? 0)).toBeLessThanOrEqual(viewportWidth) }) + +test('@mobile keeps the catalogue tabs in place when a tab changes the hero subtitle', async ({ + page, + context +}) => { + await mockWorkflowVisibility(context, true) + await page.goto('/models/') + const models = page.getByTestId('catalogue-tab-models') + const workflows = page.getByTestId('catalogue-tab-workflows') + await expect(workflows).toBeVisible() + const before = await workflows.boundingBox() + + await workflows.click() + await expect(workflows).toHaveAttribute('aria-pressed', 'true') + expect((await workflows.boundingBox())?.y).toBeCloseTo(before?.y ?? 0, 0) + + await models.click() + await expect(models).toHaveAttribute('aria-pressed', 'true') + expect((await models.boundingBox())?.y).toBeCloseTo(before?.y ?? 0, 0) +}) + +test('@mobile stretches the catalogue tabs across the toolbar on a phone', async ({ + page, + context +}) => { + await mockWorkflowVisibility(context, true) + await page.goto('/models/') + const toolbar = page.getByTestId('workshop-toolbar') + const tabs = toolbar.getByTestId('catalogue-tabs') + await expect(tabs).toBeVisible() + + const [bar, group] = await Promise.all([ + toolbar.boundingBox(), + tabs.boundingBox() + ]) + expect(Math.abs((bar?.width ?? 0) - (group?.width ?? 0))).toBeLessThan(12) +}) diff --git a/apps/website/src/components/workshop/CatalogueTabs.vue b/apps/website/src/components/workshop/CatalogueTabs.vue index 1bcf39b1cf4..c03a200ad62 100644 --- a/apps/website/src/components/workshop/CatalogueTabs.vue +++ b/apps/website/src/components/workshop/CatalogueTabs.vue @@ -43,7 +43,7 @@ const columns = computed(() =>
{ ) }) + it('closes when the reader taps the space around the picture', async () => { + const user = userEvent.setup() + render(ImageSourcePreview, { + props: { name: 'Source image', src: 'https://example.com/image.png' } + }) + await user.click( + screen.getByRole('button', { name: 'Expand Source image' }) + ) + + await user.click(await screen.findByTestId('image-source-dialog')) + + await waitFor(() => + expect(screen.queryByTestId('image-source-dialog')).toBeNull() + ) + }) + it('does not emit a server-owned Blob URL into the page HTML', async () => { const create = vi.spyOn(URL, 'createObjectURL') const html = await renderToString( diff --git a/apps/website/src/components/workshop/ImageSourcePreview.vue b/apps/website/src/components/workshop/ImageSourcePreview.vue index 01a3cd28a0a..3bbcf8bfaad 100644 --- a/apps/website/src/components/workshop/ImageSourcePreview.vue +++ b/apps/website/src/components/workshop/ImageSourcePreview.vue @@ -6,9 +6,9 @@ import type { SourcePreviewProps } from '../../composables/useSourceUrl' import { useSourceUrl } from '../../composables/useSourceUrl' import { t } from '../../i18n/translations' import Dialog from '../ui/dialog/Dialog.vue' -import DialogContent from '../ui/dialog/DialogContent.vue' import DialogTitle from '../ui/dialog/DialogTitle.vue' import DialogTrigger from '../ui/dialog/DialogTrigger.vue' +import SourceLightbox from './SourceLightbox.vue' const { file, src, name, locale = 'en' } = defineProps() @@ -44,11 +44,10 @@ const expandLabel = computed( - {{ name }} - + ({ }) describe('PlaygroundOutput', () => { + it('reserves a minimum height only until there is media to size the panel', async () => { + const { rerender } = render(PlaygroundOutput, { + props: { + modelName: 'Workflow', + now: 3000, + state: { status: 'running', startedAt: 1000, label: 'Queued' } + } + }) + const panel = screen.getByTestId('playground-output') + expect(panel).toHaveClass('min-h-96') + + await rerender({ state: succeeded(output('latest')) }) + expect(panel).not.toHaveClass('min-h-96') + }) + it('uses a signed download without buffering media and refreshes an expired link', async () => { const user = userEvent.setup() const media = { diff --git a/apps/website/src/components/workshop/PlaygroundOutput.vue b/apps/website/src/components/workshop/PlaygroundOutput.vue index 54f7d170479..e53624213e4 100644 --- a/apps/website/src/components/workshop/PlaygroundOutput.vue +++ b/apps/website/src/components/workshop/PlaygroundOutput.vue @@ -290,7 +290,12 @@ const earlierClass = (active: boolean) => diff --git a/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStage.vue b/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStage.vue index f1b42ef32ef..28362909441 100644 --- a/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStage.vue +++ b/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStage.vue @@ -63,13 +63,16 @@ const fileName = computed( diff --git a/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStudio.vue b/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStudio.vue index 9443634f3df..9987ec3c0c4 100644 --- a/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStudio.vue +++ b/apps/website/src/components/workshop/cinematic-studio/reshoot/ReshootStudio.vue @@ -45,7 +45,7 @@ const {
-import { LoaderCircle, Move3d } from '@lucide/vue' +import { LoaderCircle, Minus, Move3d, Plus } from '@lucide/vue' import { computed, ref } from 'vue' import { cn } from '@comfyorg/tailwind-utils' @@ -70,12 +70,21 @@ function drag(event: PointerEvent) { }) } +function dolly(step: number) { + const next = camera.distance + step * 0.05 + emit('aim', { distance: Number(clampAxis('distance', next).toFixed(2)) }) +} + function zoom(event: WheelEvent) { if (!ready.value) return event.preventDefault() - const next = camera.distance + Math.sign(event.deltaY) * 0.05 - emit('aim', { distance: Number(clampAxis('distance', next).toFixed(2)) }) + dolly(Math.sign(event.deltaY)) } + +const DOLLY_BUTTONS = [ + { step: -1, label: 'reshoot.dolly.in', icon: Plus }, + { step: 1, label: 'reshoot.dolly.out', icon: Minus } +] as const diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts b/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts index 7670429244d..13ef6adb1a6 100644 --- a/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts +++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts @@ -98,6 +98,8 @@ const copy = { 'reshoot.nudge.down': { en: 'Camera lower', 'zh-CN': '机位降低' }, 'reshoot.nudge.left': { en: 'Camera left', 'zh-CN': '机位向左' }, 'reshoot.nudge.right': { en: 'Camera right', 'zh-CN': '机位向右' }, + 'reshoot.dolly.in': { en: 'Move the camera closer', 'zh-CN': '机位靠近' }, + 'reshoot.dolly.out': { en: 'Move the camera away', 'zh-CN': '机位远离' }, 'reshoot.advanced': { en: 'Advanced', 'zh-CN': '高级' }, 'reshoot.advanced.value': { en: 'Prompt, dialogue, seed', @@ -120,8 +122,8 @@ const copy = { 'zh-CN': '闲置一段时间后的首次运行还需要加载模型。' }, 'reshoot.take.exampleHelp': { - en: 'Example result: the clip re-shot from a new angle at 768p. Aim a camera of your own on the left.', - 'zh-CN': '示例结果:该片段以 768p 从新角度重拍。在左侧设置你自己的机位。' + en: 'Example result: the clip re-shot from a new angle at 768p. Aim a camera of your own to try it.', + 'zh-CN': '示例结果:该片段以 768p 从新角度重拍。设置你自己的机位试试。' }, 'reshoot.frames': { en: '{frames} frames at 24 fps ({seconds} s)', @@ -191,6 +193,7 @@ const copy = { en: 'Drag to orbit · Scroll to move closer', 'zh-CN': '拖动以环绕 · 滚动以靠近' }, + 'reshoot.dragHint.touch': { en: 'Drag to orbit', 'zh-CN': '拖动以环绕' }, 'reshoot.needsDepth': { en: 'Analyze depth to aim a new camera.', 'zh-CN': '分析深度后即可设置新机位。' @@ -245,8 +248,8 @@ const copy = { 'reshoot.take.cancelled': { en: 'Cancelled', 'zh-CN': '已取消' }, 'reshoot.download': { en: 'Download', 'zh-CN': '下载' }, 'reshoot.demoNote': { - en: 'Design prototype: no jobs run. Takes show the example result.', - 'zh-CN': '设计原型:不会运行任务,镜头显示示例结果。' + en: 'Preview: takes play the example result for now.', + 'zh-CN': '预览版:目前镜头播放示例结果。' } } as const satisfies Record