diff --git a/apps/website/src/components/workshop/ModelDetail.vue b/apps/website/src/components/workshop/ModelDetail.vue index ba990a655e2..4402efd7476 100644 --- a/apps/website/src/components/workshop/ModelDetail.vue +++ b/apps/website/src/components/workshop/ModelDetail.vue @@ -21,6 +21,7 @@ import { sameFormValues } from '../../lib/workshop/form-values' import { validateWorkshopMediaInputs } from '../../config/workshop-media-validation' import { leaveForSignIn } from '../../config/workshop-return' import { useSignInHref } from '../../composables/useSignInHref' +import { usePersonalWorkspaceSwitch } from '../../composables/usePersonalWorkspaceSwitch' import { useTablist } from '../../composables/useTablist' import type { WorkshopModelDetail } from '../../config/models-catalogue' import type { @@ -225,7 +226,7 @@ const attachments = computed(() => ) const revealed = ref(false) -const { user, session, sessionFailure, settled, ensureFresh, remint } = +const { user, session, sessionFailure, settled, ensureFresh } = useWorkshopSession() const { balance } = useWorkshopCredits() const workshopEnabled = useWorkshopEnabled() @@ -530,25 +531,11 @@ async function historyToken(): Promise { return result.session.token } -const personalSwitchPending = ref(false) -const personalSwitchError = ref(false) - -async function switchToPersonal() { - if (personalSwitchPending.value) return - personalSwitchPending.value = true - personalSwitchError.value = false - try { - const result = await remint(undefined, { - preserveCredentialOnTransientFailure: true - }) - if (result?.status === 'ok') await refreshWorkshopCredits({ force: true }) - else if (result?.status === 'error') personalSwitchError.value = true - } catch { - personalSwitchError.value = true - } finally { - personalSwitchPending.value = false - } -} +const { + pending: personalSwitchPending, + failed: personalSwitchError, + switchToPersonal +} = usePersonalWorkspaceSwitch() onUnmounted(() => { cancelRun() diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicComposer.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicComposer.vue index 986f666ab3a..92f687fcaa6 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicComposer.vue +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicComposer.vue @@ -12,6 +12,7 @@ import type { Resolution } from '../../../lib/workshop/cinematic-studio/catalog' import { directionOption } from '../../../lib/workshop/cinematic-studio/catalog' +import type { ShotEstimate } from '../../../lib/workshop/cinematic-studio/estimate' import type { StudioGate } from '../../../lib/workshop/cinematic-studio/gate' import type { CinematicModel } from '../../../lib/workshop/cinematic-studio/models' import type { Locale } from '../../../i18n/translations' @@ -28,11 +29,12 @@ const { direction, aspect, resolution, - takes, references, gate, workspaceName, rendering, + estimate, + credits, openPopover, locale = 'en' } = defineProps<{ @@ -40,11 +42,12 @@ const { direction: Direction aspect: AspectRatio resolution: Resolution - takes: number references: readonly File[] gate: StudioGate workspaceName?: string rendering: boolean + estimate?: ShotEstimate + credits?: number openPopover?: PopoverKey locale?: Locale }>() @@ -57,6 +60,7 @@ const emit = defineEmits<{ const scene = defineModel('scene', { required: true }) const modelSlug = defineModel('model', { required: true }) +const takes = defineModel('takes', { required: true }) const modelOptions = computed(() => models.map((model) => ({ @@ -227,10 +231,13 @@ const chipClass = (key: PopoverKey) => :rendering :can-generate="canGenerate" :blocked-note="blockedNote" + :estimate + :credits :locale class="ml-auto" @generate="emit('generate')" @cancel="emit('cancel')" + @reduce-takes="takes = $event" /> diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicCostLabel.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicCostLabel.vue new file mode 100644 index 00000000000..e97170c818f --- /dev/null +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicCostLabel.vue @@ -0,0 +1,57 @@ + + + diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicCreditAction.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicCreditAction.vue new file mode 100644 index 00000000000..36bd518ed6b --- /dev/null +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicCreditAction.vue @@ -0,0 +1,89 @@ + + + diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicCreditSummary.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicCreditSummary.vue new file mode 100644 index 00000000000..f31d645a952 --- /dev/null +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicCreditSummary.vue @@ -0,0 +1,57 @@ + + + diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicGateButton.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicGateButton.vue new file mode 100644 index 00000000000..45aa69e4602 --- /dev/null +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicGateButton.vue @@ -0,0 +1,137 @@ + + + diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicGenerateAction.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicGenerateAction.vue index 2b034f4b88c..ce8d92b828d 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicGenerateAction.vue +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicGenerateAction.vue @@ -1,23 +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 9ead15825f4..123a2eefbcd 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicPanel.vue +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicPanel.vue @@ -13,6 +13,7 @@ import { cameraGroups, directionOption } from '../../../lib/workshop/cinematic-studio/catalog' +import type { ShotEstimate } from '../../../lib/workshop/cinematic-studio/estimate' import type { StudioGate } from '../../../lib/workshop/cinematic-studio/gate' import type { PromptSegment } from '../../../lib/workshop/cinematic-studio/prompt' import type { Locale } from '../../../i18n/translations' @@ -34,6 +35,8 @@ const { gate, workspaceName, rendering, + estimate, + credits, openPicker, locale = 'en' } = defineProps<{ @@ -42,6 +45,8 @@ const { gate: StudioGate workspaceName?: string rendering: boolean + estimate?: ShotEstimate + credits?: number openPicker?: PickerKey locale?: Locale }>() @@ -242,10 +247,13 @@ const cardClass = :rendering :can-generate="canGenerate" :blocked-note="blockedNote" + :estimate + :credits wide :locale @generate="emit('generate')" @cancel="emit('cancel')" + @reduce-takes="takes = $event" /> diff --git a/apps/website/src/components/workshop/cinematic-studio/CinematicSequence.vue b/apps/website/src/components/workshop/cinematic-studio/CinematicSequence.vue index 98d97736328..c7b9d2aa81b 100644 --- a/apps/website/src/components/workshop/cinematic-studio/CinematicSequence.vue +++ b/apps/website/src/components/workshop/cinematic-studio/CinematicSequence.vue @@ -1,9 +1,21 @@