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
9 changes: 5 additions & 4 deletions apps/website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ as the application's `src/locales/` at the repository root:
`t('workshop.search.show', { n }, { locale })`.
- Plural forms separated by `|`: `"{count} node | {count} nodes"`, picked with
`t('cloudNodesLaunch.models.nodeCount', { count }, { locale, plural: count })`.
- Styled words inside a sentence are a named placeholder, never a message
split around them: `"Built for {highlight} who need quality."`, rendered with
`<I18nT keypath="…" :i18n="translationsFor(locale)">` and a `#highlight`
slot, so each locale decides where the styled word sits.
- Styled words or links inside a sentence are a named placeholder, never a
message split around them: `"Built for {highlight} who need quality."` or
`"Start from {link} or build your own."`, rendered with
`<I18nT keypath="…" :i18n="translationsFor(locale)">` and a `#highlight` or
`#link` slot, so each locale decides where the styled word or link sits.
- The characters `{`, `}`, `@` and `|` are message syntax, so literal ones are
written as `{'{'}`, `{'}'}`, `{'@'}` and `{'|'}`.

Expand Down
6 changes: 5 additions & 1 deletion apps/website/e2e/affiliates.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const APPLY_URL = 'https://forms.gle/RS8L2ttcuGap4Q1v6'
const TERMS_PATH = '/affiliates/terms/'
const FAQ_COUNT = affiliateFaqs.length
const FIRST_FAQ = affiliateFaqs[0]
const HERO_HEADING_TEXT = `${t('affiliate.hero.headingHighlight', {}, { locale: 'en' })} ${t('affiliate.hero.headingMuted', {}, { locale: 'en' })}`
const HERO_HEADING_TEXT = t(
'affiliate.hero.headline',
{ highlight: t('affiliate.hero.headingHighlight', {}, { locale: 'en' }) },
{ locale: 'en' }
)
const CTA_HEADING_TEXT = t('affiliate.cta.heading', {}, { locale: 'en' })
const CTA_APPLY_LABEL = t('affiliate.cta.apply', {}, { locale: 'en' })
const CTA_TERMS_LABEL = t('affiliate.cta.termsLabel', {}, { locale: 'en' })
Expand Down
11 changes: 9 additions & 2 deletions apps/website/src/components/auth/AuthSignIn.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, waitFor } from '@testing-library/vue'
import { render, screen, waitFor, within } from '@testing-library/vue'
import userEvent from '@testing-library/user-event'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { computed, readonly, ref } from 'vue'
Expand Down Expand Up @@ -41,6 +41,7 @@ import {
useWorkshopAuthFlag,
useWorkshopTurnstileMode
} from '@/scripts/posthog'
import { wholeText } from '@/test/wholeText'
import AuthSignIn from './AuthSignIn.vue'
import AuthToast from './AuthToast.vue'

Expand Down Expand Up @@ -737,7 +738,13 @@ describe('AuthSignIn', () => {
it('advertises the free runs on the login page, as the cloud app does', () => {
render(AuthSignIn)

expect(screen.getByText('to get 5 free runs.')).toBeTruthy()
const prompt = screen.getByText(
wholeText('New to Comfy? Sign up here to get 5 free runs.'),
{ selector: 'p' }
)
expect(
within(prompt).getByRole('link', { name: 'Sign up here' })
).toBeInTheDocument()
})

it('holds the form until Firebase has settled, then shows it to a signed-out visitor', async () => {
Expand Down
33 changes: 20 additions & 13 deletions apps/website/src/components/auth/AuthSignInPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import type { Locale } from '@/i18n/translations'
import { translationsFor } from '@/i18n/translations'
import { I18nT } from 'vue-i18n'
import AuthEmailForm from './AuthEmailForm.vue'
import AuthFlagTimeout from './AuthFlagTimeout.vue'
import AuthSpinnerIcon from './AuthSpinnerIcon.vue'
Expand Down Expand Up @@ -58,7 +59,7 @@
</script>

<template>
<section v-if="formVisible" class="flex w-full flex-col" :aria-busy="busy">

Check failure on line 62 in apps/website/src/components/auth/AuthSignInPanel.vue

View workflow job for this annotation

GitHub Actions / fallow / fallow

High complexity (critical)

Function '<template>' exceeds both complexity thresholds: • Severity: critical • Cyclomatic: 26 (threshold: 20) • Cognitive: 52 (threshold: 15) • Lines: 248 Consider splitting this function into smaller, focused functions.
<h1
class="mt-8 mb-0 text-2xl/snug font-light tracking-tighter text-primary-comfy-canvas sm:text-3xl/snug lg:text-4xl/snug xl:text-5xl/snug 2xl:text-6xl/snug"
>
Expand Down Expand Up @@ -88,20 +89,26 @@
</template>
<template v-else>
{{ t('auth.signIn.newHere') }}
<a
href="/signup/"
:class="
cn(
'text-brand-yellow no-underline transition-all duration-300 hover:underline',
busy && 'pointer-events-none opacity-50'
)
"
:aria-disabled="busy || undefined"
@click="switchMode('signUp', $event)"
<I18nT
keypath="auth.signIn.signUpPrompt"
:i18n="translationsFor(locale)"
>
{{ t('auth.signIn.signUpLink') }}
</a>
<span>{{ ' ' + t('auth.signIn.freeRunsSuffix') }}</span>
<template #link>
<a
href="/signup/"
:class="
cn(
'text-brand-yellow no-underline transition-all duration-300 hover:underline',
busy && 'pointer-events-none opacity-50'
)
"
:aria-disabled="busy || undefined"
@click="switchMode('signUp', $event)"
>
{{ t('auth.signIn.signUpLink') }}
</a>
</template>
</I18nT>
</template>
</p>

Expand Down
18 changes: 16 additions & 2 deletions apps/website/src/components/blocks/HeroSplit01.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,56 @@
const meta: Meta<typeof HeroSplit01> = {
title: 'Website/Blocks/HeroSplit01',
component: HeroSplit01,
tags: ['autodocs', 'stable'],
decorators: [
() => ({
template: '<div class="min-h-screen bg-primary-comfy-ink"><story /></div>'
})
],
parameters: {
layout: 'fullscreen',
viewport: {
options: {
desktop: {
name: 'Desktop',
styles: { width: '1440px', height: '1000px' },
type: 'desktop'
},
tablet: {
name: 'Tablet',
styles: { width: '768px', height: '1024px' },
type: 'tablet'
},
mobile: {
name: 'Mobile',
styles: { width: '390px', height: '844px' },
type: 'mobile'
}
}
}
},
args: {
badgeText: 'DESKTOP',
titleHighlight: 'Professional control.',
title: ' Run ComfyUI on your own machine.',
title: 'Professional control. Run ComfyUI on your own machine.',
subtitle:
'Build, iterate, and run visual AI workflows with complete local control.',
features: [
'Open source and extensible',
'Runs locally on your hardware',
'Visible nodes, parameters, and outputs'
],
primaryCta: {
label: 'DOWNLOAD',
href: '/download'
},
secondaryCta: {
label: 'VIEW ON GITHUB',
href: 'https://github.com/comfyanonymous/ComfyUI',
target: '_blank'
},
imageSrc: '/images/mcp/mcp-thumb-keyart.webp',
imageAlt: 'Abstract Comfy artwork'
}

Check warning on line 60 in apps/website/src/components/blocks/HeroSplit01.stories.ts

View workflow job for this annotation

GitHub Actions / fallow / fallow

Code duplication

71 duplicated lines (71 tokens) 3 instances found. Also in: → components/blocks/BuildConfiguratorSplit01.stories.ts:8-78 → components/blocks/HeroProduct01.stories.ts:10-42 Extract a shared function to eliminate this duplication.
}

export default meta
Expand All @@ -72,6 +71,21 @@
}
}

export const HighlightedTitle: Story = {
render: (args) => ({
components: { HeroSplit01 },
setup: () => ({ args }),
template: `
<HeroSplit01 v-bind="args">
<template #title>
<span class="text-primary-warm-white">Professional control.</span>
Run ComfyUI on your own machine.
</template>
</HeroSplit01>
`
})
}

export const Mobile: Story = {
globals: {
viewport: { value: 'mobile1', isRotated: false }
Expand Down
10 changes: 2 additions & 8 deletions apps/website/src/components/blocks/HeroSplit01.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
badgeShowLogo = true,
title,
titleClass,
titleHighlight,
subtitle,
subtitleClass,
mediaWrapperClass,
Expand Down Expand Up @@ -64,9 +63,8 @@
badgeLogoSrc?: string
badgeLogoAlt?: string
badgeShowLogo?: boolean
title: string
title?: string
titleClass?: HTMLAttributes['class']
titleHighlight?: string
subtitle?: string
subtitleClass?: HTMLAttributes['class']
mediaWrapperClass?: HTMLAttributes['class']
Expand Down Expand Up @@ -97,7 +95,7 @@
<template>
<section
:class="
cn(

Check warning on line 98 in apps/website/src/components/blocks/HeroSplit01.vue

View workflow job for this annotation

GitHub Actions / fallow / fallow

High cognitive complexity (moderate)

Function '<template>' is hard to understand (cognitive: 18, threshold: 15). • Severity: moderate • Cyclomatic: 17 • Cognitive: 18 • Lines: 218 High cognitive complexity means deeply nested or interleaved logic. Consider flattening control flow or extracting helper functions.
'relative mx-auto flex max-w-9xl flex-col items-center gap-12 px-6 pt-20 pb-16 md:pt-28 md:pb-24 lg:items-center lg:gap-16 lg:px-16',
imagePosition === 'right' ? 'lg:flex-row' : 'lg:flex-row-reverse',
className
Expand Down Expand Up @@ -130,11 +128,7 @@
)
"
>
<template v-if="titleHighlight">
<span class="text-primary-warm-white">{{ titleHighlight }}</span>
{{ title }}
</template>
<template v-else>{{ title }}</template>
<slot name="title">{{ title }}</slot>
</h1>

<p
Expand Down
9 changes: 5 additions & 4 deletions apps/website/src/components/common/HubspotFormEmbed.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@testing-library/vue'
import { render, screen, within } from '@testing-library/vue'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { nextTick } from 'vue'

Expand Down Expand Up @@ -83,10 +83,11 @@ describe('HubspotFormEmbed', () => {
await nextTick()

expect(screen.queryByTestId('hubspot-form-embed')).toBeNull()
expect(screen.getByRole('status').textContent).toContain(
'Unable to load the form'
const status = screen.getByRole('status')
expect(status).toHaveTextContent(
"Unable to load the form. Email us at hello@comfy.org and we'll route your request."
)
expect(screen.getByRole('link').getAttribute('href')).toBe(
expect(within(status).getByRole('link').getAttribute('href')).toBe(
'mailto:hello@comfy.org'
)
})
Expand Down
21 changes: 13 additions & 8 deletions apps/website/src/components/common/HubspotFormEmbed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { onMounted, ref } from 'vue'
import type { Locale } from '@/i18n/translations'

import { translationsFor } from '@/i18n/translations'
import { I18nT } from 'vue-i18n'

const { formId, locale = 'en' } = defineProps<{
formId: string
locale?: Locale
}>()
const { t } = translationsFor(locale)

const HUBSPOT_PORTAL_ID = '244637579'
const HUBSPOT_REGION = 'na2'
Expand Down Expand Up @@ -132,14 +132,19 @@ onMounted(() => {
class="text-sm/6 text-primary-comfy-canvas"
role="status"
>
{{ t('hubspotForm.embedLoadErrorPrefix') }}
<a
class="text-primary-comfy-yellow underline"
href="mailto:hello@comfy.org"
<I18nT
keypath="hubspotForm.embedLoadError"
:i18n="translationsFor(locale)"
>
hello@comfy.org
</a>
{{ t('hubspotForm.embedLoadErrorSuffix') }}
<template #email>
<a
class="text-primary-comfy-yellow underline"
href="mailto:hello@comfy.org"
>
hello@comfy.org
</a>
</template>
</I18nT>
</p>
<div
v-else
Expand Down
19 changes: 13 additions & 6 deletions apps/website/src/components/home/GetStartedSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Locale } from '@/i18n/translations'

import { externalLinks, getRoutes } from '@/config/routes'
import { translationsFor } from '@/i18n/translations'
import { I18nT } from 'vue-i18n'

const { locale = 'en' } = defineProps<{ locale?: Locale }>()
const { t } = translationsFor(locale)
Expand Down Expand Up @@ -80,12 +81,18 @@ const steps = [
v-else-if="step.number === '2'"
class="flex-1 text-sm text-primary-comfy-canvas"
>
{{ t('getStarted.step2.descriptionPrefix')
}}<a
:href="externalLinks.workflows"
class="text-primary-comfy-yellow hover:underline"
>{{ t('getStarted.step2.descriptionLink') }}</a
>{{ t('getStarted.step2.descriptionSuffix') }}
<I18nT
keypath="getStarted.step2.descriptionWithLink"
:i18n="translationsFor(locale)"
>
<template #link>
<a
:href="externalLinks.workflows"
class="text-primary-comfy-yellow hover:underline"
>{{ t('getStarted.step2.descriptionLink') }}</a
>
</template>
</I18nT>
</p>
<p v-if="step.links" class="flex-1 text-sm">
<template v-for="(link, i) in step.links" :key="link.href">
Expand Down
39 changes: 37 additions & 2 deletions apps/website/src/components/interpolatedHeadings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import { describe, expect, it } from 'vitest'
import OurValuesSection from './about/OurValuesSection.vue'
import StorySection from './about/StorySection.vue'
import WireNodeLayout from './common/WireNodeLayout.vue'
import AffiliateHeroSection from '@/templates/affiliate/HeroSection.vue'
import CliWhySection from '@/templates/cli/WhySection.vue'
import CloudNodesHeroSection from '@/templates/cloud-nodes/HeroSection.vue'
import CloudNodesWhySection from '@/templates/cloud-nodes/WhySection.vue'
import McpWhySection from '@/templates/mcp/WhySection.vue'
import AudienceSection from './product/cloud/AudienceSection.vue'
Expand All @@ -21,6 +23,7 @@ type HighlightedHeadingCase = {
locale: Locale
heading: string
highlight: string
level?: 1 | 2
}

const highlightedHeadings: HighlightedHeadingCase[] = [
Expand Down Expand Up @@ -138,16 +141,48 @@ const highlightedHeadings: HighlightedHeadingCase[] = [
locale: 'zh-CN',
heading: '完全掌控。\n只把算力交给我们。',
highlight: '只把算力交给我们。'
},
{
name: 'AffiliateHeroSection',
component: AffiliateHeroSection,
locale: 'en',
heading: 'Earn 30% recurring commission for 3 months.',
highlight: 'Earn 30%',
level: 1
},
{
name: 'AffiliateHeroSection',
component: AffiliateHeroSection,
locale: 'zh-CN',
heading: '赚取 30% 持续返佣 3 个月。',
highlight: '赚取 30%',
level: 1
},
{
name: 'CloudNodesHeroSection',
component: CloudNodesHeroSection,
locale: 'en',
heading: 'Your graph. Our GPUs.',
highlight: 'Your graph.',
level: 1
},
{
name: 'CloudNodesHeroSection',
component: CloudNodesHeroSection,
locale: 'ja',
heading: 'あなたのグラフ。 私たちのGPU。',
highlight: 'あなたのグラフ。',
level: 1
}
]

describe('interpolated headings', () => {
it.for(highlightedHeadings)(
'$name keeps the highlight inside the $locale heading',
({ component, locale, heading, highlight }) => {
({ component, locale, heading, highlight, level = 2 }) => {
render(component, { props: { locale } })

const title = screen.getByRole('heading', { level: 2 })
const title = screen.getByRole('heading', { level })
expect(title.textContent).toBe(heading)
expect(within(title).getByText(highlight)).toBeInTheDocument()
}
Expand Down
Loading
Loading