diff --git a/apps/website/e2e/workshop-apps.spec.ts b/apps/website/e2e/workshop-apps.spec.ts index 3058e907a19..647356f1a73 100644 --- a/apps/website/e2e/workshop-apps.spec.ts +++ b/apps/website/e2e/workshop-apps.spec.ts @@ -324,5 +324,49 @@ test('makes a Cinematic Studio grade palette from an uploaded image', async ({ 'Your palette' ) await page.getByRole('button', { name: 'Edit palette' }).click() - await expect(page.getByLabel(/^Color 1: #/)).toBeVisible() + await page.getByLabel(/^Color 1: #/).click() + const hex = page.getByRole('textbox', { name: 'Hex color' }) + await hex.fill('#3b1b6e') + await hex.press('Enter') + await expect(page.getByLabel('Color 1: #3b1b6e')).toBeVisible() + await expect(page.getByRole('button', { name: /^Grade/ })).toContainText( + 'Your palette' + ) +}) + +test('offers the starting frame beside the Cinematic Studio scene in video mode', async ({ + page, + context +}) => { + await mockFlags(context, { apps: true, workflows: false }) + await page.goto('/hub/apps/cinematic-studio/') + + await page.getByRole('button', { name: 'Video', exact: true }).click() + + await expect( + page.getByRole('button', { name: 'Add a starting frame' }) + ).toBeVisible() + await expect(page.getByRole('heading', { name: 'References' })).toHaveCount(0) +}) + +test('@mobile keeps the Cinematic Studio camera badges to one line and the camera sheet steady across tabs', async ({ + page, + context +}) => { + await mockFlags(context, { apps: true, workflows: false }) + await page.goto('/hub/apps/cinematic-studio/') + + const specs = page.getByTestId('camera-specs') + await expect(specs.getByText('+2', { exact: true })).toBeVisible() + await expect(specs.getByText('50mm', { exact: true })).toBeHidden() + expect((await specs.boundingBox())?.height).toBeLessThan(32) + + await page.getByRole('button', { name: /^Camera/ }).click() + const sheet = page.getByRole('dialog', { name: 'Camera' }) + const heights = [] + for (const tab of ['Body', 'Lens', 'Focal length', 'Aperture']) { + await sheet.getByRole('button', { name: tab, exact: true }).click() + heights.push((await sheet.boundingBox())?.height) + } + expect(new Set(heights).size).toBe(1) }) diff --git a/apps/website/src/components/ui/button/index.ts b/apps/website/src/components/ui/button/index.ts index 1dc0acdfe39..738395fb5f9 100644 --- a/apps/website/src/components/ui/button/index.ts +++ b/apps/website/src/components/ui/button/index.ts @@ -17,6 +17,8 @@ export const buttonVariants = cva( 'bg-primary-comfy-yellow text-primary-comfy-ink uppercase hover:bg-primary-comfy-yellow/90', outline: 'border text-primary-comfy-yellow uppercase hover:bg-primary-comfy-yellow hover:text-primary-comfy-ink', + ghost: + 'bg-transparency-white-t8 font-medium tracking-normal text-primary-warm-white hover:bg-transparency-white-t20', link: "h-auto justify-start px-0 py-1 text-base text-primary-comfy-yellow uppercase hover:opacity-90 [&_svg:not([class*='size-'])]:size-6", underlineLink: "relative h-auto justify-start px-0 py-1 text-primary-comfy-yellow uppercase after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-full after:origin-left after:scale-x-0 after:bg-current after:transition-transform after:duration-200 hover:opacity-90 hover:after:scale-x-100 [&_svg:not([class*='size-'])]:size-6", diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicColorPicker.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicColorPicker.vue new file mode 100644 index 00000000000..9d04615d781 --- /dev/null +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicColorPicker.vue @@ -0,0 +1,141 @@ + + + diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicColors.test.ts b/apps/website/src/components/workshop/cinematic-studio/CinematicColors.test.ts index 2bc25e771e8..5e32cd86655 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicColors.test.ts +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicColors.test.ts @@ -48,6 +48,40 @@ describe('CinematicColors', () => { expect(main.value).toBeUndefined() }) + it('edits the chosen swatch from the hex field', async () => { + const { colors, user } = renderColors(['#aa0000', '#00aa00']) + await user.click(screen.getByRole('button', { name: 'Color 2: #00aa00' })) + const hex = screen.getByRole('textbox', { name: 'Hex color' }) + await user.clear(hex) + await user.type(hex, '3b1b6e{Enter}') + expect(colors.value).toEqual(['#aa0000', '#3b1b6e']) + }) + + it('keeps the color when the hex field holds no color', async () => { + const { colors, user } = renderColors(['#aa0000']) + const hex = screen.getByRole('textbox', { name: 'Hex color' }) + await user.clear(hex) + await user.type(hex, 'nope{Enter}') + expect(colors.value).toEqual(['#aa0000']) + expect(hex).toHaveValue('#aa0000') + }) + + it('moves the shade square from the keyboard and reports its saturation', async () => { + const { colors, user } = renderColors(['#808080']) + const shade = screen.getByRole('slider', { + name: 'Saturation and brightness' + }) + expect(shade).toHaveAttribute('aria-valuemin', '0') + expect(shade).toHaveAttribute('aria-valuemax', '100') + expect(shade).toHaveAttribute('aria-valuenow', '0') + + shade.focus() + await user.keyboard('{ArrowRight}{ArrowRight}') + + expect(shade).toHaveAttribute('aria-valuenow', '4') + expect(colors.value[0]).not.toBe('#808080') + }) + it('clears every color', async () => { const { colors, main, user } = renderColors(['#aa0000'], 0) await user.click(screen.getByRole('button', { name: 'Clear colors' })) diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicColors.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicColors.vue index 9ee70c6d158..8bd4c1da8d1 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicColors.vue +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicColors.vue @@ -1,19 +1,20 @@ + + diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicPanel.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicPanel.vue index 8bfc460939f..798f8181283 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicPanel.vue +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicPanel.vue @@ -12,7 +12,6 @@ import type { import type { ShotEstimate } from '../../../lib/workshop/cinematic-studio/estimate' import type { StudioGate } from '../../../lib/workshop/cinematic-studio/gate' import type { Locale } from '../../../i18n/translations' -import { t } from '../../../i18n/translations' import { tc } from '../../../lib/workshop/cinematic-studio/copy' import type { CinematicModel } from '../../../lib/workshop/cinematic-studio/models' import { shotAspects } from '../../../lib/workshop/cinematic-studio/models' @@ -20,11 +19,10 @@ import type { CinematicVideoCapabilities } from '../../../lib/workshop/cinematic import { videoTags } from '../../../lib/workshop/cinematic-studio/video' import type { ShotBlock } from '../../../composables/useCinematicShot' import type { StudioImage } from '../../../lib/workshop/cinematic-studio/take-image' -import CinematicCharacterButton from './CinematicCharacterButton.vue' import CinematicGenerateAction from './CinematicGenerateAction.vue' import CinematicMenu from './CinematicMenu.vue' import CinematicOutputControls from './CinematicOutputControls.vue' -import CinematicReferenceSlot from './CinematicReferenceSlot.vue' +import CinematicReferenceButton from './CinematicReferenceButton.vue' import CinematicSceneField from './CinematicSceneField.vue' import CinematicShotList from './CinematicShotList.vue' import CinematicVideoControls from './CinematicVideoControls.vue' @@ -94,13 +92,13 @@ const model = computed(() => models.find((candidate) => candidate.slug === modelSlug.value) ) const slots = computed(() => referenceSlots(model.value, !!firstFrame.value)) +const files = { cast, firstFrame, lastFrame, video: sourceVideo } const blockedNote = computed(() => blocked ? tc(blocked.key, locale, { model: blocked.model }) : undefined ) const canGenerate = computed( () => gate === 'ready' && scene.value.trim().length > 0 && !blockedNote.value ) -const labelClass = 'text-xs font-medium text-primary-warm-gray' const cardClass = 'flex w-full items-center gap-3 rounded-2xl border border-transparency-white-t8 p-2.5 text-left transition-colors hover:border-transparency-white-t20' @@ -111,50 +109,50 @@ const cardClass = class="flex min-w-0 flex-col rounded-2xl border border-transparency-white-t8 bg-transparency-white-t4" >
- {{ t('workshop.input.title', locale) }} +

+ {{ tc('cinematic.panel.newShot', locale) }} +

+
-
-
-

- {{ tc('cinematic.model.heading', locale) }} -

- - - - {{ model?.name }} - - -
+
+ + + + {{ model?.name }} + + - +
+ +
-
-

- {{ tc('cinematic.section.shot', locale) }} -

+
-
-
-

- {{ tc('cinematic.section.references', locale) }} -

- - {{ tc('cinematic.reference.optional', locale) }} - -
-
- - - -
-
-
-

- {{ tc('cinematic.section.output', locale) }} -

+
-import { ref } from 'vue' +import { useMediaQuery } from '@vueuse/core' import type { Direction, @@ -7,12 +7,10 @@ import type { DirectionPart } from '../../../lib/workshop/cinematic-studio/catalog' import type { Locale } from '../../../i18n/translations' -import { tc } from '../../../lib/workshop/cinematic-studio/copy' -import CinematicColors from './CinematicColors.vue' import CinematicGradeImageTile from './CinematicGradeImageTile.vue' import CinematicOptionGrid from './CinematicOptionGrid.vue' -import CinematicOptionList from './CinematicOptionList.vue' -import CinematicPickerTabs from './CinematicPickerTabs.vue' +import CinematicPaletteEditor from './CinematicPaletteEditor.vue' +import CinematicPickerLists from './CinematicPickerLists.vue' import CinematicPopover from './CinematicPopover.vue' const { @@ -36,18 +34,25 @@ const colors = defineModel('colors', { required: true }) const mainColor = defineModel('mainColor') const multiple = groups.length > 1 -const activePart = ref(groups[0].part) -const editing = ref(false) +const editing = defineModel('editing', { default: false }) function choose(part: DirectionPart, id: string) { if (part === 'grade') { colors.value = [] mainColor.value = undefined + editing.value = false } emit('choose', part, id) if (!multiple) emit('close') } +const sideBySide = useMediaQuery('(min-width: 1024px)') + +function finishEditing() { + editing.value = false + if (!sideBySide.value) emit('close') +} + function usePalette(sampled: readonly string[]) { colors.value = sampled mainColor.value = undefined @@ -60,34 +65,13 @@ const selectedIn = (part: DirectionPart) =>