Skip to content
Closed
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
18 changes: 18 additions & 0 deletions apps/website/e2e/workshop-apps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,21 @@ 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.describe('GitHub link before an app repo is published', () => {
for (const path of [
'/models/apps/cinematic-studio/',
'/models/apps/reshoot/'
])
test(`shows a placeholder, not a link, on ${path}`, async ({
page,
context
}) => {
await mockFlags(context, { apps: true, workflows: false })
await page.goto(path)
await expect(page.getByText('GitHub · Coming soon')).toHaveCount(1)
await expect(
page.getByRole('link', { name: 'View on GitHub' })
).toHaveCount(0)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { render, screen } from '@testing-library/vue'
import { describe, expect, it } from 'vitest'

import AppRepoLink from './AppRepoLink.vue'

describe('AppRepoLink', () => {
it('opens the app repository on GitHub in a new tab', () => {
render(AppRepoLink, {
props: { repo: 'https://github.com/Comfy-Org/comfy-examples' }
})

const link = screen.getByRole('link', { name: 'View on GitHub' })
expect(link).toHaveAttribute(
'href',
'https://github.com/Comfy-Org/comfy-examples'
)
expect(link).toHaveAttribute('target', '_blank')
expect(link).toHaveAttribute('rel', 'noopener noreferrer')
})

it('renders no link until the repository exists', () => {
render(AppRepoLink)

expect(screen.getByText(/GitHub/)).toBeInTheDocument()
expect(screen.queryByRole('link')).toBeNull()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script setup lang="ts">
import { ArrowUpRight } from '@lucide/vue'

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

import type { Locale } from '../../../i18n/translations'
import { tc } from '../../../lib/workshop/cinematic-studio/copy'

const { repo, locale = 'en' } = defineProps<{
repo?: string
locale?: Locale
}>()
</script>

<template>
<component
:is="repo ? 'a' : 'span'"
:href="repo"
:target="repo && '_blank'"
:rel="repo && 'noopener noreferrer'"
:class="
cn(
'inline-flex h-9 shrink-0 items-center gap-2 rounded-xl border px-3.5 text-sm font-medium',
repo
? 'border-transparency-white-t20 bg-transparency-white-t4 text-primary-warm-white transition hover:border-primary-comfy-yellow hover:text-primary-comfy-yellow focus-visible:ring-3 focus-visible:ring-primary-comfy-yellow/50 focus-visible:outline-none'
: 'border-transparency-white-t8 text-primary-warm-gray'
)
"
>
<span
class="size-4 icon-mask mask-[url('/icons/social/github.svg')]"
aria-hidden="true"
/>
{{ tc(repo ? 'cinematic.repo.view' : 'cinematic.repo.soon', locale) }}
<ArrowUpRight v-if="repo" class="size-3.5" aria-hidden="true" />
</component>
</template>
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script setup lang="ts">
import { workshopAppRepo } from '../../../lib/workshop/apps'
import type { StarterShot } from '../../../lib/workshop/cinematic-studio/starters'
import { STARTER_SHOTS } from '../../../lib/workshop/cinematic-studio/starters'
import type { Locale } from '../../../i18n/translations'
import { tc } from '../../../lib/workshop/cinematic-studio/copy'
import AppRepoLink from './AppRepoLink.vue'
import CinematicCheckBadge from './CinematicCheckBadge.vue'

const { selected, locale = 'en' } = defineProps<{
Expand All @@ -29,6 +31,7 @@ const emit = defineEmits<{ start: [shot: StarterShot] }>()
<p class="max-w-xl text-sm text-primary-comfy-canvas lg:text-base">
{{ tc('cinematic.firstRun.body', locale) }}
</p>
<AppRepoLink :repo="workshopAppRepo('studio')" :locale />
Comment thread
mariana953 marked this conversation as resolved.
Resolved
</div>
<ul class="grid w-full grid-cols-1 gap-4 sm:grid-cols-3 sm:gap-5">
<li v-for="shot in STARTER_SHOTS" :key="shot.id">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { useCinematicLeaveGuard } from '../../../composables/useCinematicLeaveGu
import { useCinematicPopover } from '../../../composables/useCinematicPopover'
import { useCinematicShot } from '../../../composables/useCinematicShot'
import { reportStudioBusy } from '../../../composables/useStudioSwitchGuard'
import { workshopAppRepo } from '../../../lib/workshop/apps'
import type { CinematicModel } from '../../../lib/workshop/cinematic-studio/models'
import type { Locale } from '../../../i18n/translations'
import { tc } from '../../../lib/workshop/cinematic-studio/copy'
import RunLeaveDialog from '../RunLeaveDialog.vue'
import AppRepoLink from './AppRepoLink.vue'
import AppsBackLink from './AppsBackLink.vue'
import CinematicPanel from './CinematicPanel.vue'
import CinematicPicker from './CinematicPicker.vue'
Expand Down Expand Up @@ -89,7 +91,7 @@ function generate() {
data-testid="cinematic"
>
<AppsBackLink :locale class="mb-3" />
<div class="mb-6 flex items-center gap-3">
<div class="mb-6 flex flex-wrap items-center gap-3">
<h1 class="text-2xl font-semibold text-primary-warm-white lg:text-3xl">
{{ tc('cinematic.title', locale) }}
</h1>
Expand All @@ -98,6 +100,11 @@ function generate() {
>
{{ tc('cinematic.beta', locale) }}
</span>
<AppRepoLink
:repo="workshopAppRepo('studio')"
:locale
class="sm:ml-auto"
/>
</div>
<div
ref="layout"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
<script setup lang="ts">
import { workshopAppRepo } from '../../../../lib/workshop/apps'
import { rc } from '../../../../lib/workshop/cinematic-studio/reshoot-copy'
import type { Locale } from '../../../../i18n/translations'
import AppRepoLink from '../AppRepoLink.vue'

const { locale = 'en' } = defineProps<{ locale?: Locale }>()
</script>

<template>
<header class="flex flex-col gap-3" data-testid="reshoot-hero">
<h1
class="max-w-4xl text-3xl font-light text-primary-comfy-canvas lg:text-5xl"
>
{{ rc('reshoot.title', locale) }}
</h1>
<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"
>
{{ rc('reshoot.title', locale) }}
</h1>
<AppRepoLink
:repo="workshopAppRepo('reshoot')"
:locale
class="sm:ml-auto"
/>
</div>
<p class="text-lg text-primary-warm-gray">
{{ rc('reshoot.pick.lead', locale) }}
</p>
Expand Down
6 changes: 6 additions & 0 deletions apps/website/src/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
normalizeRoute
} from './locales'
import type { Locale } from './locales'
import type { AppWorkshopModel } from './models-catalogue'

const baseRoutes = {
home: '/',
Expand Down Expand Up @@ -176,6 +177,10 @@ export function getRoutes(locale: Locale = DEFAULT_LOCALE): Routes {
) as Routes
}

const workshopAppRepos: Readonly<
Partial<Record<AppWorkshopModel['appId'], string>>
> = {}

export const externalLinks = {
affiliateApplicationForm: 'https://forms.gle/RS8L2ttcuGap4Q1v6',
apiKeys: 'https://platform.comfy.org/profile/api-keys',
Expand All @@ -193,6 +198,7 @@ export const externalLinks = {
docsApi: 'https://docs.comfy.org/development/cloud/overview#quick-start',
comfyCliRepo: 'https://github.com/Comfy-Org/comfy-cli',
comfyMcpRepo: 'https://github.com/Comfy-Org/comfy-mcp',
workshopAppRepos,
docsInAppAgent: 'https://docs.comfy.org/agent-tools/in-app-agent',
docsCli: 'https://docs.comfy.org/agent-tools/cli',
// Markdown variant handed to agents in the "ask your agent" cards, same
Expand Down
11 changes: 10 additions & 1 deletion apps/website/src/lib/workshop/apps.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'

import { appModels } from '../../config/workshop-app-content'
import { workshopAppHref, workshopApps } from './apps'
import { workshopAppHref, workshopAppRepo, workshopApps } from './apps'

describe('workshopAppHref', () => {
it.for([
Expand All @@ -20,3 +20,12 @@ describe('workshopAppHref', () => {
).toBe('/images/cinematic-studio/train.jpg')
})
})

describe('workshopAppRepo', () => {
it.for(['studio', 'reshoot'] as const)(
'has no repository for $0 until one is published',
(app) => {
expect(workshopAppRepo(app)).toBeUndefined()
}
)
})
7 changes: 6 additions & 1 deletion apps/website/src/lib/workshop/apps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AppWorkshopModel } from '../../config/models-catalogue'
import { getRoutes } from '../../config/routes'
import { externalLinks, getRoutes } from '../../config/routes'
import type { Locale } from '../../i18n/translations'
import type { CinematicCopyKey } from './cinematic-studio/copy'

Expand All @@ -10,6 +10,11 @@ export function workshopAppHref(app: WorkshopAppId, locale: Locale): string {
return app === 'reshoot' ? routes.reshoot : routes.cinematicStudio
}

/** The app's open-source repository, once it is published. */
export function workshopAppRepo(app: WorkshopAppId): string | undefined {
return externalLinks.workshopAppRepos[app]
}

export interface WorkshopAppCard {
readonly key: string
readonly name: CinematicCopyKey
Expand Down
8 changes: 8 additions & 0 deletions apps/website/src/lib/workshop/cinematic-studio/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ const copy = {
en: 'Beta',
'zh-CN': '测试版'
},
'cinematic.repo.view': {
en: 'View on GitHub',
'zh-CN': '在 GitHub 上查看'
},
'cinematic.repo.soon': {
en: 'GitHub · Coming soon',
'zh-CN': 'GitHub · 即将推出'
},
'cinematic.meta.description': {
en: 'Direct cinematic stills: pick the camera, shot, light, film and grade, then run any image model through the Comfy Router.',
'zh-CN':
Expand Down
Loading