Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions apps/website/e2e/workshop-apps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,18 +331,31 @@ signedInTest(
}
)

test('keeps the Re-shoot camera help behind info buttons', async ({
signedInTest(
'keeps the Re-shoot camera help behind info buttons',
async ({ page, context, modelsAccount }) => {
await openReadReshootScene(page, context, modelsAccount)

const help = 'Distance is approximate; angles give the most control.'
await expect(page.getByText(help)).toBeHidden()
await page.getByRole('button', { name: help }).hover()
await expect(page.getByText(help).first()).toBeVisible()
}
)

test('holds the Re-shoot camera controls until the depth is read', async ({
page,
context
}) => {
await mockFlags(context, { apps: true, workflows: false })
await page.goto('/hub/apps/reshoot/')
await page.getByText('Sci-fi pilot').first().click()

const help = 'Distance is approximate; angles give the most control.'
await expect(page.getByText(help)).toBeHidden()
await page.getByRole('button', { name: help }).hover()
await expect(page.getByText(help).first()).toBeVisible()
await expect(page.getByTestId('reshoot-depth-step')).toBeVisible()
await expect(page.getByRole('slider', { name: 'Rotation' })).toBeHidden()
await expect(page.getByTestId('reshoot-frame-label')).toHaveText(
/Original clip\s*· Nothing generated yet/
)
})

test('shows a preview frame for every Cinematic Studio shot option', async ({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<script setup lang="ts">
import { translationsFor } from '@/i18n/translations'
import { computed } from 'vue'

import { cn } from '@comfyorg/tailwind-utils'

import type { DepthState } from '@/composables/useReshoot'
import type {
CameraKey,
ReshootCamera
} from '@/lib/workshop/cinematic-studio/reshoot'
import type { Locale } from '@/i18n/translations'
import ReshootAimPending from './ReshootAimPending.vue'
import ReshootAimRig from './ReshootAimRig.vue'
import ReshootDisclosure from './ReshootDisclosure.vue'
import ReshootMoveControls from './ReshootMoveControls.vue'

const {
clip,
camera,
keys,
depth,
reason,
locale = 'en'
} = defineProps<{
clip: string
camera: Readonly<ReshootCamera>
keys: readonly CameraKey[]
depth: DepthState
/** Why the depth is not ready, when it failed or never started. */
reason?: string
locale?: Locale
}>()
const { t } = translationsFor(locale)

const emit = defineEmits<{
aim: [patch: Partial<ReshootCamera>]
removeKey: [frame: number]
analyze: []
}>()

const keepAim = defineModel<boolean>('keepAim', { required: true })
const frame = defineModel<number>('frame', { required: true })

const pending = computed(() => (depth === 'ready' ? undefined : depth))
</script>

<template>
<div class="grid">
<div
:class="
cn(
'col-start-1 row-start-1 flex flex-col gap-2 transition-[opacity,visibility] motion-safe:duration-300',
pending && 'invisible opacity-0'
)
"
:inert="!!pending"
data-testid="reshoot-aim-controls"
>
<ReshootAimRig
v-model:keep-aim="keepAim"
:clip
:camera
:locale
@aim="emit('aim', $event)"
/>
<ReshootDisclosure :label="t('reshoot.section.move')">
<ReshootMoveControls
v-model:frame="frame"
:keys
:locale
@remove="emit('removeKey', $event)"
/>
</ReshootDisclosure>
</div>
<ReshootAimPending
v-if="pending"
:depth="pending"
:reason
:locale
class="col-start-1 row-start-1 self-start"
@retry="emit('analyze')"
/>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<script setup lang="ts">
import { translationsFor } from '@/i18n/translations'
import {
CircleAlert,
CircleCheck,
CircleDashed,
CirclePause,
LoaderCircle
} from '@lucide/vue'
import { computed } from 'vue'

import { cn } from '@comfyorg/tailwind-utils'

import Button from '@/components/ui/button/Button.vue'
import type { DepthState } from '@/composables/useReshoot'
import type { Locale } from '@/i18n/translations'

const {
depth,
reason,
locale = 'en'
} = defineProps<{
depth: Exclude<DepthState, 'ready'>
/** Why the depth is not being read: a failure, or what stops it starting. */
reason?: string
locale?: Locale
}>()
const { t } = translationsFor(locale)

const emit = defineEmits<{ retry: [] }>()

const depthStep = computed(() => {
if (depth === 'analyzing')
return {
icon: LoaderCircle,
title: t('reshoot.pending.depth'),
detail: t('reshoot.pending.depthTime'),
iconClass: 'text-primary-comfy-yellow motion-safe:animate-spin'
}
if (depth === 'failed')
return {
icon: CircleAlert,
title: t('reshoot.pending.depthFailed'),
detail: reason,
iconClass: 'text-primary-warm-white'
}
return {
icon: CirclePause,
title: t('reshoot.pending.depthWaiting'),
detail: reason,
iconClass: 'text-primary-warm-gray'
}
})
</script>

<template>
<ol
class="flex flex-col gap-4 rounded-2xl border border-dashed border-transparency-white-t8 p-4"
data-testid="reshoot-aim-pending"
>
<li class="flex gap-3">
<CircleCheck
class="mt-0.5 size-4 shrink-0 text-primary-comfy-yellow"
aria-hidden="true"
/>
<span class="text-sm text-primary-comfy-canvas">
{{ t('reshoot.pending.clip') }}
</span>
</li>
<li
class="flex gap-3"
:role="depth === 'failed' ? 'alert' : 'status'"
data-testid="reshoot-depth-step"
>
<component
:is="depthStep.icon"
:class="cn('mt-0.5 size-4 shrink-0', depthStep.iconClass)"
aria-hidden="true"
/>
<span class="flex min-w-0 flex-col gap-1">
<span class="text-sm font-semibold text-primary-warm-white">
{{ depthStep.title }}
</span>
<span
v-if="depthStep.detail"
class="text-xs/relaxed wrap-break-word text-primary-warm-gray"
>
{{ depthStep.detail }}
</span>
<Button
v-if="depth === 'failed'"
size="sm"
variant="outline"
class="mt-1 self-start rounded-full"
data-testid="reshoot-analyze"
@click="emit('retry')"
>
{{ t('reshoot.tryAgain') }}
</Button>
</span>
</li>
<li class="flex gap-3">
<CircleDashed
class="mt-0.5 size-4 shrink-0 text-primary-warm-gray"
aria-hidden="true"
/>
<span class="flex flex-col gap-1">
<span class="text-sm text-primary-comfy-canvas">
{{ t('reshoot.pending.aim') }}
</span>
<span class="text-xs/relaxed text-primary-warm-gray">
{{ t('reshoot.pending.aimHint') }}
</span>
</span>
</li>
</ol>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@ const { t } = translationsFor(locale)

<template>
<header class="flex flex-col gap-3" data-testid="reshoot-hero">
<div class="flex flex-wrap items-center gap-3">
<h1
class="max-w-4xl text-3xl font-light text-primary-comfy-canvas lg:text-5xl"
>
{{ t('reshoot.title') }}
</h1>
<h1
class="max-w-4xl text-3xl font-light text-primary-comfy-canvas lg:text-5xl"
>
{{ t('reshoot.title') }}
</h1>
<div
class="flex flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between"
>
<div class="flex flex-col gap-3">
<p class="text-lg text-primary-warm-gray">
{{ t('reshoot.pick.lead') }}
</p>
<p class="text-xs text-primary-warm-gray/80">
{{ t('reshoot.credit') }}
</p>
</div>
<AppRepoLink
:repo="workshopAppRepo('reshoot')"
:app-slug="RESHOOT_APP_SLUG"
:locale
class="sm:ml-auto"
class="shrink-0"
/>
</div>
<p class="text-lg text-primary-warm-gray">
{{ t('reshoot.pick.lead') }}
</p>
<p class="text-xs text-primary-warm-gray/80">
{{ t('reshoot.credit') }}
</p>
</header>
</template>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from '@testing-library/vue'
import userEvent from '@testing-library/user-event'
import { describe, expect, it } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import { h, ref } from 'vue'

import {
Expand Down Expand Up @@ -107,4 +107,42 @@ describe('ReshootSide', () => {
})
).toBeInTheDocument()
})

function renderPending(extra: Record<string, unknown>) {
const analyze = vi.fn()
render({
setup: () => () =>
h(ReshootSide, {
...props,
...extra,
size: RESHOOT_SIZES[0],
onAnalyze: analyze
})
})
return analyze
}

it('says what failed in a depth read and offers to try again', async () => {
const analyze = renderPending({
depth: 'failed',
error: 'The deployment is not ready.'
})
const step = screen.getByTestId('reshoot-depth-step')

expect(step).toHaveTextContent(rc('reshoot.pending.depthFailed'))
expect(step).toHaveTextContent('The deployment is not ready.')
expect(screen.getByTestId('reshoot-aim-controls')).toHaveAttribute('inert')
await userEvent.click(screen.getByTestId('reshoot-analyze'))
expect(analyze).toHaveBeenCalledOnce()
})

it('says why a depth read has not started, without a retry', () => {
renderPending({ depth: 'none', blocked: rc('reshoot.signIn') })
const step = screen.getByTestId('reshoot-depth-step')

expect(step).toHaveTextContent(rc('reshoot.pending.depthWaiting'))
expect(step).toHaveTextContent(rc('reshoot.signIn'))
expect(screen.getByTestId('reshoot-aim-controls')).toHaveAttribute('inert')
expect(screen.queryByTestId('reshoot-analyze')).toBeNull()
})
})
Loading
Loading