mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-18 01:38:03 +00:00
## Summary - Migrate the website's top nav from bespoke components (`SiteNav`, `MobileMenu`, `NavDesktopLink`, `PillButton`, `MaskRevealButton`) to shadcn-vue primitives (`NavigationMenu`, `Sheet`, `Button`), split into `HeaderMain` → `HeaderMainDesktop` + `HeaderMainMobile`. - Mobile nav becomes a `Sheet` with drill-down sub-navigation, scroll lock, sticky CTAs, sr-only i18n title/description, and a back-to-home logo. - Desktop nav uses `NavigationMenu` with shared viewport, featured cards, `NavColumn` extraction, and centralized nav data in `data/mainNavigation.ts`. - Adds i18n strings for nav labels, dropdown column headers, close/back affordances, and the mobile menu description. ## Test plan - [ ] Desktop: hover PRODUCTS / COMMUNITY / COMPANY — dropdowns open with featured card + columns, NEW badges render, external links show the arrow-up-right icon, viewport is shared between triggers. - [ ] Mobile (<lg): open hamburger sheet — verify logo + close, body scroll is locked while open, top-level nav scrolls if it overflows, CTAs stay pinned at bottom. - [ ] Tap COMMUNITY / PRODUCTS / COMPANY — sub-panel slides over root nav, in-sheet BACK returns to root, links navigate correctly. - [ ] Reload `?locale=zh-CN`: dropdown labels, sheet title/description, BACK / close affordances all localized. - [ ] No regressions on `/cloud`, `/cloud/pricing`, `/customers`, etc. — pages that swap CTAs (`BrandButton` → shadcn `Button`) still render at every breakpoint. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
170 lines
5.7 KiB
Plaintext
170 lines
5.7 KiB
Plaintext
---
|
|
import { ClientRouter } from 'astro:transitions'
|
|
import Analytics from '@vercel/analytics/astro'
|
|
import '../styles/global.css'
|
|
import type { Locale } from '../i18n/translations'
|
|
import SiteFooter from '../components/common/SiteFooter.vue'
|
|
import HeaderMain from '../components/common/HeaderMain/HeaderMain.vue'
|
|
import { escapeJsonLd } from '../utils/escapeJsonLd'
|
|
import { fetchGitHubStars, formatStarCount } from '../utils/github'
|
|
|
|
interface Props {
|
|
title: string
|
|
description?: string
|
|
keywords?: string[]
|
|
ogImage?: string
|
|
noindex?: boolean
|
|
}
|
|
|
|
const {
|
|
title,
|
|
description = 'Comfy is the AI creation engine for visual professionals who demand control.',
|
|
keywords,
|
|
ogImage = 'https://media.comfy.org/website/comfy.webp',
|
|
noindex = false,
|
|
} = Astro.props
|
|
|
|
const keywordsContent = keywords && keywords.length > 0 ? keywords.join(', ') : undefined
|
|
|
|
const siteBase = Astro.site ?? 'https://comfy.org'
|
|
const canonicalURL = new URL(Astro.url.pathname, siteBase)
|
|
const ogImageURL = new URL(ogImage, siteBase)
|
|
const rawLocale = Astro.currentLocale ?? 'en'
|
|
const locale: Locale = rawLocale === 'zh-CN' ? 'zh-CN' : 'en'
|
|
const rawStars = await fetchGitHubStars('Comfy-Org', 'ComfyUI')
|
|
const githubStars = rawStars ? formatStarCount(rawStars) : ''
|
|
|
|
const gtmId = 'GTM-NP9JM6K7'
|
|
const gtmEnabled = import.meta.env.PROD
|
|
|
|
const organizationJsonLd = {
|
|
'@context': 'https://schema.org',
|
|
'@type': 'Organization',
|
|
name: 'Comfy Org',
|
|
url: 'https://comfy.org',
|
|
logo: 'https://comfy.org/icons/logomark.svg',
|
|
sameAs: [
|
|
'https://github.com/comfyanonymous/ComfyUI',
|
|
'https://discord.gg/comfyorg',
|
|
'https://x.com/comaboratory',
|
|
'https://reddit.com/r/comfyui',
|
|
'https://linkedin.com/company/comfyorg',
|
|
'https://instagram.com/comfyorg',
|
|
],
|
|
}
|
|
|
|
const websiteJsonLd = {
|
|
'@context': 'https://schema.org',
|
|
'@type': 'WebSite',
|
|
name: 'Comfy',
|
|
url: 'https://comfy.org',
|
|
}
|
|
---
|
|
|
|
<!doctype html>
|
|
<html lang={locale} class="overflow-x-clip">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<meta name="description" content={description} />
|
|
{keywordsContent && <meta name="keywords" content={keywordsContent} />}
|
|
{noindex && <meta name="robots" content="noindex, nofollow" />}
|
|
<title>{title}</title>
|
|
|
|
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
<link rel="shortcut icon" href="/favicon.ico" sizes="48x48" />
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
<link rel="manifest" href="/site.webmanifest" />
|
|
<meta name="theme-color" content="#211927" />
|
|
<link rel="canonical" href={canonicalURL.href} />
|
|
<link rel="preconnect" href="https://www.googletagmanager.com" />
|
|
<link rel="dns-prefetch" href="https://www.googletagmanager.com" />
|
|
|
|
<!-- Open Graph -->
|
|
<meta property="og:type" content="website" />
|
|
<meta property="og:title" content={title} />
|
|
<meta property="og:description" content={description} />
|
|
<meta property="og:image" content={ogImageURL.href} />
|
|
<meta property="og:image:width" content="1200" />
|
|
<meta property="og:image:height" content="630" />
|
|
<meta property="og:url" content={canonicalURL.href} />
|
|
<meta property="og:locale" content={locale} />
|
|
<meta property="og:site_name" content="Comfy" />
|
|
|
|
<!-- Twitter -->
|
|
<meta name="twitter:card" content="summary_large_image" />
|
|
<meta name="twitter:site" content="@comaboratory" />
|
|
<meta name="twitter:title" content={title} />
|
|
<meta name="twitter:description" content={description} />
|
|
<meta name="twitter:image" content={ogImageURL.href} />
|
|
|
|
<!-- Structured Data -->
|
|
<script is:inline type="application/ld+json" set:html={escapeJsonLd(organizationJsonLd)} />
|
|
<script is:inline type="application/ld+json" set:html={escapeJsonLd(websiteJsonLd)} />
|
|
<slot name="head" />
|
|
|
|
<slot name="head" />
|
|
|
|
<!-- Google Tag Manager -->
|
|
{gtmEnabled && (
|
|
<script is:inline define:vars={{ gtmId }}>
|
|
;(function (w, d, s, l, i) {
|
|
w[l] = w[l] || []
|
|
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
|
|
var f = d.getElementsByTagName(s)[0],
|
|
j = d.createElement(s),
|
|
dl = l != 'dataLayer' ? '&l=' + l : ''
|
|
j.async = true
|
|
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl
|
|
f.parentNode.insertBefore(j, f)
|
|
})(window, document, 'script', 'dataLayer', gtmId)
|
|
</script>
|
|
)}
|
|
|
|
<ClientRouter />
|
|
<slot name="head" />
|
|
</head>
|
|
<body class="bg-primary-comfy-ink text-white font-formula antialiased overflow-x-clip">
|
|
{gtmEnabled && (
|
|
<noscript>
|
|
<iframe
|
|
src={`https://www.googletagmanager.com/ns.html?id=${gtmId}`}
|
|
height="0"
|
|
width="0"
|
|
style="display:none;visibility:hidden"
|
|
></iframe>
|
|
</noscript>
|
|
)}
|
|
|
|
<HeaderMain locale={locale} github-stars={githubStars} client:load />
|
|
<main class="mt-20 lg:mt-32">
|
|
<slot />
|
|
</main>
|
|
<SiteFooter locale={locale} client:load />
|
|
|
|
<Analytics />
|
|
|
|
<script>
|
|
import { initSmoothScroll, cancelScroll } from '../scripts/smoothScroll'
|
|
import { ScrollTrigger } from '../scripts/gsapSetup'
|
|
import { initPostHog, capturePageview } from '../scripts/posthog'
|
|
|
|
initSmoothScroll()
|
|
|
|
if (import.meta.env.PROD) {
|
|
initPostHog()
|
|
document.addEventListener('astro:page-load', capturePageview)
|
|
}
|
|
|
|
document.addEventListener('astro:page-load', () => {
|
|
ScrollTrigger.refresh()
|
|
})
|
|
|
|
document.addEventListener('astro:before-preparation', () => {
|
|
cancelScroll()
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|