The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Create, Studios, Apps and Motions & effects pages that show everything inside each
Adarsha92342c1ba17
diff --git a/src/app/(studio)/apps/page.tsx b/src/app/(studio)/apps/page.tsxindex 816861a8..6718e257 100644--- a/src/app/(studio)/apps/page.tsx+++ b/src/app/(studio)/apps/page.tsx@@ -1,14 +1,18 @@import type { Metadata } from "next";+import { ArrowDown } from "lucide-react";+import { AreaHero, AreaPage, MoreInFuobe } from "@/components/areas/area-page";+import { AppsSection } from "@/components/home/home-sections";import { LiveDemo } from "@/components/live/live-demo";-import { PageHeader, PageShell } from "@/components/page-shell";import { PresetGallery, type LinkCard } from "@/components/preset-gallery";+import { appsAreaShowcase } from "@/lib/area-showcase";import { APPS } from "@/lib/catalog";import { toPresetCard } from "@/lib/preset-card-data";import { featuredGallery } from "@/lib/preset-featured";export const metadata: Metadata = {title: "Apps",- description: "One-click AI tools for faces, products, styles and fun.",+ description: "One-click AI apps for faces, products, styles and fun, each with a real before and after.",+ alternates: { canonical: "/apps" },};/** Tools of their own, first in the gallery. */@@ -23,15 +27,39 @@ const LEADING: LinkCard[] = [},];-export default function Page() {+/** Apps as an area page: Home's Apps section to start, then every app in the gallery (search and categories). */+export default async function Page() {+ const start = await appsAreaShowcase();return (- <PageShell>- <PageHeader- title="Apps"- description="One-click tools for faces, products, styles and fun."+ <AreaPage>+ <AreaHero+ id="apps"+ count={APPS.length}+ action={+ // The gallery with its search and categories, one jump away (Start here comes first).+ <a+ href="#every-app"+ className="group relative inline-flex h-11 shrink-0 items-center gap-1 rounded-full px-1 text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:h-10"+ >+ See all {APPS.length}+ <ArrowDown aria-hidden className="size-3.5 transition-transform duration-150 group-hover:translate-y-0.5" />+ </a>+ }/>- {/* Slim card data only: no prompt templates, routes or LoRA URLs in the page payload. */}- <PresetGallery {...featuredGallery(APPS.map(toPresetCard))} href="/apps/{id}" noun="apps" leading={LEADING} />- </PageShell>+ <AppsSection+ facts={start.facts}+ beforeAfter={start.beforeAfter}+ reveals={start.reveals}+ start={{ title: "Start here", line: "Drag across a picture to see what one click changed." }}+ />+ <section aria-labelledby="every-app-title" id="every-app" className="mt-10 scroll-mt-[calc(3.5rem+env(safe-area-inset-top))] sm:mt-14 md:scroll-mt-4">+ <h2 id="every-app-title" className="mb-4 font-heading text-[24px] leading-tight sm:text-[28px]">+ Every app+ </h2>+ {/* Slim card data only: no prompt templates, routes or LoRA URLs in the page payload. */}+ <PresetGallery {...featuredGallery(APPS.map(toPresetCard))} href="/apps/{id}" noun="apps" leading={LEADING} skipInAll={start.shown} />+ </section>+ <MoreInFuobe current="apps" />+ </AreaPage>);}diff --git a/src/app/(studio)/create/loading.tsx b/src/app/(studio)/create/loading.tsxnew file mode 100644index 00000000..4c08172d--- /dev/null+++ b/src/app/(studio)/create/loading.tsx@@ -0,0 +1,5 @@+import { GalleryPageSkeleton } from "@/components/skeletons";++export default function Loading() {+ return <GalleryPageSkeleton title="Create" />;+}diff --git a/src/app/(studio)/create/page.tsx b/src/app/(studio)/create/page.tsxnew file mode 100644index 00000000..34a989a5--- /dev/null+++ b/src/app/(studio)/create/page.tsx@@ -0,0 +1,24 @@+import type { Metadata } from "next";+import { AreaBody, AreaHero, areaIds, AreaJsonLd, AreaPage, AreaSections, MoreInFuobe, NewCreation, sectionTabs } from "@/components/areas/area-page";+import { areaShowcase } from "@/lib/area-showcase";++export const metadata: Metadata = {+ title: "Create",+ description: "Make pictures, clips and sound with open models, or edit what you have: inpaint, layers, colour, upscale and more.",+ alternates: { canonical: "/create" },+};++/** Everything in the Create menu and more: what makes something new, and what changes a picture, a clip or a sound. */+export default async function Page() {+ const { count, sections } = await areaShowcase("create");+ return (+ <AreaPage>+ <AreaHero id="create" count={count} search={areaIds(sections)} action={<NewCreation />} />+ <AreaBody id="create" tabs={sectionTabs(sections)}>+ <AreaSections sections={sections} />+ </AreaBody>+ <MoreInFuobe current="create" />+ <AreaJsonLd id="create" items={sections.flatMap((s) => s.cards)} />+ </AreaPage>+ );+}\ No newline at end of filediff --git a/src/app/(studio)/effects/page.tsx b/src/app/(studio)/effects/page.tsxindex 4d3309f0..c5a42013 100644--- a/src/app/(studio)/effects/page.tsx+++ b/src/app/(studio)/effects/page.tsx@@ -1,4 +1,5 @@import type { Metadata } from "next";+import { AreaBackLink } from "@/components/areas/area-page";import { PageHeader, PageShell } from "@/components/page-shell";import { PresetGallery } from "@/components/preset-gallery";import { EFFECTS } from "@/lib/catalog";@@ -13,6 +14,7 @@ export const metadata: Metadata = {export default function Page() {return (<PageShell>+ <AreaBackLink id="motions" /><PageHeadertitle="Effects"description="Storms, transformations and cinematic VFX from one photo. Colour looks apply instantly."diff --git a/src/app/(studio)/motions-and-effects/loading.tsx b/src/app/(studio)/motions-and-effects/loading.tsxnew file mode 100644index 00000000..f89a4e64--- /dev/null+++ b/src/app/(studio)/motions-and-effects/loading.tsx@@ -0,0 +1,5 @@+import { GalleryPageSkeleton } from "@/components/skeletons";++export default function Loading() {+ return <GalleryPageSkeleton title="Motions & effects" />;+}diff --git a/src/app/(studio)/motions-and-effects/page.tsx b/src/app/(studio)/motions-and-effects/page.tsxnew file mode 100644index 00000000..71db412f--- /dev/null+++ b/src/app/(studio)/motions-and-effects/page.tsx@@ -0,0 +1,86 @@+import type { Metadata } from "next";+import { AREA_SECTION, AreaBody, AreaHero, AreaJsonLd, AreaPage, MoreInFuobe } from "@/components/areas/area-page";+import type { AreaTab } from "@/components/areas/area-islands";+import { PresetRail, SectionHead, ShowcaseWall } from "@/components/home/home-sections";+import { PILL, PILL_TAP } from "@/components/home/pill";+import { IntentLink } from "@/components/intent-link";+import { motionsAreaShowcase } from "@/lib/area-showcase";+import { cn } from "@/lib/utils";++export const metadata: Metadata = {+ title: "Motions & effects",+ description: "Camera moves a film crew would make and cinematic effects, ready for any photo.",+ alternates: { canonical: "/motions-and-effects" },+};++const categoryHref = (gallery: string, c: string) => `${gallery}?category=${encodeURIComponent(c)}`;++/** A gallery's row: its heading with "See all", Home's preset cards, then every category as a pill. */+function GalleryRow({+ id,+ title,+ line,+ href,+ data,+ pillsLabel,+}: {+ id: string;+ title: string;+ line: string;+ href: string;+ data: Awaited<ReturnType<typeof motionsAreaShowcase>>["motions"];+ pillsLabel: string;+}) {+ return (+ <section id={id} aria-labelledby={`${id}-title`} className={AREA_SECTION}>+ <SectionHead id={`${id}-title`} title={title} count={data.count} all={href} line={line} />+ {/* Four a row, as the other area pages' cards, so every line under a picture shows whole. */}+ <PresetRail items={data.row} className="sm:grid-cols-4" />+ <h3 className="mt-6 mb-2 font-sans text-[13px] text-muted-foreground">{pillsLabel}</h3>+ <ul className="flex flex-wrap gap-1.5">+ {data.categories.map((c) => (+ <li key={c}>+ <IntentLink href={categoryHref(href, c)} className={cn(PILL, PILL_TAP)}>+ {c}+ </IntentLink>+ </li>+ ))}+ </ul>+ </section>+ );+}++/** Both preset galleries on one page: a playing wall of the best, then each gallery's first row and its categories. */+export default async function Page() {+ const { wall, motions, effects } = await motionsAreaShowcase();+ const tabs: AreaTab[] = [+ { href: "#camera-motions", label: "Camera motions", icon: "Film", section: "camera-motions" },+ { href: "#effects", label: "Effects", icon: "Sparkles", section: "effects" },+ ];+ return (+ <AreaPage>+ <AreaHero id="motions" count={motions.count + effects.count} />+ <AreaBody id="motions" tabs={tabs}>+ <ShowcaseWall wall={wall} label="The best camera motions and effects" foot={false} />+ <GalleryRow+ id="camera-motions"+ title="Camera motions"+ line="Moves a film crew would make: orbits, drone dives, crash zooms. Mix any two."+ href="/motions"+ data={motions}+ pillsLabel="Camera motions by kind"+ />+ <GalleryRow id="effects" title="Effects" line="Add one photo and get the shot: storms, blooms, flares, floods." href="/effects" data={effects} pillsLabel="Effects by kind" />+ </AreaBody>+ <MoreInFuobe current="motions" />+ <AreaJsonLd+ id="motions"+ items={[+ { label: "Camera motions", href: "/motions" },+ { label: "Effects", href: "/effects" },+ ...wall.map((t) => ({ label: t.card.name, href: t.href })),+ ]}+ />+ </AreaPage>+ );+}diff --git a/src/app/(studio)/motions/page.tsx b/src/app/(studio)/motions/page.tsxindex dc901f9f..8e159151 100644--- a/src/app/(studio)/motions/page.tsx+++ b/src/app/(studio)/motions/page.tsx@@ -1,4 +1,5 @@import type { Metadata } from "next";+import { AreaBackLink } from "@/components/areas/area-page";import { PageHeader, PageShell } from "@/components/page-shell";import { PresetGallery } from "@/components/preset-gallery";import { MOTIONS } from "@/lib/catalog";@@ -13,6 +14,7 @@ export const metadata: Metadata = {export default function Page() {return (<PageShell>+ <AreaBackLink id="motions" /><PageHeadertitle="Camera motions"description="Pick a camera move, add a start frame, and Fuobe DoP films it."diff --git a/src/app/(studio)/studios/loading.tsx b/src/app/(studio)/studios/loading.tsxnew file mode 100644index 00000000..2423076c--- /dev/null+++ b/src/app/(studio)/studios/loading.tsx@@ -0,0 +1,5 @@+import { GalleryPageSkeleton } from "@/components/skeletons";++export default function Loading() {+ return <GalleryPageSkeleton title="Studios" />;+}diff --git a/src/app/(studio)/studios/page.tsx b/src/app/(studio)/studios/page.tsxnew file mode 100644index 00000000..37fad84a--- /dev/null+++ b/src/app/(studio)/studios/page.tsx@@ -0,0 +1,27 @@+import type { Metadata } from "next";+import { AreaBody, AreaHero, areaIds, AreaJsonLd, AreaPage, AreaSections, MoreInFuobe, sectionTabs } from "@/components/areas/area-page";+import { areaShowcase } from "@/lib/area-showcase";+import { studioCount } from "@/lib/nav-model";++export async function generateMetadata(): Promise<Metadata> {+ return {+ title: "Studios",+ description: `${studioCount()} studios for films, ads, social, fashion and sound, grouped by what you want to make. Look around with no account.`,+ alternates: { canonical: "/studios" },+ };+}++/** Every studio, grouped as the bar's launcher groups them, each with its cover and line, then its tools. */+export default async function Page() {+ const { count, sections } = await areaShowcase("studios");+ return (+ <AreaPage>+ <AreaHero id="studios" count={count} search={areaIds(sections)} />+ <AreaBody id="studios" tabs={sectionTabs(sections)}>+ <AreaSections sections={sections} />+ </AreaBody>+ <MoreInFuobe current="studios" />+ <AreaJsonLd id="studios" items={sections.flatMap((s) => [...s.cards, ...s.pills])} />+ </AreaPage>+ );+}\ No newline at end of filediff --git a/src/components/areas/area-islands.tsx b/src/components/areas/area-islands.tsxnew file mode 100644index 00000000..4591881d--- /dev/null+++ b/src/components/areas/area-islands.tsx@@ -0,0 +1,168 @@+"use client";++import { Search } from "lucide-react";+import { useEffect, useState } from "react";+import { IntentLink } from "@/components/intent-link";+import { PILL, PILL_ICON, PILL_TAP } from "@/components/home/pill";+import { useExplored } from "@/components/nav/explore-tracker";+import { GOAL_TAB, GOAL_TAB_ON } from "@/components/nav/goal-tab";+import { useViewerKind } from "@/components/nav/nav-ui";+import { useSearchPalette } from "@/components/nav/search-context";+import { useFadeEdges } from "@/components/use-fade-edges";+import { area, type AreaId } from "@/lib/nav-areas";+import { navIcon } from "@/lib/nav-icons";+import { entry, visibleTo, type NavEntry } from "@/lib/nav-model";+import { cn } from "@/lib/utils";++/*+ * The area pages' few live parts: the search that looks inside the area, the section tabs that follow the scroll,+ * "Jump back in" and the owner's own pills. Everything else on the page is server HTML.+ */++/** What an area's search field says. */+const SEARCH_WORDS: Partial<Record<AreaId, string>> = { create: "Search tools to make and edit…", studios: "Search studios…" };++/** Search inside the area: a button styled as a field, opening the site's search on this area's pages only. */+export function AreaSearch({ id, ids, className }: { id: AreaId; ids: string[]; className?: string }) {+ const search = useSearchPalette();+ const { label } = area(id);+ const words = SEARCH_WORDS[id] ?? `Search ${label.toLowerCase()}…`;+ return (+ <button+ type="button"+ aria-haspopup="dialog"+ onClick={() => search.open({ scope: { label, ids } })}+ onPointerEnter={() => search.warm()}+ onFocus={() => search.warm()}+ className={cn(+ "inline-flex h-11 shrink-0 items-center gap-2 rounded-[10px] border border-input bg-background/60 px-3 text-[14px] text-muted-foreground outline-none hover:border-border-strong hover:bg-background focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors sm:h-10 sm:text-[13.5px]",+ className,+ )}+ >+ <Search aria-hidden className="size-4 shrink-0" />+ <span className="min-w-0 flex-1 truncate text-left">{words}</span>+ </button>+ );+}++export interface AreaTab {+ /** The section it jumps to (#film). */+ href: string;+ label: string;+ icon: string;+ /** The section's id: the tab is marked while that section is the one being read. */+ section: string;+}++/**+ * The area's tabs in the goal row's strip, kept under the bar (the phone's or the desktop's) while its sections scroll+ * by: links, so they work before the page hydrates. The tab of the section being read is marked (aria-current), and+ * scrolled into view in the strip, which a phone scrolls sideways inside itself.+ */+export function AreaTabs({ tabs, label }: { tabs: AreaTab[]; label: string }) {+ const strip = useFadeEdges<HTMLDivElement>();+ const [on, setOn] = useState<string | null>(null);+ const key = tabs.map((t) => t.section).join(",");++ useEffect(() => {+ if (!key || typeof IntersectionObserver === "undefined") return;+ const shown = new Map<string, number>();+ const io = new IntersectionObserver(+ (entries) => {+ for (const e of entries) shown.set(e.target.id, e.isIntersecting ? e.intersectionRatio : 0);+ // The first section (in page order) under the bar and the tabs: the one being read.+ const first = key.split(",").find((id) => (shown.get(id) ?? 0) > 0);+ setOn(first ?? null);+ },+ { rootMargin: "-120px 0px -45% 0px", threshold: [0, 0.01] },+ );+ for (const id of key.split(",")) {+ const el = document.getElementById(id);+ if (el) io.observe(el);+ }+ return () => io.disconnect();+ }, [key]);++ // The marked tab stays in sight in a strip that scrolls sideways (a phone's).+ useEffect(() => {+ const row = strip.current;+ const tab = on ? row?.querySelector<HTMLElement>(`[data-section="${on}"]`) : null;+ if (!row || !tab || row.scrollWidth <= row.clientWidth) return;+ const left = tab.offsetLeft - (row.clientWidth - tab.offsetWidth) / 2;+ row.scrollTo({ left, behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth" });+ }, [on, strip]);++ return (+ <nav+ aria-label={label}+ // Under the phone's bar (48 px and the notch), or the desktop's (top-chrome). Its background and lower rule reach+ // the screen's edges (shadows clipped to its own height), so cards scrolling under it never show at its sides.+ className="sticky top-[calc(3rem+env(safe-area-inset-top))] z-10 mt-5 flex h-[52px] items-stretch border-y bg-background shadow-[0_0_0_100vmax_var(--background),0_1px_0_100vmax_var(--border)] [clip-path:inset(0_-100vmax_-1px)] max-sm:-mx-4 md:top-chrome"+ >+ <div ref={strip} className="fade-x scrollbar-none relative flex min-w-0 flex-1 snap-x items-stretch gap-0.5 overflow-x-auto max-sm:px-1">+ {tabs.map((t) => {+ const Icon = navIcon(t.icon);+ const current = on !== null && t.section === on;+ return (+ <a key={t.href} href={t.href} data-section={t.section} aria-current={current ? "true" : undefined} className={cn(GOAL_TAB, current && GOAL_TAB_ON)}>+ <Icon aria-hidden className={cn("size-4 shrink-0 md:max-lg:hidden", current ? "text-brand-text" : "text-muted-foreground")} />+ {/* The label's bold copy keeps its width, so marking a tab never moves the ones beside it. */}+ <span className="grid">+ <span className={cn("col-start-1 row-start-1", current ? "font-semibold" : "font-medium")}>{t.label}</span>+ <span aria-hidden className="invisible col-start-1 row-start-1 font-semibold">+ {t.label}+ </span>+ </span>+ </a>+ );+ })}+ </div>+ </nav>+ );+}++const pillOf = (e: NavEntry, tap = true) => {+ const Icon = navIcon(e.icon);+ return (+ <li key={e.id}>+ <IntentLink href={e.href} className={cn(PILL, tap && PILL_TAP)}>+ <Icon className={PILL_ICON} />+ {e.label}+ </IntentLink>+ </li>+ );+};++/**+ * "Jump back in": the last four pages of this area this browser opened, newest first, for someone signed in. Nothing for+ * a guest, while hydrating, when storage is blocked, or before anything here was opened. It sits under the first+ * section, off screen at load, so nothing moves when it comes.+ */+export function JumpBackIn({ ids }: { ids: string[] }) {+ const kind = useViewerKind();+ const explored = useExplored();+ if (!kind || kind === "guest" || !explored) return null;+ const mine = new Set(ids);+ const recent = [...explored]+ .reverse()+ .filter((id) => mine.has(id))+ .map(entry)+ .filter((e): e is NavEntry => !!e && visibleTo(e, kind))+ .slice(0, 4);+ if (!recent.length) return null;+ return (+ <section aria-labelledby="jump-back-in" className="mt-8 sm:mt-10">+ <h2 id="jump-back-in" className="mb-2 font-sans text-[13px] font-medium">+ Jump back in+ </h2>+ <ul className="flex flex-wrap gap-1.5">{recent.map((e) => pillOf(e))}</ul>+ </section>+ );+}++/** The owner's own pills in a section's row (a mode only the owner sees), added once the viewer is known. */+export function OwnerPills({ ids }: { ids: string[] }) {+ const kind = useViewerKind();+ if (kind !== "owner") return null;+ return <>{ids.map(entry).filter((e): e is NavEntry => !!e && visibleTo(e, kind)).map((e) => pillOf(e))}</>;+}diff --git a/src/components/areas/area-page.tsx b/src/components/areas/area-page.tsxnew file mode 100644index 00000000..7f7b0d06--- /dev/null+++ b/src/components/areas/area-page.tsx@@ -0,0 +1,173 @@+import { ChevronLeft, Plus } from "lucide-react";+import { DestinationsSection, HomeFooter, SectionHead } from "@/components/home/home-sections";+import { PILL, PILL_ICON, PILL_TAP } from "@/components/home/pill";+import { IntentLink } from "@/components/intent-link";+import { PageShell } from "@/components/page-shell";+import type { AreaShowcase } from "@/lib/area-showcase";+import { AREAS, area, type AreaId } from "@/lib/nav-areas";+import { navIcon } from "@/lib/nav-icons";+import { entry, type NavEntry } from "@/lib/nav-model";+import { cn } from "@/lib/utils";+import { AreaSearch, AreaTabs, JumpBackIn, OwnerPills, type AreaTab } from "./area-islands";++/*+ * An area page: everything one of the bar's menus holds, as Home shows its studios (src/components/home/home-sections.tsx,+ * DestinationsSection). A heading with the count and a line, tabs to the sections that stay under the bar, then the+ * sections, "Jump back in" for someone signed in, and the other areas at the end. Server HTML; the islands are in+ * area-islands.tsx.+ */++/**+ * Each section's space under the one before, as Home's (without Home's content-visibility, which needs a known height).+ * A jump to it stops under the bar and the tabs: the phone's bar and the tabs (100 px) and the notch; from md the page+ * already keeps the bar's 56 px clear (scroll-padding), so the tabs' 52 px and a little air.+ */+export const AREA_SECTION = "-mx-4 mt-8 -mb-2 scroll-mt-[calc(6.75rem+env(safe-area-inset-top))] px-4 py-2 sm:mt-12 md:scroll-mt-16";++/** The area page's heading: its name and count, its line, and its search (Create, Studios) beside it, or under it on a phone. */+export function AreaHero({ id, count, search, action }: { id: AreaId; count: number; search?: string[]; action?: React.ReactNode }) {+ const a = area(id);+ return (+ <header>+ <SectionHead as="h1" id="area-title" title={a.title} count={count} line={a.line}>+ {(search || action) && (+ <div className="flex shrink-0 items-center gap-2 max-sm:hidden">+ {search && <AreaSearch id={id} ids={search} className="sm:w-[240px] lg:w-[280px]" />}+ {action}+ </div>+ )}+ </SectionHead>+ {(search || action) && (+ <div className="-mt-1 mb-1 flex items-center gap-2 sm:hidden">+ {search && <AreaSearch id={id} ids={search} className="min-w-0 flex-1" />}+ {action}+ </div>+ )}+ </header>+ );+}++/** Create's one way to start: a fresh composer (each tool is a card below). 44 px, and 40 beside the search from sm. */+export function NewCreation() {+ const e = entry("new");+ if (!e) return null;+ return (+ <IntentLink+ href={e.href}+ className="inline-flex h-11 shrink-0 items-center gap-2 rounded-full bg-primary pr-5 pl-4 text-[14px] font-semibold text-primary-foreground outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background motion-safe:transition-colors sm:h-10"+ >+ <Plus aria-hidden className="size-[18px]" />+ {e.label}+ </IntentLink>+ );+}++/** The tabs for an area's sections: links to them on this page. */+export const sectionTabs = (sections: AreaShowcase["sections"]): AreaTab[] => sections.map((s) => ({ href: `#${s.id}`, label: s.title, icon: s.icon, section: s.id }));++/** Every page an area shows, for its search and "Jump back in". */+export const areaIds = (sections: AreaShowcase["sections"]) => [...new Set(sections.flatMap((s) => [...s.cards.map((c) => c.id), ...s.pills.map((p) => p.id)]))];++/**+ * The tabs and what they jump to, in one block: the tabs stay under the bar while any of its sections is on screen, and+ * leave with the last one.+ */+export function AreaBody({ id, tabs, children }: { id: AreaId; tabs: AreaTab[]; children: React.ReactNode }) {+ return (+ <div>+ {tabs.length > 0 && <AreaTabs tabs={tabs} label={`${area(id).title} sections`} />}+ {children}+ </div>+ );+}++/**+ * An area's sections, each as Home's "Studios and tools" with two cards a row on a phone, and "Jump back in" (someone+ * signed in) after the first, so it is off screen at load and moves nothing when it comes.+ */+export function AreaSections({ sections }: { sections: AreaShowcase["sections"] }) {+ const ids = areaIds(sections);+ return sections.map((s, i) => (+ <div key={s.id}>+ <div id={s.id} className={AREA_SECTION}>+ <DestinationsSection+ id={`${s.id}-title`}+ title={s.title}+ count={s.cards.length + s.pills.length}+ line={s.line}+ cards={s.cards}+ pills={s.pills.map((p) => ({ href: p.href, label: p.label, icon: navIcon(p.icon) }))}+ pillsLabel={`Also in ${s.title}`}+ tap+ grid+ after={s.ownerPills.length > 0 ? <OwnerPills ids={s.ownerPills.map((p) => p.id)} /> : undefined}+ />+ </div>+ {i === 0 && <JumpBackIn ids={ids} />}+ </div>+ ));+}++/** The pills at the end of an area page: the other areas, then Canvas and Assist. */+export function MoreInFuobe({ current }: { current: AreaId }) {+ const others = AREAS.filter((a) => a.id !== current).map((a) => entry(a.entryId));+ const list = [...others, entry("canvas"), entry("assist")].filter((e): e is NavEntry => !!e);+ return (+ <section aria-labelledby="more-in-fuobe" className="mt-10 sm:mt-14">+ <h2 id="more-in-fuobe" className="mb-2 font-sans text-[13px] font-medium">+ More in Fuobe+ </h2>+ <ul className="flex flex-wrap gap-1.5">+ {list.map((e) => {+ const Icon = navIcon(e.icon);+ const a = AREAS.find((x) => x.entryId === e.id);+ return (+ <li key={e.id}>+ <IntentLink href={e.href} className={cn(PILL, PILL_TAP)}>+ <Icon className={PILL_ICON} />+ {a ? a.label : e.label}+ </IntentLink>+ </li>+ );+ })}+ </ul>+ </section>+ );+}++/** The page's links as a schema.org list, for search engines (no script runs). */+export function AreaJsonLd({ id, items }: { id: AreaId; items: { label: string; href: string }[] }) {+ const a = area(id);+ const data = {+ "@context": "https://schema.org",+ "@type": "ItemList",+ name: a.title,+ url: `https://fuobe.com${a.href}`,+ itemListElement: items.map((it, i) => ({ "@type": "ListItem", position: i + 1, name: it.label, url: `https://fuobe.com${it.href}` })),+ };+ return <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(data).replace(/</g, "\\u003c") }} />;+}++/** The frame of an area page: Home's column, then the footer. */+export function AreaPage({ children }: { children: React.ReactNode }) {+ return (+ <PageShell>+ {children}+ <HomeFooter />+ </PageShell>+ );+}++/** Back to the area page from one of its galleries (/motions, /effects): a 44 px link over the heading. */+export function AreaBackLink({ id }: { id: AreaId }) {+ const a = area(id);+ return (+ <IntentLink+ href={a.href}+ className="group -mt-2 -ml-2 inline-flex h-11 items-center gap-1 rounded-full px-2 text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"+ >+ <ChevronLeft aria-hidden className="size-4 transition-transform duration-150 group-hover:-translate-x-0.5" />+ {a.title}+ </IntentLink>+ );+}diff --git a/src/components/home-view.tsx b/src/components/home-view.tsxindex 5c112781..3abc59ef 100644--- a/src/components/home-view.tsx+++ b/src/components/home-view.tsx@@ -11,7 +11,7 @@ import { PageShell } from "@/components/page-shell";import { Skeleton } from "@/components/ui/skeleton";import { HadItemsScript, useHadItems } from "@/components/use-had-items";import { IntentLink } from "@/components/intent-link";-import { useFadeEdges } from "@/components/preset-gallery";+import { useFadeEdges } from "@/components/use-fade-edges";import { MediaThumb } from "@/components/studio/result-media";import { CONNECT_GPU_EVENT, signInHref, useEngine, useGenerations, useHydrated, useIsOwner, useStatus } from "@/lib/api";import { EngineSwitch } from "@/components/studio/engine-switch";diff --git a/src/components/home/before-after.tsx b/src/components/home/before-after.tsxindex 8009ef93..6bdd4dc3 100644--- a/src/components/home/before-after.tsx+++ b/src/components/home/before-after.tsx@@ -271,7 +271,7 @@ export function BeforeAfter({ pairs }: { pairs: BeforeAfterPair[] }) {onPointerEnter={() => preload(p)}onFocus={() => preload(p)}className={cn(- "flex min-w-0 flex-1 items-center justify-center gap-2 rounded-lg p-1 text-[12px] font-medium text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring max-sm:h-9 sm:justify-start sm:pr-2 xl:flex-col xl:items-stretch xl:gap-1 xl:pr-1 xl:pb-1.5",+ "relative flex min-w-0 flex-1 items-center justify-center gap-2 rounded-lg p-1 text-[12px] after:absolute after:inset-x-0 after:-inset-y-1 after:content-[''] font-medium text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring max-sm:h-9 sm:justify-start sm:pr-2 xl:flex-col xl:items-stretch xl:gap-1 xl:pr-1 xl:pb-1.5",i === tab && "bg-muted text-foreground",)}>@@ -287,7 +287,11 @@ export function BeforeAfter({ pairs }: { pairs: BeforeAfterPair[] }) {</div><div className="mt-2 flex items-center justify-between gap-3 text-[12px] text-muted-foreground lg:max-xl:mt-4 lg:max-xl:flex-col lg:max-xl:items-start lg:max-xl:gap-1.5 lg:max-xl:px-1"><span>Drag to compare</span>- <IntentLink href={pair.href} className="inline-flex items-center gap-1 font-medium text-brand-text hover:underline underline-offset-2">+ <IntentLink+ href={pair.href}+ // 44 px to tap: its hit area reaches past the words.+ className="relative inline-flex items-center gap-1 font-medium text-brand-text underline-offset-2 after:absolute after:-inset-x-1 after:-inset-y-3.5 after:content-[''] hover:underline"+ >Try {pair.name} <ArrowRight className="size-3.5" /></IntentLink></div>diff --git a/src/components/home/home-islands.tsx b/src/components/home/home-islands.tsxindex d1a104e0..458adb6f 100644--- a/src/components/home/home-islands.tsx+++ b/src/components/home/home-islands.tsx@@ -3,7 +3,7 @@import { ArrowRight, Check, Copy, Pause, Play } from "lucide-react";import { useEffect, useRef, useState } from "react";import { CardPending, IntentLink } from "@/components/intent-link";-import { useFadeEdges } from "@/components/preset-gallery";+import { useFadeEdges } from "@/components/use-fade-edges";import { PresetPreview, setPreviewsPaused, usePreviewPlayback, usePreviewsPaused } from "@/components/preset-preview";import { CONNECT_GPU_EVENT, signInHref, useHydrated, useIsOwner, useStatus } from "@/lib/api";import { copyWithToast } from "@/lib/clipboard";@@ -36,7 +36,8 @@ export function PausePreviews() {onClick={() => setPreviewsPaused(!paused)}aria-label={label}title={label}- className="inline-flex size-7 shrink-0 items-center justify-center gap-1.5 rounded-full border text-[12px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground sm:w-[8.5rem]"+ // 44 px to tap: its hit area reaches past its 28 px circle.+ className="relative inline-flex size-7 shrink-0 items-center justify-center gap-1.5 rounded-full border text-[12px] text-muted-foreground transition-colors after:absolute after:-inset-2 after:content-[''] hover:bg-accent hover:text-foreground sm:w-[8.5rem]"><Icon className="size-3" /><span className="max-sm:hidden">{label}</span>diff --git a/src/components/home/home-sections.tsx b/src/components/home/home-sections.tsxindex 218a61ea..f9cb105d 100644--- a/src/components/home/home-sections.tsx+++ b/src/components/home/home-sections.tsx@@ -16,6 +16,7 @@ import {StudioName,StudioPicture,} from "@/components/home/home-islands";+import { PILL, PILL_ICON, PILL_TAP } from "@/components/home/pill";import { ShowcaseTile } from "@/components/home/showcase-tile";import { IntentLink } from "@/components/intent-link";import { LiveDemo } from "@/components/live/live-demo";@@ -25,6 +26,8 @@ import { ASSIST_SUGGESTIONS } from "@/lib/assist";import { WORKFLOWS_ON_GITHUB } from "@/lib/comfy-install";import { FUOBE_REPO } from "@/lib/connections";import { HOME_LIVE, presetHref, type HomeShowcase } from "@/lib/home-showcase";+import { area } from "@/lib/nav-areas";+import { studioCount } from "@/lib/nav-model";import { staggered } from "@/lib/preview-playback";import { cn } from "@/lib/utils";import { plainTagline } from "@/lib/plain-tagline";@@ -44,18 +47,47 @@ const RAIL_ITEM = "w-[64%] shrink-0 snap-start sm:w-auto";*/const SECTION = "home-cv -mx-4 mt-8 -mb-2 px-4 py-2 sm:mt-12";const H2 = "font-heading text-[24px] leading-tight sm:text-[28px]";+const H1 = "font-heading text-[34px] leading-tight";const LINE = "mt-1 text-[15px] text-pretty text-muted-foreground";/** How wide a row's picture shows: two-thirds of a phone, then a third, a quarter, a sixth of the screen. */const CARD_SIZES = "(min-width: 1280px) 16vw, (min-width: 1024px) 25vw, (min-width: 640px) 33vw, 64vw";const STUDIO_SIZES = "(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw";+/** An area page's cards: two a row on a phone and a tablet, four from lg. */+const GRID_SIZES = "(min-width: 1024px) 25vw, 50vw";const navIcon = (href: string) => NAV.flatMap((g) => g.items).find((i) => i.href === href)?.icon;-function SectionHead({ id, title, count, all, line }: { id: string; title: string; count?: number; all?: string; line: string }) {+/**+ * A section's heading with its count and line, and a "See all" link. `as="h1"`: an area page's own heading (the+ * PageHeader's size), with its search or quick start beside it (`children`).+ */+export function SectionHead({+ id,+ title,+ count,+ all,+ allCount = count,+ allNoun = title.toLowerCase(),+ line,+ as: Heading = "h2",+ children,+}: {+ id: string;+ title: string;+ count?: number;+ all?: string;+ /** How many "See all" leads to, when the page it opens holds fewer than the heading counts (Home's studios). */+ allCount?: number;+ /** What "See all" names for a screen reader, and on screen too when `allCount` differs from `count`. */+ allNoun?: string;+ line: string;+ as?: "h1" | "h2";+ children?: React.ReactNode;+}) {return (<div className="mb-4"><div className="flex items-center justify-between gap-4">- <h2 id={id} className={H2}>+ <Heading id={id} className={Heading === "h1" ? H1 : H2}>{title}{count !== undefined && (<span@@ -65,14 +97,17 @@ function SectionHead({ id, title, count, all, line }: { id: string; title: strin{count}</span>)}- </h2>+ </Heading>+ {children}{all && (<IntentLinkhref={all}- aria-label={`See all ${count} ${title.toLowerCase()}`}- className="group inline-flex shrink-0 items-center gap-1 text-[13px] text-muted-foreground transition-colors hover:text-foreground"+ aria-label={`See all ${allCount} ${allNoun}`}+ // 44 px to tap: its hit area reaches past the words.+ className="group relative inline-flex shrink-0 items-center gap-1 text-[13px] text-muted-foreground transition-colors after:absolute after:-inset-x-2 after:-inset-y-3 after:content-[''] hover:text-foreground">- See all {count} <ArrowRight className="size-3.5 transition-transform duration-150 group-hover:translate-x-0.5" />+ See all {allCount}+ {allCount !== count && ` ${allNoun}`} <ArrowRight className="size-3.5 transition-transform duration-150 group-hover:translate-x-0.5" /></IntentLink>)}</div>@@ -86,7 +121,18 @@ function SectionHead({ id, title, count, all, line }: { id: string; title: strin* xl the first `lg` (a rail costs no height, a grid does). The cards' own padding hangs outside the column, so each* picture lines up with the heading and the wall, 12 px from the next.*/-function Cards({ items, className, wide = items.length, lg = wide }: { items: HomeShowcase["effects"]; className: string; wide?: number; lg?: number }) {+function Cards({+ items,+ className,+ wide = items.length,+ lg = wide,+}: {+ /** A card without a caption shows its description. */+ items: { card: HomeShowcase["effects"][number]["card"]; caption?: string }[];+ className: string;+ wide?: number;+ lg?: number;+}) {return (<HomeRail className={cn("gap-0 scroll-px-2.5 max-sm:px-2.5 sm:-mx-1.5", className)}>{items.map(({ card, caption }, i) => (@@ -98,10 +144,24 @@ function Cards({ items, className, wide = items.length, lg = wide }: { items: Ho);}-/** The first pictures on the page: eight real covers, four on a phone. */-export function ShowcaseWall({ wall }: { wall: HomeShowcase["wall"] }) {+/** Home's preset rows (Effects, Camera motions), for an area page that shows them the same way. */+export const PresetRail = Cards;++/**+ * The first pictures on the page: eight real covers, four on a phone. `label`: the section's name for screen readers;+ * `foot`: the line under it (Home's says where the previews were rendered; an area page has none).+ */+export function ShowcaseWall({+ wall,+ label = "What Fuobe makes",+ foot = true,+}: {+ wall: readonly { id: string; kind: string; caption: string; href: string; card: HomeShowcase["wall"][number]["card"] }[];+ label?: string;+ foot?: boolean;+}) {return (- <section aria-label="What Fuobe makes" className="mt-6 sm:mt-8">+ <section aria-label={label} className="mt-6 sm:mt-8"><div className="grid grid-cols-2 gap-3 sm:grid-cols-4 md:max-lg:grid-cols-2">{wall.map((t, i) => (<ShowcaseTile key={t.id} card={t.card} kind={t.kind} caption={t.caption} href={t.href} index={i} />@@ -109,8 +169,12 @@ export function ShowcaseWall({ wall }: { wall: HomeShowcase["wall"] }) {</div><div className="mt-3 flex items-center justify-between gap-3 text-[12px] text-muted-foreground"><p className="min-w-0">- <span className="sm:hidden">Rendered locally on ComfyUI, on one RTX 5090.</span>- <span className="max-sm:hidden">Every preview on this page was rendered locally on ComfyUI, on one RTX 5090.</span>+ {foot && (+ <>+ <span className="sm:hidden">Rendered locally on ComfyUI, on one RTX 5090.</span>+ <span className="max-sm:hidden">Every preview on this page was rendered locally on ComfyUI, on one RTX 5090.</span>+ </>+ )}</p><PausePreviews /></div>@@ -148,10 +212,19 @@ export function MotionsSection({ facts, motions }: Pick<HomeShowcase, "facts" |);}-export function AppsSection({ facts, beforeAfter, reveals }: Pick<HomeShowcase, "facts" | "beforeAfter" | "reveals">) {+/**+ * Apps on Home: a before and after, and the apps whose clip wipes from one to the other. /apps opens on the same section+ * as its "Start here" (`start`): its own heading, no count and no "See all" (the page is all of them).+ */+export function AppsSection({ facts, beforeAfter, reveals, start }: Pick<HomeShowcase, "facts" | "beforeAfter" | "reveals"> & { start?: { title: string; line: string } }) {+ const id = start ? "apps-start" : "home-apps";return (- <section aria-labelledby="home-apps" className={cn(SECTION, "[--cv:676px] sm:[--cv:1004px] md:[--cv:943px] lg:[--cv:957px] xl:[--cv:525px]")}>- <SectionHead id="home-apps" title="Apps" count={facts.apps} all="/apps" line="One click changes one thing and keeps the rest." />+ <section aria-labelledby={id} className={cn(SECTION, "[--cv:676px] sm:[--cv:1004px] md:[--cv:943px] lg:[--cv:957px] xl:[--cv:525px]")}>+ {start ? (+ <SectionHead id={id} title={start.title} line={start.line} />+ ) : (+ <SectionHead id={id} title="Apps" count={facts.apps} all="/apps" line="One click changes one thing and keeps the rest." />+ )}<div className="grid grid-cols-1 gap-6 xl:grid-cols-12 xl:gap-4"><div className="min-w-0 xl:col-span-5 xl:pt-1.5"><BeforeAfter pairs={beforeAfter} />@@ -241,50 +314,149 @@ function AudioCard({ href, label, line, tools }: { href: string; label: string;);}-export function StudiosSection({ facts, studios, audioTools, pills }: Pick<HomeShowcase, "facts" | "studios" | "audioTools" | "pills">) {+/**+ * A card with a picture drawn rather than a cover: Live edit's recorded session. Same frame,+ * name and line as a studio's card.+ */+function DrawnCard({ href, label, line, children }: { href: string; label: string; line: string; children: React.ReactNode }) {return (- <section aria-labelledby="home-studios" className={cn(SECTION, "[--cv:529px] sm:[--cv:1597px] md:[--cv:1482px] lg:[--cv:770px] xl:[--cv:795px]")}>- <SectionHead- id="home-studios"- title="Studios and tools"- count={facts.destinations}- line="Whole productions, start to finish: films, ads, shoots and series. Open any of them to look around, no account needed."- />- <HomeRail className="gap-3 sm:grid-cols-2 sm:gap-x-3 sm:gap-y-4 lg:grid-cols-4">- {studios.map((s, i) => (- <div key={s.href} className={RAIL_ITEM}>- {s.card ? (- <StudioCard href={s.href} label={s.label} line={s.line} card={s.card} zoom={!s.card.preview.video} place={staggered(i)} sizes={STUDIO_SIZES} />- ) : (- <AudioCard href={s.href} label={s.label} line={s.line} tools={audioTools} />- )}+ <IntentLink href={href} className="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring">+ <StudioPicture className="bg-media ring-1 ring-white/10">{children}</StudioPicture>+ <StudioName label={label} line={line} />+ </IntentLink>+ );+}++/** A destination's card: a cover (a clip or a still), a drawn picture (Live edit's recorded session), or Audio's waveform. */+export interface Destination {+ href: string;+ label: string;+ line: string;+ card?: HomeShowcase["studios"][number]["card"];+ drawn?: "live";+}++/** A pill under the cards: its name, and its icon from the navigation. */+export interface DestinationPill {+ href: string;+ label: string;+ icon?: LucideIcon;+}++/**+ * Home's "Studios and tools" section, and each section of an area page (/create, /studios): a heading with its count,+ * one line, the cards (a phone's rail, two a row from sm, four from lg), then the rest as pills. More than eight pills+ * scroll sideways on a phone in a long row; eight or fewer wrap. `className`: the section's own spacing.+ */+export function DestinationsSection({+ id,+ title,+ count,+ line,+ cards,+ audioTools,+ pills,+ pillsLabel,+ className,+ tap,+ grid,+ all,+ allCount,+ allNoun,+ after,+}: {+ id: string;+ title: string;+ count?: number;+ line: string;+ cards: Destination[];+ audioTools?: HomeShowcase["audioTools"];+ pills: DestinationPill[];+ pillsLabel: string;+ className?: string;+ /** Pills with a 44 px hit area (an area page; Home keeps its own). */+ tap?: boolean;+ /** Two cards a row on a phone instead of a rail (an area page, where every card should show at once). */+ grid?: boolean;+ /** "See all" beside the heading (SectionHead). */+ all?: string;+ allCount?: number;+ allNoun?: string;+ /** Pills only the viewer's island adds (the owner's), after the others. */+ after?: React.ReactNode;+}) {+ const items = cards.map((s, i) => (+ <div key={s.href} className={grid ? "min-w-0" : RAIL_ITEM}>+ {s.card ? (+ <StudioCard href={s.href} label={s.label} line={s.line} card={s.card} zoom={!s.card.preview.video} place={staggered(i)} sizes={grid ? GRID_SIZES : STUDIO_SIZES} />+ ) : s.drawn === "live" ? (+ <DrawnCard href={s.href} label={s.label} line={s.line}>+ {/* A picture inside the link: its own controls stay out of reach (the card is one tap). */}+ <div inert className="absolute inset-0">+ <LiveDemo compact className="absolute inset-0 rounded-none" /></div>+ </DrawnCard>+ ) : audioTools ? (+ <AudioCard href={s.href} label={s.label} line={s.line} tools={audioTools} />+ ) : null}+ </div>+ ));+ return (+ <section aria-labelledby={id} className={className}>+ <SectionHead id={id} title={title} count={count} line={line} all={all} allCount={allCount} allNoun={allNoun} />+ {cards.length > 0 &&+ (grid ? (+ <div className="grid grid-cols-2 gap-x-3 gap-y-4 lg:grid-cols-4">{items}</div>+ ) : (+ <HomeRail className="gap-3 sm:grid-cols-2 sm:gap-x-3 sm:gap-y-4 lg:grid-cols-4">{items}</HomeRail>))}- </HomeRail>- <h3 className="mt-6 mb-2 font-sans text-[13px] text-muted-foreground">Also in Fuobe</h3>- {/* A phone scrolls the pills sideways in three rows. */}- <FadeRow>- <ul className="flex flex-wrap gap-1.5 max-sm:w-[72rem]">- {pills.map((p) => {- const Icon = navIcon(p.href);- return (- <li key={p.href}>- <IntentLink- href={p.href}- className="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent"- >- {Icon && <Icon className="size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" />}- {p.label}- </IntentLink>- </li>- );- })}- </ul>- </FadeRow>+ {(pills.length > 0 || after) && (+ <>+ {/* A section of pills only needs no label of its own: its heading is it. */}+ {cards.length > 0 ? <h3 className="mt-6 mb-2 font-sans text-[13px] text-muted-foreground">{pillsLabel}</h3> : <h3 className="sr-only">{pillsLabel}</h3>}+ {/* A phone scrolls many pills sideways in three rows; a few wrap. */}+ <FadeRow>+ <ul className={cn("flex flex-wrap gap-1.5", pills.length > 8 && "max-sm:w-[72rem]")}>+ {pills.map((p) => {+ const Icon = p.icon;+ return (+ <li key={p.href}>+ <IntentLink href={p.href} className={cn(PILL, tap && PILL_TAP)}>+ {Icon && <Icon className={PILL_ICON} />}+ {p.label}+ </IntentLink>+ </li>+ );+ })}+ {after}+ </ul>+ </FadeRow>+ </>+ )}</section>);}++export function StudiosSection({ facts, studios, audioTools, pills }: Pick<HomeShowcase, "facts" | "studios" | "audioTools" | "pills">) {+ return (+ <DestinationsSection+ id="home-studios"+ title="Studios and tools"+ count={facts.destinations}+ line="Whole productions, start to finish: films, ads, shoots and series. Open any of them to look around, no account needed."+ cards={studios}+ audioTools={audioTools}+ pills={pills.map((p) => ({ ...p, icon: navIcon(p.href) }))}+ pillsLabel="Also in Fuobe"+ all={area("studios").href}+ allCount={studioCount()}+ allNoun="studios"+ className={cn(SECTION, "[--cv:529px] sm:[--cv:1597px] md:[--cv:1482px] lg:[--cv:770px] xl:[--cv:795px]")}+ />+ );+}+/*** Assist plans with the install's own AI, so only the studio's owner can use it (src/lib/guest-access.ts): everyone* else reads it as what they get on their own install, with the way to run one (AssistTag, AssistAction,diff --git a/src/components/home/pill.ts b/src/components/home/pill.tsnew file mode 100644index 00000000..60ddd346--- /dev/null+++ b/src/components/home/pill.ts@@ -0,0 +1,10 @@+/** Home's pills ("Also in Fuobe", "Just added") and the area pages': plain strings, so client islands share them. */++/** A pill: 32 px to look at. */+export const PILL = "group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent";++/** An area page's pill reaches 44 px to tap (its hit area overlaps the gap above and below it). */+export const PILL_TAP = "relative after:absolute after:inset-x-0 after:-inset-y-1.5 after:content-['']";++/** A pill's icon. */+export const PILL_ICON = "size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text";diff --git a/src/components/nav/bar-split.tsx b/src/components/nav/bar-split.tsxnew file mode 100644index 00000000..7bd6a5a5--- /dev/null+++ b/src/components/nav/bar-split.tsx@@ -0,0 +1,279 @@+"use client";++import { ChevronDown } from "lucide-react";+import { useCallback, useEffect, useRef, useState } from "react";+import { IntentLink } from "@/components/intent-link";+import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";+import { isPlainClick } from "@/lib/use-tapped-tab";+import { cn } from "@/lib/utils";+import { warmNav, type NavPanel } from "./nav-prefetch";+import { useNavUi } from "./nav-ui";++/*+ * A bar item with a page and a menu (Create, Studios, Motions & effects): one pill made of two controls. Its name is a+ * link to the area's page (/create, /studios, /motions-and-effects); the chevron beside it opens the menu, as does+ * ArrowDown on the name, and, with a mouse, resting on the item (not on the item of the page you are on). A touch+ * screen never opens it by hovering: a tap on the name goes to the page, a tap on the chevron opens the menu.+ *+ * States use the bar's own attributes, so its styling applies: aria-current="page" on the name on the area's page,+ * data-active on the pill inside the area, data-state="open" on the chevron and data-open on the pill while the menu+ * is open. The pill is exactly as wide as a plain item with a chevron (the name keeps its padding on the left, the+ * chevron takes the right padding and the gap), so the bar never grows.+ */++/** The pill around the two controls. */+export const BAR_SPLIT =+ "group/bar-item inline-flex h-10 shrink-0 items-stretch rounded-[10px] text-[14px] whitespace-nowrap text-foreground/80 [@media(pointer:coarse)]:h-11 data-[active]:bg-accent data-[active]:font-semibold data-[active]:text-foreground has-[[aria-current=page]]:bg-accent has-[[aria-current=page]]:text-foreground data-[open]:bg-accent data-[open]:text-foreground motion-safe:transition-colors";++/** The name: the area's page. */+export const BAR_LABEL =+ "inline-flex items-center gap-1.5 rounded-l-[10px] pr-1 pl-2.5 outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset aria-[current=page]:font-semibold motion-safe:transition-colors min-[1440px]:pl-3.5";++/** The chevron: the menu. 26 px wide (30 from 1440) with a mouse; 44 px to tap. */+export const BAR_CHEVRON =+ "inline-flex w-[26px] items-center justify-center rounded-r-[10px] text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[state=open]:text-foreground motion-safe:transition-colors min-[1440px]:w-[30px] [@media(pointer:coarse)]:w-11";++export const BarChevron = () => <ChevronDown aria-hidden className="size-3.5 group-data-[open]/bar-item:rotate-180 motion-safe:transition-transform" />;++/**+ * How long the pointer rests on an item before its menu opens (long enough that sweeping along the bar to the search+ * opens nothing), and how long after it leaves before it closes.+ */+export const HOVER_OPEN_MS = 300;+export const HOVER_CLOSE_MS = 250;+/** Only a mouse (a fine pointer that can hover) opens a menu by resting on it. */+export const HOVER_QUERY = "(hover: hover) and (pointer: fine)";++const canHover = (e: React.PointerEvent) => e.pointerType === "mouse" && typeof window !== "undefined" && window.matchMedia(HOVER_QUERY).matches;++/**+ * Open on rest, close on leave, for a menu opened by hovering only: a menu opened by a click or a key stays until it is+ * closed (pinned). `open`: whether it is open now; `onOpen`/`onClose` change it; `off`: resting opens nothing (the+ * item is the page you are on, so its menu would only cover it). Put `enter`/`leave` on the item and on its panel, so+ * moving from one to the other keeps it open.+ */+export function useHoverIntent(open: boolean, onOpen: () => void, onClose: () => void, off = false) {+ const timer = useRef<ReturnType<typeof setTimeout>>(undefined);+ /** Opened by hovering and not pinned since. */+ const byHover = useRef(false);+ const openRef = useRef(open);+ const cancel = useCallback(() => clearTimeout(timer.current), []);+ useEffect(() => cancel, [cancel]);+ useEffect(() => {+ openRef.current = open;+ // Closed some other way (Esc, a click outside, a row followed): the next hover starts afresh.+ if (!open) byHover.current = false;+ }, [open]);++ const enter = useCallback(+ (e: React.PointerEvent) => {+ if (!canHover(e)) return;+ cancel();+ if (openRef.current || off) return;+ timer.current = setTimeout(() => {+ byHover.current = true;+ onOpen();+ }, HOVER_OPEN_MS);+ },+ [cancel, onOpen, off],+ );+ const leave = useCallback(+ (e: React.PointerEvent) => {+ if (!canHover(e)) return;+ cancel();+ if (!openRef.current || !byHover.current) return;+ timer.current = setTimeout(() => {+ byHover.current = false;+ onClose();+ }, HOVER_CLOSE_MS);+ },+ [cancel, onClose],+ );+ /** A click or a key took over: no timer, and the menu stays open until closed. */+ const pin = useCallback(() => {+ cancel();+ byHover.current = false;+ }, [cancel]);+ return { enter, leave, cancel, pin, openedByHover: () => byHover.current };+}++/**+ * Opened by resting the pointer: focus stays where it was (a prompt being typed keeps its keys, and the menu's type-to-jump+ * never takes them). Radix's root menu content takes onOpenAutoFocus at run time; its public props leave it out.+ */+const keepFocusOnHover = (byHover: () => boolean) =>+ ({+ onOpenAutoFocus: (e: Event) => {+ if (byHover()) e.preventDefault();+ },+ }) as unknown as Partial<React.ComponentProps<typeof DropdownMenuContent>>;++/**+ * A split item whose menu is a Radix menu (Create, Motions & effects): arrow keys, typeahead, Esc and focus return come+ * with it. `name`: the chevron's accessible name ("Create menu"); `panel`: the routes to load ahead when it opens;+ * `onTap`: the name was clicked (the bar marks it at once).+ */+export function BarSplitMenu({+ href,+ label,+ name,+ active,+ current,+ panel,+ onTap,+ className,+ contentClassName,+ children,+}: {+ href: string;+ label: React.ReactNode;+ name: string;+ active?: boolean;+ current?: boolean;+ panel: NavPanel;+ onTap?: (href: string) => void;+ className?: string;+ contentClassName?: string;+ children: React.ReactNode;+}) {+ const [open, setOpen] = useState(false);+ const [offset, setOffset] = useState(0);+ const { launcherOpen, setLauncherOpen } = useNavUi();+ const pill = useRef<HTMLDivElement>(null);+ const nameLink = useRef<HTMLAnchorElement>(null);+ const chevron = useRef<HTMLButtonElement>(null);+ const content = useRef<HTMLDivElement>(null);+ /** Opened from the name with ArrowDown: the first row takes focus, and Esc brings it back to the name. */+ const focusFirst = useRef(false);+ const fromName = useRef(false);+ /** Closed because the pointer left: focus stays where it is (on the page), not on the chevron. */+ const quietClose = useRef(false);++ /** Open or close. `pinned`: by a click or a key, so its rows start loading; a bare hover loads them only once the pointer reaches the menu. */+ const show = useCallback(+ (o: boolean, pinned = true) => {+ if (o) {+ // The menu lines up with the pill's left edge, not the chevron's.+ const p = pill.current?.getBoundingClientRect();+ const c = chevron.current?.getBoundingClientRect();+ if (p && c) setOffset(p.left - c.left);+ if (pinned) warmNav(panel);+ }+ setOpen(o);+ },+ [panel],+ );+ // Opened from the name with ArrowDown: once the menu has taken focus, its first row gets it.+ useEffect(() => {+ if (!open || !focusFirst.current) return;+ focusFirst.current = false;+ const id = requestAnimationFrame(() => content.current?.querySelector<HTMLElement>('[role="menuitem"]')?.focus());+ return () => cancelAnimationFrame(id);+ }, [open]);+ const hover = useHoverIntent(+ open,+ useCallback(() => {+ fromName.current = false;+ // One panel at a time: the Studios launcher, open from a click, gives way (focus stays where it is).+ if (launcherOpen) setLauncherOpen(false);+ show(true, false);+ }, [show, launcherOpen, setLauncherOpen]),+ useCallback(() => {+ quietClose.current = true;+ show(false);+ }, [show]),+ current,+ );++ return (+ <DropdownMenu+ modal={false}+ open={open}+ onOpenChange={(o) => {+ if (o) {+ hover.pin();+ fromName.current = false;+ }+ show(o);+ }}+ >+ <div+ ref={pill}+ data-bar-split+ data-active={active || undefined}+ data-open={open || undefined}+ className={cn(BAR_SPLIT, className)}+ onPointerEnter={hover.enter}+ onPointerLeave={hover.leave}+ >+ <IntentLink+ ref={nameLink}+ href={href}+ aria-current={current ? "page" : undefined}+ className={BAR_LABEL}+ onClick={(e) => {+ hover.cancel();+ if (open) {+ quietClose.current = true;+ setOpen(false);+ }+ if (isPlainClick(e)) onTap?.(href);+ }}+ onKeyDown={(e) => {+ if (e.key !== "ArrowDown" || e.altKey || e.metaKey || e.ctrlKey) return;+ e.preventDefault();+ focusFirst.current = true;+ fromName.current = true;+ hover.pin();+ show(true);+ }}+ >+ {label}+ </IntentLink>+ <DropdownMenuTrigger+ ref={chevron}+ aria-label={name}+ className={BAR_CHEVRON}+ onPointerDown={(e) => {+ // Open by hovering: a click on the chevron keeps it open (pins it) rather than closing it.+ if (open && hover.openedByHover()) {+ e.preventDefault();+ hover.pin();+ }+ }}+ >+ <BarChevron />+ </DropdownMenuTrigger>+ </div>+ <DropdownMenuContent+ ref={content}+ align="start"+ alignOffset={offset}+ sideOffset={8}+ collisionPadding={12}+ className={contentClassName}+ onPointerEnter={(e) => {+ hover.enter(e);+ warmNav(panel);+ }}+ onPointerLeave={hover.leave}+ {...keepFocusOnHover(hover.openedByHover)}+ onCloseAutoFocus={(e) => {+ if (quietClose.current) {+ quietClose.current = false;+ e.preventDefault();+ return;+ }+ // Opened from the name with ArrowDown: Esc goes back to the name, not the chevron.+ if (fromName.current) {+ fromName.current = false;+ e.preventDefault();+ nameLink.current?.focus();+ }+ }}+ >+ {children}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}diff --git a/src/components/nav/create-menu.tsx b/src/components/nav/create-menu.tsxindex a1b8cb88..8e9f4e06 100644--- a/src/components/nav/create-menu.tsx+++ b/src/components/nav/create-menu.tsx@@ -1,16 +1,17 @@"use client";-import { ChevronDown, Plus } from "lucide-react";+import { ArrowRight, Plus } from "lucide-react";import { usePathname } from "next/navigation";import { useId } from "react";import { IntentLink } from "@/components/intent-link";-import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";+import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator } from "@/components/ui/dropdown-menu";import { Kbd } from "@/components/ui/kbd";import { navActive, NEW_CREATION_HREF } from "@/lib/nav";-import { entry, visibleTo, type NavEntry, type ViewerKind } from "@/lib/nav-model";+import { area } from "@/lib/nav-areas";+import { CREATE_COLUMNS, entry, visibleTo, type NavEntry, type ViewerKind } from "@/lib/nav-model";import { cn } from "@/lib/utils";+import { BarSplitMenu } from "./bar-split";import { NavIcon } from "./cover-thumb";-import { warmNav } from "./nav-prefetch";import { useViewerKind } from "./nav-ui";/*@@ -26,11 +27,8 @@ import { useViewerKind } from "./nav-ui";export const NAV_MENU_ITEM ="focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[current]:shadow-[inset_3px_0_0_var(--brand-text)]";-/** The two columns, in order. Storyboard plans a film, so it sits with Make (its card is in the launcher's Film column). */-export const CREATE_COLUMNS = [- { label: "Make", ids: ["image", "video", "assist", "canvas", "storyboard"] },- { label: "Edit a picture", ids: ["edit", "live-edit", "inpaint", "layers", "color-grade"] },-] as const;+/** The two columns, in order: kept in the navigation model, so the /create page (a server component) reads them too. */+export { CREATE_COLUMNS };/** The Create columns this viewer may see. */export function createColumns(kind: ViewerKind | undefined): { label: string; entries: NavEntry[] }[] {@@ -84,16 +82,23 @@ export function CreateList({ variant, onNavigate }: { variant: "menu" | "sheet";))}</div><DropdownMenuSeparator className="my-1.5" />- <DropdownMenuItem asChild className={cn("h-10 gap-2.5 rounded-lg px-2.5 text-[13.5px] font-medium", NAV_MENU_ITEM)}>- <IntentLink href={NEW_CREATION_HREF} eager>- <Plus aria-hidden className="size-4 text-brand-text" />- New creation- <span className="ml-auto text-[12px] font-normal text-muted-foreground [@media(hover:none)]:hidden">A fresh composer on Home</span>- <Kbd aria-hidden className="[@media(hover:none)]:hidden">- ↵- </Kbd>- </IntentLink>- </DropdownMenuItem>+ <div className="grid grid-cols-2 gap-x-1">+ <DropdownMenuItem asChild className={cn("h-10 gap-2.5 rounded-lg px-2.5 text-[13.5px] font-medium", NAV_MENU_ITEM)}>+ <IntentLink href={NEW_CREATION_HREF} eager>+ <Plus aria-hidden className="size-4 text-brand-text" />+ New creation+ <Kbd aria-hidden className="ml-auto [@media(hover:none)]:hidden">+ ↵+ </Kbd>+ </IntentLink>+ </DropdownMenuItem>+ <DropdownMenuItem asChild className={cn("group/all h-10 gap-2 rounded-lg px-2.5 text-[13.5px] font-medium text-brand-text", NAV_MENU_ITEM)}>+ <IntentLink href={CREATE_AREA_HREF} aria-current={pathname === CREATE_AREA_HREF ? "page" : undefined} aria-label="See all of Create">+ See all+ <ArrowRight aria-hidden className="size-4 motion-safe:transition-transform group-hover/all:translate-x-0.5" />+ </IntentLink>+ </DropdownMenuItem>+ </div></>);const follow = (e: React.MouseEvent) => {@@ -146,17 +151,26 @@ export function CreateList({ variant, onNavigate }: { variant: "menu" | "sheet";);}-/** The bar's Create menu. `className`: the bar's item look for the trigger; `active`: a Create page is open. */-export function CreateMenu({ className, active }: { className?: string; active?: boolean }) {+/** Create's own page: everything it holds, with covers ("See all" in the menu and on the phone's sheet). */+export const CREATE_AREA_HREF = area("create").href;++/**+ * The bar's Create item: its name goes to /create, its chevron (or ArrowDown, or resting on it with a mouse) opens the+ * menu. `active`: a Create page is open; `current`: /create itself; `onTap`: the name was clicked.+ */+export function CreateMenu({ active, current, onTap }: { active?: boolean; current?: boolean; onTap?: (href: string) => void }) {return (- <DropdownMenu modal={false} onOpenChange={(o) => o && warmNav("create")}>- <DropdownMenuTrigger className={className} data-active={active || undefined}>- Create- <ChevronDown aria-hidden className="size-3.5 text-muted-foreground motion-safe:transition-transform group-data-[state=open]/bar-item:rotate-180" />- </DropdownMenuTrigger>- <DropdownMenuContent align="start" sideOffset={8} collisionPadding={12} className="w-[520px] max-w-[calc(100vw-24px)] p-1.5">- <CreateList variant="menu" />- </DropdownMenuContent>- </DropdownMenu>+ <BarSplitMenu+ href={CREATE_AREA_HREF}+ label="Create"+ name="Create menu"+ active={active}+ current={current}+ panel="create"+ onTap={onTap}+ contentClassName="w-[520px] max-w-[calc(100vw-24px)] p-1.5"+ >+ <CreateList variant="menu" />+ </BarSplitMenu>);}diff --git a/src/components/nav/goal-row.tsx b/src/components/nav/goal-row.tsxindex 8dd05981..d53e006e 100644--- a/src/components/nav/goal-row.tsx+++ b/src/components/nav/goal-row.tsx@@ -4,10 +4,12 @@ import { ArrowRight, LayoutGrid, Sparkles, X } from "lucide-react";import { useEffect, useRef, useState } from "react";import { CardPending, IntentLink } from "@/components/intent-link";import { CoverThumb } from "@/components/nav/cover-thumb";-import { useNavUi, useViewerKind } from "@/components/nav/nav-ui";+import { useViewerKind } from "@/components/nav/nav-ui";+import { area } from "@/lib/nav-areas";import { NAV_ICONS } from "@/lib/nav-icons";import { GOALS, goalBand, isNew, tapHref, type GoalId, type NavEntry, type ViewerKind } from "@/lib/nav-model";import { cn } from "@/lib/utils";+import { GOAL_STRIP, GOAL_TAB, GOAL_TAB_ON } from "./goal-tab";/*** Home's goal row: six goals under the hero, each a button that opens a band of that goal's studios, one-tap presets@@ -240,7 +242,6 @@ export function GoalBand({ id, kind, names, onClose }: { id: GoalId; kind: Viewe*/export function GoalRow({ names }: { names: Readonly<Record<string, string>> }) {const kind = useViewerKind();- const { openStudios } = useNavUi();const [open, setOpen] = useState<GoalId | null>(null);// The goal that holds the row's one tab stop (the last one focused or opened).const [stop, setStop] = useState(0);@@ -285,7 +286,7 @@ export function GoalRow({ names }: { names: Readonly<Record<string, string>> })close();}}>- <div className="flex h-[52px] items-stretch border-y max-sm:-mx-4">+ <div className={GOAL_STRIP}>{/* A phone scrolls the goals sideways inside the row, never the page. */}<divref={scroller}@@ -315,13 +316,7 @@ export function GoalRow({ names }: { names: Readonly<Record<string, string>> })setOpen(on ? null : g.id);if (!on) reveal(e.currentTarget);}}- className={cn(- "flex shrink-0 snap-start items-center gap-2 rounded-t-[10px] border-b-2 border-transparent px-4 text-[14px] whitespace-nowrap text-foreground/80 outline-none hover:bg-accent hover:text-foreground motion-safe:transition-colors",- // A tablet's row holds all six as words alone (a phone's scrolls, with the icons).- "md:max-lg:px-2.5 md:max-lg:text-[13.5px]",- "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",- on && "border-primary bg-accent text-foreground",- )}+ className={cn(GOAL_TAB, on && GOAL_TAB_ON)}><Icon aria-hidden className={cn("size-4 shrink-0 md:max-lg:hidden", on ? "text-brand-text" : "text-muted-foreground")} />{/* The label's bold copy keeps its width, so opening a goal never moves the ones beside it. */}@@ -335,9 +330,9 @@ export function GoalRow({ names }: { names: Readonly<Record<string, string>> }));})}</div>- <button- type="button"- onClick={() => openStudios()}+ {/* Every studio and tool on one page, with covers (the bar's Studios menu is the quick way). */}+ <IntentLink+ href={area("studios").href}className={cn("flex shrink-0 items-center justify-center gap-2 self-center rounded-[10px] text-[13.5px] font-medium text-brand-text hover:bg-brand-faint motion-safe:transition-colors",// Its words from xl; narrower, its icon (with the words for screen readers) leaves the goals the room.@@ -347,7 +342,7 @@ export function GoalRow({ names }: { names: Readonly<Record<string, string>> })><LayoutGrid aria-hidden className="size-[15px]" /><span className="max-xl:sr-only">All studios and tools</span>- </button>+ </IntentLink></div>{open && <GoalBand key={open} id={open} kind={kind} names={names} onClose={close} />}</div>diff --git a/src/components/nav/goal-tab.ts b/src/components/nav/goal-tab.tsnew file mode 100644index 00000000..79d8656a--- /dev/null+++ b/src/components/nav/goal-tab.ts@@ -0,0 +1,18 @@+/**+ * The goal row's look (Home, under the composer), shared with the area pages' section tabs so both read as one row:+ * a 52 px strip between two rules, and tabs that underline the one that is on. Plain strings, so a server component+ * can use them too.+ */++/** The strip: 52 px between two rules, reaching a phone's edges. */+export const GOAL_STRIP = "flex h-[52px] items-stretch border-y max-sm:-mx-4";++/** A tab in the strip (an icon, then its label); `GOAL_TAB_ON` marks the open one. */+export const GOAL_TAB = [+ "flex shrink-0 snap-start items-center gap-2 rounded-t-[10px] border-b-2 border-transparent px-4 text-[14px] whitespace-nowrap text-foreground/80 outline-none hover:bg-accent hover:text-foreground motion-safe:transition-colors",+ // A tablet's row holds all six as words alone (a phone's scrolls, with the icons).+ "md:max-lg:px-2.5 md:max-lg:text-[13.5px]",+ "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",+].join(" ");++export const GOAL_TAB_ON = "border-primary bg-accent text-foreground";diff --git a/src/components/nav/nav-prefetch.tsx b/src/components/nav/nav-prefetch.tsxindex 08b453fb..a92fe03e 100644--- a/src/components/nav/nav-prefetch.tsx+++ b/src/components/nav/nav-prefetch.tsx@@ -14,7 +14,9 @@ import { entriesFor, type ViewerKind } from "@/lib/nav-model";/** A panel whose routes load when it opens: the launcher (and the Studios sheet), Create, More. */export type NavPanel = "studios" | "create" | "more";-const MORE_IDS = ["apps", "motions", "effects", "canvas", "assist"];+const MORE_IDS = ["apps", "motions", "effects", "canvas", "assist", "area-motions"];+/** Each panel's "See all": its area page loads with the panel's rows. */+const AREA_OF: Record<NavPanel, string> = { studios: "area-studios", create: "area-create", more: "area-motions" };/*** The routes one tap in a panel leads to (`panel`), or in all of them with the library's (no `panel`): on the site, once@@ -23,13 +25,15 @@ const MORE_IDS = ["apps", "motions", "effects", "canvas", "assist"];export function prefetchHrefs(kind: ViewerKind | undefined, panel?: NavPanel): string[] {const hrefs = entriesFor(kind).filter((e) =>- panel === "studios"- ? !!e.group- : panel === "create"- ? e.kind === "create"- : panel === "more"- ? MORE_IDS.includes(e.id)- : !!e.group || e.kind === "create" || e.kind === "library",+ panel && e.id === AREA_OF[panel]+ ? true+ : panel === "studios"+ ? !!e.group+ : panel === "create"+ ? e.kind === "create"+ : panel === "more"+ ? MORE_IDS.includes(e.id)+ : !!e.group || e.kind === "create" || e.kind === "library" || e.kind === "area",).map((e) => e.href).filter((h) => h.startsWith("/") && !h.includes("#"));diff --git a/src/components/nav/phone-nav.ts b/src/components/nav/phone-nav.tsindex 62ab2f7c..8e746be2 100644--- a/src/components/nav/phone-nav.ts+++ b/src/components/nav/phone-nav.ts@@ -19,13 +19,16 @@ function under(path: string, pathname: string): boolean {export function activePhoneTab(pathname: string,sheet: PhoneSheet | null,- entry?: { kind: string; group?: string } | null,+ entry?: { id?: string; kind: string; group?: string } | null,): PhoneTab | null {if (sheet) return sheet;if (!pathname) return null;if (pathname === "/") return "home";if (under("/library", pathname)) return "library";if (under("/settings", pathname) || under("/connect", pathname)) return "you";+ // The area pages the Create and Studios sheets lead to ("See all") are theirs.+ if (entry?.id === "area-studios") return "studios";+ if (entry?.id === "area-create") return "create";if (entry?.group) return "studios";if (entry?.kind === "create") return "create";return null;diff --git a/src/components/nav/phone-sheets.tsx b/src/components/nav/phone-sheets.tsxindex f2f18f89..35bc2536 100644--- a/src/components/nav/phone-sheets.tsx+++ b/src/components/nav/phone-sheets.tsx@@ -3,7 +3,8 @@import { usePathname } from "next/navigation";import { Suspense, useCallback, useEffect, useRef, useState } from "react";import { Dialog as SheetPrimitive } from "radix-ui";-import { Search, XIcon } from "lucide-react";+import { ArrowRight, Search, XIcon } from "lucide-react";+import { IntentLink } from "@/components/intent-link";import { AccountSections } from "@/components/nav/account-menu";import { CreateList } from "@/components/nav/create-menu";import { PHONE_QUERY, useNavUi, type NavSheet } from "@/components/nav/nav-ui";@@ -11,10 +12,14 @@ import { useSearchPalette } from "@/components/nav/search-context";import { ComputerNoteBlock } from "@/components/nav/status-chips";import { StudiosSheet } from "@/components/nav/studios-sheet";import { warmNav } from "@/components/nav/nav-prefetch";+import { area } from "@/lib/nav-areas";import { cn } from "@/lib/utils";const TITLES: Record<NavSheet, string> = { studios: "Studios", create: "Create", you: "You" };+/** "See all" in a sheet's header: the area's own page, with covers and lines. */+const SEE_ALL: Partial<Record<NavSheet, string>> = { studios: area("studios").href, create: area("create").href };+/** A drag down this far on the sheet's top (handle and title) closes it, in px. */const SWIPE_CLOSE = 56;@@ -172,20 +177,32 @@ export function PhoneSheets() {<span aria-hidden className="mx-auto h-1 w-10 rounded-full bg-border-strong" /><div className="flex items-center gap-3 pr-2 pl-4"><SheetPrimitive.Title className="font-heading text-[28px] leading-none font-normal text-foreground">{TITLES[shown]}</SheetPrimitive.Title>+ {SEE_ALL[shown] && (+ // A link in the sheet: following it closes the sheet (onClickCapture above).+ <IntentLink+ href={SEE_ALL[shown]}+ aria-label={`See all ${TITLES[shown].toLowerCase()}`}+ className="group/all ml-auto inline-flex h-11 items-center gap-1 rounded-full px-3 text-[13px] font-medium text-brand-text outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-ring"+ >+ See all+ <ArrowRight aria-hidden className="size-4" />+ </IntentLink>+ )}{shown === "studios" && (// In a full-screen studio Search is in the sheet's shortcuts instead.<buttontype="button"onClick={openSearch}- className="ml-auto inline-flex h-11 items-center gap-1.5 rounded-full px-3 text-[13px] font-medium text-brand-text outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-ring [html[data-fullscreen-studio]_&]:invisible"+ aria-label="Search everything"+ className="grid size-11 shrink-0 place-items-center rounded-full text-brand-text outline-none [-webkit-tap-highlight-color:transparent] hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring [html[data-fullscreen-studio]_&]:hidden">- <Search className="size-4" aria-hidden /> Search everything+ <Search className="size-[18px]" aria-hidden /></button>)}<SheetPrimitive.CloseclassName={cn("grid size-11 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",- shown !== "studios" && "ml-auto",+ !SEE_ALL[shown] && "ml-auto",)}><XIcon className="size-5" aria-hidden />diff --git a/src/components/nav/search-context.tsx b/src/components/nav/search-context.tsxindex 4cf7907e..55c7aa65 100644--- a/src/components/nav/search-context.tsx+++ b/src/components/nav/search-context.tsx@@ -13,10 +13,17 @@ import type { LauncherGroupId } from "@/lib/nav-model";* a pointer rests on the search field.*/+/** A search inside one area page (/create, /studios): only its pages, named on a chip that removes it. */+export interface PaletteScope {+ label: string;+ /** NavEntry ids. */+ ids: string[];+}+export interface SearchPaletteApi {isOpen: boolean;- /** Open on a query, or on "Every studio" filtered to one group. */- open(opts?: { query?: string; group?: LauncherGroupId }): void;+ /** Open on a query, on "Every studio" filtered to one group, or inside one area (`scope`). */+ open(opts?: { query?: string; group?: LauncherGroupId; scope?: PaletteScope }): void;close(): void;/** Load the palette and its catalog now, before it's opened (hover or focus on a search control). */warm(): void;@@ -28,6 +35,7 @@ export interface PaletteSession {id: number;query?: string;group?: LauncherGroupId;+ scope?: PaletteScope;}/** The apps, motions, effects and models the palette searches (prerendered: GET /api/search-index). */@@ -87,11 +95,11 @@ export function SearchPaletteProvider({ children }: { children: React.ReactNode}, [client]);const open = useCallback(- (opts?: { query?: string; group?: LauncherGroupId }) => {+ (opts?: { query?: string; group?: LauncherGroupId; scope?: PaletteScope }) => {if (!openRef.current) returnTo.current = typeof document === "undefined" ? null : document.activeElement;openRef.current = true;warm();- setSession((s) => ({ open: true, id: s.id + 1, query: opts?.query, group: opts?.group }));+ setSession((s) => ({ open: true, id: s.id + 1, query: opts?.query, group: opts?.group, scope: opts?.scope }));},[warm],);diff --git a/src/components/nav/search-palette.tsx b/src/components/nav/search-palette.tsxindex a573ff4f..2ac9ca4c 100644--- a/src/components/nav/search-palette.tsx+++ b/src/components/nav/search-palette.tsx@@ -13,11 +13,11 @@ import { signInHref, useEngineMode, useGenerations, useModelAccess } from "@/libimport type { Generation } from "@/lib/catalog/types";import { indexEntries, KIND_LABELS, skillEntries } from "@/lib/command-search";import { useModKey } from "@/lib/keys";-import { entriesFor, LAUNCHER_GROUPS, launcherEntries, studioCount, type LauncherGroupId, type NavEntry } from "@/lib/nav-model";+import { entriesFor, entry, LAUNCHER_GROUPS, launcherEntries, studioCount, visibleTo, type LauncherGroupId, type NavEntry } from "@/lib/nav-model";import { isExternal, isThemeAction, navSearchEntries, searchNav, type NavHit, type SearchResult } from "@/lib/nav-search";import { cn } from "@/lib/utils";import { useViewerKind } from "./nav-ui";-import { fetchPaletteIndex, PALETTE_INDEX_KEY, type PaletteSession } from "./search-context";+import { fetchPaletteIndex, PALETTE_INDEX_KEY, type PaletteScope, type PaletteSession } from "./search-context";import { AlsoTile, BestRow, HitRow, RecentRow, sectionHeading, StudioTile } from "./search-results";/*@@ -120,7 +120,7 @@ export function SearchPalette({ session, onClose, takeReturn }: { session: Palet<DialogPrimitive.Description className="sr-only">Find a studio, a tool, an app, a camera motion, an effect, a model, a setting or a recent creation, or browse every studio.</DialogPrimitive.Description>- <PaletteBody key={session.id} initialQuery={session.query ?? ""} initialGroup={session.group} onPick={pick} onOpenRecent={openRecent} onClose={onClose} />+ <PaletteBody key={session.id} initialQuery={session.query ?? ""} initialGroup={session.group} initialScope={session.scope} onPick={pick} onOpenRecent={openRecent} onClose={onClose} /></DialogPrimitive.Content></DialogPrimitive.Portal></DialogPrimitive.Root>@@ -175,18 +175,22 @@ export function startValue(searching: boolean, result: SearchResult, recents: Piexport function PaletteBody({initialQuery,initialGroup,+ initialScope,onPick,onOpenRecent,onClose,}: {initialQuery: string;initialGroup?: LauncherGroupId;+ /** Search only these pages (an area's), until its chip is removed. */+ initialScope?: PaletteScope;onPick: (href: string, id?: string) => void;onOpenRecent: (g: Generation) => void;onClose: () => void;}) {const [q, setQ] = useState(initialQuery);const [group, setGroup] = useState<Group>(initialGroup ?? "all");+ const [scope, setScope] = useState(initialScope);const dq = useDebounced(q.trim(), 200);const kind = useViewerKind();const mode = useEngineMode();@@ -200,16 +204,19 @@ export function PaletteBody({useActiveDescendant(input, list);// Nothing a viewer can't see is searched (and before the viewer is known: what a guest may see).- const nav = useMemo(() => navSearchEntries(entriesFor(kind)), [kind]);+ // Inside an area: its pages only (no apps, models or skills), until the chip is removed.+ const scoped = useMemo(() => (scope ? scope.ids.map(entry).filter((e): e is NavEntry => !!e && visibleTo(e, kind)) : undefined), [scope, kind]);+ const nav = useMemo(() => navSearchEntries(scoped ?? entriesFor(kind)), [scoped, kind]);const entries = useMemo(- () => [...nav, ...skillEntries(skills.data ?? []), ...(index.data ? indexEntries(index.data, mode, access, { owner: kind === "owner" }) : [])],- [nav, skills.data, index.data, mode, access, kind],+ () =>+ scoped ? nav : [...nav, ...skillEntries(skills.data ?? []), ...(index.data ? indexEntries(index.data, mode, access, { owner: kind === "owner" }) : [])],+ [scoped, nav, skills.data, index.data, mode, access, kind],);// Not deferred: ranking every entry takes a millisecond or two, and Enter must act on what was typed.const result = useMemo(() => searchNav(q, entries), [q, entries]);const searching = !!q.trim();const recentItems = (recent.data ?? []).filter((g) => g.outputs[0]);- const tiles = useMemo(() => launcherEntries(kind, group === "all" ? undefined : group), [kind, group]);+ const tiles = useMemo(() => scoped ?? launcherEntries(kind, group === "all" ? undefined : group), [scoped, kind, group]);const best = startValue(searching, result, recentItems, tiles);const [moved, setMoved] = useState<{ q: string; group: Group; value: string } | null>(null);@@ -233,6 +240,24 @@ export function PaletteBody({><div className="flex h-[68px] shrink-0 items-center gap-3.5 border-b border-brand-text/25 pr-3.5 pl-[22px] max-md:pl-4"><Search aria-hidden className="size-5 shrink-0 text-brand-text" />+ {scope && (+ <button+ type="button"+ onKeyDown={keepKeys}+ onClick={() => {+ setScope(undefined);+ input.current?.focus();+ }}+ aria-label={`Searching in ${scope.label}. Search everything instead`}+ className={cn(+ "inline-flex h-8 shrink-0 items-center gap-1 rounded-full border border-brand-text/40 bg-brand-faint pr-1.5 pl-2.5 text-[13px] font-medium text-brand-text hover:bg-brand-faint/70 [@media(pointer:coarse)]:h-11",+ focusRing,+ )}+ >+ In {scope.label}+ <X aria-hidden className="size-3.5" />+ </button>+ )}<CommandPrimitive.Inputref={input}value={q}@@ -279,7 +304,7 @@ export function PaletteBody({{/* The goal chips: buttons, so outside the list (a listbox holds options only). With nothing typed they head thestudios right under them; while searching the studios come last, under their own heading. */}- {!searching && (+ {!searching && !scoped && (<div className="shrink-0 px-5 pt-2.5 max-md:px-3"><div className="flex flex-wrap items-center gap-x-2.5 py-1 md:h-10 md:flex-nowrap md:py-0"><span aria-hidden className="ml-1.5 text-[11px] leading-[14px] font-semibold tracking-[.08em] text-brand-text uppercase">@@ -365,8 +390,8 @@ export function PaletteBody({</>)}<CommandPrimitive.Group- heading={groupLabel ? `Every studio · ${tiles.length} in ${groupLabel}` : "Every studio"}- className={cn(searching ? cn("border-t pt-3", sectionHeading) : "**:[[cmdk-group-heading]]:sr-only")}+ heading={scope ? `In ${scope.label} · ${tiles.length}` : groupLabel ? `Every studio · ${tiles.length} in ${groupLabel}` : "Every studio"}+ className={cn(searching ? cn("border-t pt-3", sectionHeading) : scoped ? cn("pt-3", sectionHeading) : "**:[[cmdk-group-heading]]:sr-only")}><div className="grid grid-cols-2 gap-x-2 min-[420px]:grid-cols-3 md:grid-cols-4">{tiles.map((e) => (diff --git a/src/components/nav/studios-launcher.tsx b/src/components/nav/studios-launcher.tsxindex 97ac869b..56a91c10 100644--- a/src/components/nav/studios-launcher.tsx+++ b/src/components/nav/studios-launcher.tsx@@ -1,12 +1,15 @@"use client";-import { ChevronDown, Search } from "lucide-react";+import { ArrowRight, Search } from "lucide-react";import { usePathname } from "next/navigation";import { useCallback, useEffect, useId, useRef, useState } from "react";import { IntentLink } from "@/components/intent-link";import { Kbd } from "@/components/ui/kbd";+import { area } from "@/lib/nav-areas";import { isNew, launcherActive, launcherColumns, studioCount, type NavEntry, type ViewerKind } from "@/lib/nav-model";+import { isPlainClick } from "@/lib/use-tapped-tab";import { cn } from "@/lib/utils";+import { BAR_CHEVRON, BAR_LABEL, BAR_SPLIT, BarChevron } from "./bar-split";import { CoverThumb } from "./cover-thumb";import { useNavUi, useViewerKind } from "./nav-ui";import { useSearchPalette } from "./search-context";@@ -21,6 +24,9 @@ import { warmNav } from "./nav-prefetch";export const LAUNCHER_ID = "studios-launcher";+/** Every studio on one page, with covers and lines ("See all", the bar item's name). */+export const STUDIOS_AREA_HREF = area("studios").href;+export type LauncherKey = "ArrowUp" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "Home" | "End";/**@@ -163,6 +169,16 @@ export function LauncherPanel({ onClose, onSearch }: { onClose: () => void; onSe<div className="mx-auto max-w-[1440px] px-6 pt-5 pb-6 lg:px-10 lg:pt-6 lg:pb-7"><div className="flex items-center gap-3.5 pb-4"><p className="text-[13px] text-muted-foreground">{studioCount()} studios, grouped by what you want to make</p>+ {/* A plain link in Tab order before the grid; the grid's arrow keys skip it (it has no data-col). */}+ <IntentLink+ href={STUDIOS_AREA_HREF}+ aria-current={pathname === STUDIOS_AREA_HREF ? "page" : undefined}+ aria-label="See all studios"+ className={cn("group/all -ml-1 inline-flex h-9 items-center gap-1 rounded-[10px] px-2 text-[13px] font-medium text-brand-text hover:bg-brand-faint", LINK_FOCUS)}+ >+ See all+ <ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />+ </IntentLink><span className="flex-1" /><buttontype="button"@@ -183,11 +199,12 @@ export function LauncherPanel({ onClose, onSearch }: { onClose: () => void; onSe}/**- * The bar's Studios button and its panel. The panel hangs from the bar (the header is its positioned parent) and spans- * it. It is mounted, hidden, the first time the pointer or focus comes to the button, so its covers are loading before- * the click. `className`: the bar's item look; `active`: a studio's page is open.+ * The bar's Studios item and its panel: its name goes to /studios, its chevron (or ArrowDown on the name) opens the+ * panel. The panel hangs from the bar (the header is its positioned parent) and spans it. It+ * is mounted, hidden, the first time the pointer or focus comes to the item, so its covers are loading before the click.+ * `active`: a studio's page is open; `current`: /studios itself; `onTap`: the name was clicked.*/-export function StudiosLauncher({ className, active }: { className?: string; active?: boolean }) {+export function StudiosLauncher({ active, current, onTap }: { active?: boolean; current?: boolean; onTap?: (href: string) => void }) {const { launcherOpen: open, setLauncherOpen, launcherGroup, launcherReturnTo } = useNavUi();const search = useSearchPalette();const [warm, setWarm] = useState(false);@@ -264,30 +281,56 @@ export function StudiosLauncher({ className, active }: { className?: string; actif (open && to && !root.current?.contains(to)) close(false);}}>- <button- ref={trigger}- type="button"- aria-expanded={open}- // The panel is on the page once warmed (hover, focus) or open.- aria-controls={shown ? LAUNCHER_ID : undefined}- data-studios-trigger+ <div+ data-bar-splitdata-active={active || undefined}- data-state={open ? "open" : "closed"}- className={className}+ data-open={open || undefined}+ className={BAR_SPLIT}+ // The panel mounts, hidden, so its covers load before a click (it opens by a click or a key only: it spans the+ // page, so resting the pointer on the bar never covers it).onPointerEnter={() => setWarm(true)}- onFocus={() => setWarm(true)}- // Click, Enter and Space open it with focus on the first lead card (arrow keys and Tab go on from there).- onClick={toggle}- onKeyDown={(e) => {- if (e.key !== "ArrowDown" || open) return;- e.preventDefault();- toggle();- }}>- Studios- <span className="rounded-full bg-brand-faint px-1.5 py-px text-[11px] leading-4 font-semibold text-brand-text tabular-nums">{studioCount()}</span>- <ChevronDown aria-hidden className="size-3.5 text-muted-foreground group-data-[state=open]/bar-item:rotate-180 motion-safe:transition-transform" />- </button>+ <IntentLink+ href={STUDIOS_AREA_HREF}+ aria-current={current ? "page" : undefined}+ aria-label={`Studios, ${studioCount()} studios`}+ className={BAR_LABEL}+ onFocus={() => setWarm(true)}+ onClick={(e) => {+ if (open) close(false);+ if (isPlainClick(e)) onTap?.(STUDIOS_AREA_HREF);+ }}+ onKeyDown={(e) => {+ if (e.key !== "ArrowDown" || e.altKey || e.metaKey || e.ctrlKey || open) return;+ e.preventDefault();+ toggle();+ }}+ >+ Studios+ <span className="rounded-full bg-brand-faint px-1.5 py-px text-[11px] leading-4 font-semibold text-brand-text tabular-nums">{studioCount()}</span>+ </IntentLink>+ <button+ ref={trigger}+ type="button"+ aria-label="Studios menu"+ aria-expanded={open}+ // The panel is on the page once warmed (hover, focus) or open.+ aria-controls={shown ? LAUNCHER_ID : undefined}+ data-studios-trigger+ data-state={open ? "open" : "closed"}+ className={BAR_CHEVRON}+ onFocus={() => setWarm(true)}+ // Click, Enter and Space open it with focus on the first lead card (arrow keys and Tab go on from there).+ onClick={toggle}+ onKeyDown={(e) => {+ if (e.key !== "ArrowDown" || open) return;+ e.preventDefault();+ toggle();+ }}+ >+ <BarChevron />+ </button>+ </div>{shown && (<sectionref={panel}diff --git a/src/components/nav/top-bar.tsx b/src/components/nav/top-bar.tsxindex 2fcb9221..3d2c25fb 100644--- a/src/components/nav/top-bar.tsx+++ b/src/components/nav/top-bar.tsx@@ -1,15 +1,17 @@"use client";-import { ChevronDown, MoreHorizontal, Plus, Search } from "lucide-react";+import { ArrowRight, ChevronDown, MoreHorizontal, Plus, Search } from "lucide-react";import { usePathname } from "next/navigation";import { Suspense } from "react";import { IntentLink } from "@/components/intent-link";-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";import { Kbd } from "@/components/ui/kbd";import { NEW_CREATION_HREF } from "@/lib/nav";+import { area, areaOfPath, areaPageOf, type AreaId } from "@/lib/nav-areas";import { activeEntry, entry, type NavEntry } from "@/lib/nav-model";import { isPlainClick, useTappedTab } from "@/lib/use-tapped-tab";import { cn } from "@/lib/utils";+import { BarSplitMenu } from "./bar-split";import { CoverThumb, NavIcon } from "./cover-thumb";import { CreateMenu, NAV_MENU_ITEM } from "./create-menu";import { useViewerKind } from "./nav-ui";@@ -37,17 +39,32 @@ export { prefetchHrefs } from "./nav-prefetch";export const BAR_ITEM ="group/bar-item inline-flex h-10 shrink-0 [@media(pointer:coarse)]:h-11 items-center gap-1.5 rounded-[10px] px-2.5 text-[14px] whitespace-nowrap text-foreground/80 outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors data-[active]:bg-accent data-[active]:font-semibold data-[active]:text-foreground aria-[current=page]:bg-accent aria-[current=page]:font-semibold aria-[current=page]:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground min-[1440px]:px-3.5";-/** Which bar items hold the open page (Create for the create tools, Studios for a studio or one of its tools…). */-export function barActive(pathname: string): { create: boolean; studios: boolean; apps: boolean; motions: boolean; canvas: boolean; assist: boolean; library: boolean } {+/**+ * Which bar item holds the open page, one item per page (areaOfPath): Create for the create tools, Studios for a studio+ * or one of its tools, Apps for the apps, Motions & effects for both galleries, each for its own area page; Canvas,+ * Assist and Library for theirs. `page`: the area whose own page this is (its name is marked aria-current).+ */+export function barActive(pathname: string): {+ create: boolean;+ studios: boolean;+ apps: boolean;+ motions: boolean;+ canvas: boolean;+ assist: boolean;+ library: boolean;+ page: AreaId | undefined;+} {const e = pathname ? activeEntry(pathname, new URLSearchParams()) : undefined;+ const area = pathname ? areaOfPath(pathname) : undefined;return {- create: e?.kind === "create",- studios: e?.kind === "studio",- apps: e?.id === "apps",- motions: e?.id === "motions" || e?.id === "effects",+ create: area === "create",+ studios: area === "studios",+ apps: area === "apps",+ motions: area === "motions",canvas: e?.id === "canvas",assist: e?.id === "assist",library: e?.kind === "library",+ page: pathname ? areaPageOf(pathname) : undefined,};}@@ -76,23 +93,49 @@ function useOn(): (e: NavEntry) => boolean {return (e) => pathname === e.href || pathname.startsWith(`${e.href}/`);}+/** "See all" at the foot of a menu: the area's own page (`name`: what it says to a screen reader). */+function SeeAllItem({ href, name }: { href: string; name: string }) {+ const pathname = usePathname();+ return (+ <DropdownMenuItem asChild className={cn("group/all mt-1 h-10 gap-2 rounded-lg px-2.5 text-[13.5px] font-medium text-brand-text", NAV_MENU_ITEM)}>+ <IntentLink href={href} aria-current={pathname === href ? "page" : undefined} aria-label={name}>+ See all+ <ArrowRight aria-hidden className="size-4 motion-safe:transition-transform group-hover/all:translate-x-0.5" />+ </IntentLink>+ </DropdownMenuItem>+ );+}++const MOTIONS_AREA_HREF = area("motions").href;+function MotionsItems() {const on = useOn();- return pick(["motions", "effects"]).map((e) => <RichItem key={e.id} e={e} current={on(e)} />);+ return (+ <>+ {pick(["motions", "effects"]).map((e) => (+ <RichItem key={e.id} e={e} current={on(e)} />+ ))}+ <SeeAllItem href={MOTIONS_AREA_HREF} name="See all motions & effects" />+ </>+ );}-/** Motions & effects: the two preset galleries, with their covers. */-function MotionsMenu({ active }: { active: Active }) {+/** Motions & effects: its name goes to the page with both; the menu holds the two preset galleries, with their covers. */+function MotionsMenu({ active, onTap }: { active: Active; onTap?: (href: string) => void }) {return (- <DropdownMenu modal={false} onOpenChange={(o) => o && warmNav("more")}>- <DropdownMenuTrigger className={cn(BAR_ITEM, "hidden xl:inline-flex")} data-active={active.motions || undefined}>- Motions & effects- <ChevronDown aria-hidden className="size-3.5 text-muted-foreground group-data-[state=open]/bar-item:rotate-180 motion-safe:transition-transform" />- </DropdownMenuTrigger>- <DropdownMenuContent align="start" sideOffset={8} className="w-80 p-1.5">- <MotionsItems />- </DropdownMenuContent>- </DropdownMenu>+ <BarSplitMenu+ href={MOTIONS_AREA_HREF}+ label="Motions & effects"+ name="Motions & effects menu"+ active={active.motions}+ current={active.page === "motions"}+ panel="more"+ onTap={onTap}+ className="hidden xl:inline-flex"+ contentClassName="w-80 p-1.5"+ >+ <MotionsItems />+ </BarSplitMenu>);}@@ -105,6 +148,10 @@ function MoreItems() {<RichItem e={e} current={on(e)} /></div>))}+ <div className="xl:hidden">+ <SeeAllItem href={MOTIONS_AREA_HREF} name="See all motions & effects" />+ <DropdownMenuSeparator className="my-1.5" />+ </div>{pick(["canvas", "assist"]).map((e) => {return (<DropdownMenuItem key={e.id} asChild className={cn("min-h-12 gap-3 rounded-lg px-2 py-1.5 data-[current]:bg-brand-faint", NAV_MENU_ITEM)}>@@ -154,12 +201,12 @@ function BarLinks({ active, onTap }: { active: Active; onTap?: (href: string) =>const tap = (href: string) => (e: React.MouseEvent) => isPlainClick(e) && onTap?.(href);return (<>- <CreateMenu className={BAR_ITEM} active={active.create} />- <StudiosLauncher className={BAR_ITEM} active={active.studios} />+ <CreateMenu active={active.create} current={active.page === "create"} onTap={onTap} />+ <StudiosLauncher active={active.studios} current={active.page === "studios"} onTap={onTap} /><IntentLink href="/apps" onClick={tap("/apps")} aria-current={cur(active.apps)} className={cn(BAR_ITEM, "hidden xl:inline-flex")}>Apps</IntentLink>- <MotionsMenu active={active} />+ <MotionsMenu active={active} onTap={onTap} /><IntentLink href="/canvas" onClick={tap("/canvas")} aria-current={cur(active.canvas)} className={cn(BAR_ITEM, "hidden min-[1440px]:inline-flex")}>Canvas</IntentLink>diff --git a/src/components/preset-gallery.tsx b/src/components/preset-gallery.tsxindex cc05e685..d974c3c5 100644--- a/src/components/preset-gallery.tsx+++ b/src/components/preset-gallery.tsx@@ -2,15 +2,17 @@import Link from "next/link";import { Cloud, Cpu, Lock, Search, Sparkles, X } from "lucide-react";-import { memo, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";+import { memo, useDeferredValue, useLayoutEffect, useMemo, useRef, useState } from "react";import { CardPending, IntentLink } from "@/components/intent-link";import { PRESET_ICONS } from "@/components/preset-icons";import { PresetPreview, usePreviewPlayback } from "@/components/preset-preview";import { GALLERY_GRID } from "@/components/skeletons";+import { useFadeEdges } from "@/components/use-fade-edges";import { useProgressive } from "@/components/use-progressive";import { CardChip, badgeKey, parseBadgeKey } from "@/components/gpu/readiness-chip";import { useGpuBadges } from "@/hooks/use-gpu";import { useEngineMode, useViewer } from "@/lib/api";+import { categoryFrom, skippedInAll } from "@/lib/gallery-category";import { matchesSearch, previewFlip, readMoreTap, searchText, TAP_TO_READ, type PresetCardData } from "@/lib/preset-cards";import { cn } from "@/lib/utils";@@ -184,28 +186,6 @@ function RunsOnControl({ value, onChange, locked, owner }: { value: RunsOn; onCh);}-/** Keeps data-fade-start / data-fade-end on a horizontal scroller in sync with its scroll position. */-export function useFadeEdges<T extends HTMLElement>() {- const ref = useRef<T>(null);- useEffect(() => {- const el = ref.current;- if (!el) return;- const update = () => {- el.toggleAttribute("data-fade-start", el.scrollLeft > 2);- el.toggleAttribute("data-fade-end", el.scrollLeft + el.clientWidth < el.scrollWidth - 2);- };- update();- el.addEventListener("scroll", update, { passive: true });- const ro = new ResizeObserver(update);- ro.observe(el);- return () => {- el.removeEventListener("scroll", update);- ro.disconnect();- };- }, []);- return ref;-}-/*** A card that opens a tool of its own (Live edit), shown before the presets: the same card chrome, its own link. Only* on the All tab with no search, or when the search matches its words; never when the gallery shows cloud tools only.@@ -247,6 +227,7 @@ export function PresetGallery({href,noun = "presets",leading,+ skipInAll,}: {/** In the order the All view shows them (featuredGallery): a category or a search keeps it. */presets: PresetCardData[];@@ -258,8 +239,17 @@ export function PresetGallery({noun?: string;/** Tools of their own shown first (LinkCard). */leading?: LinkCard[];+ /** Presets the page already shows above (an area's Start here): left out of the All view until a search or a category. */+ skipInAll?: string[];}) {const [cat, setCat] = useState("All");+ // A link to a category (/motions?category=Orbit) opens on it: read once before the first paint, so the page stays+ // prerendered (no search params at render).+ useLayoutEffect(() => {+ const asked = categoryFrom(location.search, categories);+ // eslint-disable-next-line react-hooks/set-state-in-effect -- read the address once mounted, before the first paint+ if (asked !== "All") setCat(asked);+ }, [categories]);const [q, setQ] = useState("");const [runsOnChoice, setRunsOn] = useState<RunsOn>("all");// "both" until hydrated, so the server HTML and the first client render agree.@@ -272,10 +262,14 @@ export function PresetGallery({const cats = useMemo(() => ["All", ...categories], [categories]);const list = useMemo(() =>- index- .filter(([p, text]) => (cat === "All" || p.category === cat) && (!query || matchesSearch(text, query)) && (runsOn === "all" || p[runsOn]))- .map(([p]) => p),- [index, cat, query, runsOn],+ skippedInAll(+ index+ .filter(([p, text]) => (cat === "All" || p.category === cat) && (!query || matchesSearch(text, query)) && (runsOn === "all" || p[runsOn]))+ .map(([p]) => p),+ skipInAll,+ cat !== "All" || !!query,+ ),+ [index, cat, query, runsOn, skipInAll],);// Cards render a page at a time; a new filter starts from the first page again.const { shown, hasMore, moreFrom, sentinel, left } = useProgressive(list.length, `${cat}|${query}|${runsOn}`, FIRST_PAGE, PAGE);@@ -316,7 +310,7 @@ export function PresetGallery({</div><div className="flex items-center justify-between gap-2 sm:ml-auto sm:justify-end"><span className="order-last text-[12px] whitespace-nowrap text-muted-foreground tabular-nums sm:order-first sm:mr-2" aria-live="polite">- {list.length === presets.length ? `${presets.length} ${noun}` : `${list.length} of ${presets.length}`}+ {list.length === presets.length || (cat === "All" && !query && runsOn === "all") ? `${presets.length} ${noun}` : `${list.length} of ${presets.length}`}</span><RunsOnControl value={runsOn} onChange={setRunsOn} locked={locked} owner={!!viewer?.owner} /></div>diff --git a/src/components/use-fade-edges.ts b/src/components/use-fade-edges.tsnew file mode 100644index 00000000..bb590f93--- /dev/null+++ b/src/components/use-fade-edges.ts@@ -0,0 +1,25 @@+"use client";++import { useEffect, useRef } from "react";++/** Keeps data-fade-start / data-fade-end on a horizontal scroller in sync with its scroll position. */+export function useFadeEdges<T extends HTMLElement>() {+ const ref = useRef<T>(null);+ useEffect(() => {+ const el = ref.current;+ if (!el) return;+ const update = () => {+ el.toggleAttribute("data-fade-start", el.scrollLeft > 2);+ el.toggleAttribute("data-fade-end", el.scrollLeft + el.clientWidth < el.scrollWidth - 2);+ };+ update();+ el.addEventListener("scroll", update, { passive: true });+ const ro = new ResizeObserver(update);+ ro.observe(el);+ return () => {+ el.removeEventListener("scroll", update);+ ro.disconnect();+ };+ }, []);+ return ref;+}\ No newline at end of filediff --git a/src/lib/area-showcase.ts b/src/lib/area-showcase.tsnew file mode 100644index 00000000..eb53ac93--- /dev/null+++ b/src/lib/area-showcase.ts@@ -0,0 +1,194 @@+/**+ * What an area page (/create, /studios) shows, ready to draw: each section's cards with their covers and lines, and+ * its pills. Read once per build from the navigation model, the catalog's covers and Home's own lines, so the page+ * stays prerendered and gets slim card data only (no prompts, no recipes). Server only.+ */+import "server-only";+import { cacheLife } from "next/cache";+import { EFFECTS, MOTIONS } from "@/lib/catalog";+import { HOME_EFFECTS, HOME_MOTIONS, HOME_STUDIOS, homeCard, homeShowcase, presetHref, type HomeFacts } from "@/lib/home-showcase";+import { areaCount, areaSections, rankCards, type AreaId } from "@/lib/nav-areas";+import { entry, NAV_ENTRIES, visibleTo, type NavEntry } from "@/lib/nav-model";+import type { PresetCardData } from "@/lib/preset-cards";+import { featuredAll, featuredBand } from "@/lib/preset-featured";++/** How a card without a cover is drawn: Live edit plays its recorded session. */+export type AreaDrawn = "live";++export interface AreaCard {+ id: string;+ href: string;+ label: string;+ line: string;+ /** Its cover, as Home's cards get it. */+ card?: PresetCardData;+ drawn?: AreaDrawn;+}++export interface AreaPill {+ id: string;+ href: string;+ label: string;+ icon: string;+}++export interface AreaShowcaseSection {+ id: string;+ title: string;+ line: string;+ icon: string;+ cards: AreaCard[];+ /** What everyone sees. */+ pills: AreaPill[];+ /** Added for the studio's owner only, by a client island (OwnerPills), so the server's HTML never holds them. */+ ownerPills: AreaPill[];+}++const DRAWN: Record<string, AreaDrawn> = { "live-edit": "live" };++/** Home's line for a page it has a card for, else the model's card line (a test checks every card has one). */+function lineOf(e: NavEntry, facts: HomeFacts): string {+ const home = HOME_STUDIOS.find((s) => s.href === e.href);+ return home ? home.line(facts) : (e.line ?? e.what);+}++const pill = (e: NavEntry): AreaPill => ({ id: e.id, href: e.href, label: e.label, icon: e.icon });++/**+ * A card's cover: Home's for a page Home has a card for (so a studio looks the same in both places), unless another+ * page already uses that picture as its own; else the navigation's.+ */+export function areaCover(id: string): string | undefined {+ const e = entry(id);+ if (!e) return undefined;+ const home = HOME_STUDIOS.find((s) => s.href === e.href)?.id;+ if (home && !NAV_ENTRIES.some((x) => x.id !== e.id && x.cover === home)) return home;+ return e.cover;+}++/**+ * Cards premium first: the section's lead, then (in a section of studios) the ones Home picks for its own cards, then the+ * rest by the featured band of the cover they show (rankCards). A section shows only its first full row or two, so this+ * decides which.+ */+export function premiumFirst(ids: string[]): string[] {+ const [lead, ...rest] = rankCards(ids, featuredBand, areaCover);+ if (!lead) return [];+ if (entry(lead)?.kind !== "studio") return [lead, ...rest];+ const onHome = (id: string) => HOME_STUDIOS.some((h) => h.href === entry(id)?.href);+ return [lead, ...rest.filter(onHome), ...rest.filter((id) => !onHome(id))];+}++/**+ * An area page's sections as a guest sees them (the server's render is the same for everyone), each card premium first+ * (rankCards: the featured band of its cover), with the owner's extra pills apart.+ */+export async function areaShowcase(id: AreaId) {+ "use cache";+ cacheLife("max");+ const { facts } = await homeShowcase();+ const owner = areaSections(id, "owner", premiumFirst);+ const sections: AreaShowcaseSection[] = areaSections(id, undefined, premiumFirst).map((s) => {+ const ownerOnly = (owner.find((o) => o.id === s.id)?.chips ?? []).filter((c) => !s.chips.includes(c));+ const cards = s.cards.map((cid): AreaCard => {+ const e = entry(cid);+ if (!e) throw new Error(`The ${id} area names ${cid}, which isn't in the navigation`);+ const cover = areaCover(cid);+ return {+ id: e.id,+ href: e.href,+ label: e.label,+ line: lineOf(e, facts),+ ...(cover ? { card: homeCard(cover) } : { drawn: DRAWN[e.id] }),+ };+ });+ const entries = (ids: string[]) => ids.map(entry).filter((e): e is NavEntry => !!e);+ return {+ id: s.id,+ title: s.title,+ line: s.line,+ icon: s.icon,+ cards,+ pills: entries(s.chips).map(pill),+ ownerPills: entries(ownerOnly)+ .filter((e) => visibleTo(e, "owner"))+ .map(pill),+ };+ });+ return { count: areaCount(id, undefined), sections };+}++export type AreaShowcase = Awaited<ReturnType<typeof areaShowcase>>;++/**+ * /motions-and-effects' wall: four camera motions and four effects from the top of the featured order, alternating,+ * each with what its cover shows in a line that fits a phone's tile (Home's rows say the same things at more length).+ */+export const MOTIONS_AREA_WALL = [+ { id: "motion-dolly-in", kind: "Camera motion", caption: "Into the library" },+ { id: "effect-levitation", kind: "Effect", caption: "Floating off the dune" },+ { id: "motion-helicopter-shot", kind: "Camera motion", caption: "Circles the castle" },+ { id: "effect-nature-bloom", kind: "Effect", caption: "A station in bloom" },+ { id: "motion-super-dolly-out", kind: "Camera motion", caption: "Out to the valley" },+ { id: "effect-lens-flare", kind: "Effect", caption: "An anamorphic flare" },+ { id: "motion-slow-motion", kind: "Camera motion", caption: "Droplets, slowed down" },+ { id: "effect-wind-to-face", kind: "Effect", caption: "Swept by a gale" },+] as const;++/** How many presets each row on /motions-and-effects shows (two rows of four from sm; a phone's rail). */+export const MOTIONS_AREA_ROW = 8;++/** The longest line under a preset on /motions-and-effects: two lines of a card four a row, never cut short. */+export const MOTIONS_AREA_LINE_MAX = 60;++/**+ * A preset's line on /motions-and-effects: Home's caption, else its description's first sentence or clause when that+ * fits whole, else what kind of preset it is (+oun: "effect", "move").+ */+export function shortLine(p: { id: string; description: string; category: string }, noun: string, captions: ReadonlyMap<string, string>): string {+ const home = captions.get(p.id);+ if (home) return home;+ const first = p.description.split(/[.;:]\s|,\s/)[0]?.replace(/[.;:,]$/, "").trim();+ if (first && first.length <= MOTIONS_AREA_LINE_MAX) return first;+ return `${p.category} ${noun}`;+}++/** A gallery's categories, the ones its featured presets lead with first (the strongest first). */+function categoriesByFeatured(items: readonly { id: string; category: string }[]): string[] {+ return [...new Set(featuredAll(items).map((p) => p.category))];+}++/**+ * /motions-and-effects: the wall, then each gallery's first presets by the featured order (not on the wall), its+ * categories strongest first, and its count. Each with a short line that shows whole (shortLine).+ */+export async function motionsAreaShowcase() {+ "use cache";+ cacheLife("max");+ const captions = new Map<string, string>([...HOME_MOTIONS, ...HOME_EFFECTS].map((r) => [r.id, r.caption]));+ const onWall = new Set<string>(MOTIONS_AREA_WALL.map((t) => t.id));+ const row = (items: typeof MOTIONS, noun: string) =>+ featuredAll(items)+ .filter((p) => !onWall.has(p.id))+ .slice(0, MOTIONS_AREA_ROW)+ .map((p) => ({ card: homeCard(p.id), caption: shortLine(p, noun, captions) }));+ return {+ wall: MOTIONS_AREA_WALL.map((t) => ({ ...t, card: homeCard(t.id), href: presetHref(t.id) })),+ motions: { count: MOTIONS.length, row: row(MOTIONS, "move"), categories: categoriesByFeatured(MOTIONS) },+ effects: { count: EFFECTS.length, row: row(EFFECTS, "effect"), categories: categoriesByFeatured(EFFECTS) },+ };+}++/** /apps' Start here (Home's Apps section) and the apps it shows, which the gallery under it leaves out of All. */+export async function appsAreaShowcase() {+ "use cache";+ cacheLife("max");+ const home = await homeShowcase();+ return {+ facts: home.facts,+ beforeAfter: home.beforeAfter,+ reveals: home.reveals,+ shown: [...home.beforeAfter.map((b) => b.id), ...home.reveals.map((r) => r.card.id)],+ };+}diff --git a/src/lib/gallery-category.ts b/src/lib/gallery-category.tsnew file mode 100644index 00000000..d683d5db--- /dev/null+++ b/src/lib/gallery-category.ts@@ -0,0 +1,20 @@+/**+ * A gallery's category from a link (/motions?category=Orbit), and what its All view leaves out. Pure, so the gallery and+ * the tests share it.+ */++/** The category a URL's query asks for, when the gallery has it ("All" otherwise). */+export function categoryFrom(search: string, categories: readonly string[]): string {+ const asked = new URLSearchParams(search).get("category");+ return asked && categories.includes(asked) ? asked : "All";+}++/**+ * What the All view leaves out: presets the page already shows above the gallery (`skip`), only while nothing narrows+ * it (no search, no category), so a search or a category still finds them.+ */+export function skippedInAll<T extends { id: string }>(items: readonly T[], skip: readonly string[] | undefined, narrowed: boolean): T[] {+ if (!skip?.length || narrowed) return [...items];+ const out = new Set(skip);+ return items.filter((it) => !out.has(it.id));+}diff --git a/src/lib/nav-areas.ts b/src/lib/nav-areas.tsnew file mode 100644index 00000000..c0b48e5b--- /dev/null+++ b/src/lib/nav-areas.ts@@ -0,0 +1,254 @@+/**+ * The area pages: one page for each of the bar's menus that holds a family of things (Create, Studios, Apps, Motions &+ * effects), showing everything inside it as Home's "Studios and tools" section does. Pure data and helpers from the+ * navigation model (no React, no catalog), so the server's pages and the bar share them. ("Hub" already names the+ * Audio, Upscale and Video tools modes in src/lib/hubs.ts, so these are "areas".)+ *+ * Canvas, Assist and Library have no area page: each is one workspace whose own start screen already lists what it+ * holds (projects, the empty chat with its skills, the tabs).+ */+import {+ activeEntry,+ CREATE_COLUMNS,+ entry,+ LAUNCHER_GROUPS,+ launcherEntries,+ NAV_ENTRIES,+ visibleTo,+ type LauncherGroupId,+ type NavEntry,+ type NavIconName,+ type ViewerKind,+} from "./nav-model";++export type AreaId = "create" | "studios" | "apps" | "motions";++/** One section of an area page: its heading and line, the entries drawn as cover cards, then the rest as pills. */+export interface AreaSection {+ /** The section's anchor (#film) and its tab. */+ id: string;+ title: string;+ /** One sentence under the heading. */+ line: string;+ icon: NavIconName;+ /** NavEntry ids drawn as 4:3 cover cards, the section's lead first. */+ cards: string[];+ /** NavEntry ids drawn as pills under the cards. */+ chips: string[];+}++export interface Area {+ id: AreaId;+ /** The area page. */+ href: string;+ /** The bar item's name. */+ label: string;+ /** The page's heading. */+ title: string;+ /** One sentence under the heading. */+ line: string;+ /** Its entry in the navigation model (search finds it; the bar marks it). Apps' is the Apps gallery itself. */+ entryId: string;+}++export const AREAS: readonly Area[] = [+ {+ id: "create",+ href: "/create",+ label: "Create",+ title: "Create",+ line: "Make a picture, a clip or a sound, or change one you already have.",+ entryId: "area-create",+ },+ {+ id: "studios",+ href: "/studios",+ label: "Studios",+ title: "Studios",+ // Home's own sentence for its studios, kept the same.+ line: "Whole productions, start to finish: films, ads, shoots and series. Open any of them to look around, no account needed.",+ entryId: "area-studios",+ },+ { id: "apps", href: "/apps", label: "Apps", title: "Apps", line: "One click changes one thing and keeps the rest.", entryId: "apps" },+ {+ id: "motions",+ href: "/motions-and-effects",+ label: "Motions & effects",+ title: "Motions & effects",+ line: "Camera moves a film crew would make, and effects from one photo.",+ entryId: "area-motions",+ },+];++export function area(id: AreaId): Area {+ const a = AREAS.find((x) => x.id === id);+ if (!a) throw new Error(`No area ${id}`);+ return a;+}++/** Each launcher group's line and icon (the goal row's icons) as a section of /studios. */+const GROUP_COPY: Record<LauncherGroupId, { line: string; icon: NavIconName }> = {+ film: { line: "Direct, plan, cut and finish films and clips.", icon: "Clapperboard" },+ social: { line: "Reels, channels and series made to be posted.", icon: "TrendingUp" },+ sell: { line: "Ads, product films and photo packs for what you sell.", icon: "ShoppingBag" },+ people: { line: "Characters, outfits and faces that stay the same in every shot.", icon: "UserRound" },+ sound: { line: "Voices, music and sound effects for anything you make.", icon: "AudioLines" },+ finish: { line: "Sharper, larger or in 3D: the last step before you share.", icon: "SlidersHorizontal" },+};++/** The tools (hub modes, a studio's own pages) of the given studios, in the model's order. */+const toolsOf = (parents: readonly string[]) => NAV_ENTRIES.filter((e) => e.kind === "tool" && !!e.parent && parents.includes(e.parent)).map((e) => e.id);++/** The studios whose modes are tools of their own (src/lib/hubs.ts): a mode is a pill, never a card or counted. */+const HUB_PARENTS = ["upscale", "audio", "video-tools"];++/**+ * Pages drawn as a pill wherever an area page lists them, never as a cover card: a drawn diagram or a plain product+ * still reads flat among the photos and clips, so the cover rows stay all real shots.+ */+export const PILL_ONLY: readonly string[] = ["canvas", "layers", "explainer", "virality"];++/**+ * /create's sections: the tools that make or change one thing (a picture, a clip, a sound). Each has one home: what is+ * a card here is a pill on /studios, and the whole productions (Katana, Genjutsu, Audio…) are cards on /studios and+ * pills here. Sound has no cards here: its studio and modes are /studios' Sound.+ */+function createSections(): AreaSection[] {+ const [make, editPicture] = CREATE_COLUMNS;+ // Make's own column, less what has a section of its own (Image and Video lead) and Assist (an item of the bar).+ const makeRest = make.ids.filter((id) => !["image", "video", "assist"].includes(id));+ return [+ {+ id: "make",+ title: make.label,+ line: "Start from words or a picture: a still, a clip, another angle or a 3D model.",+ icon: "Sparkles",+ cards: ["image", "video", "any-angle", "image-to-3d"],+ chips: makeRest,+ },+ {+ id: "edit-picture",+ title: editPicture.label,+ line: "Change a picture you already have, a little or a lot.",+ icon: "Wand2",+ cards: [...editPicture.ids],+ chips: [],+ },+ {+ id: "edit-clip",+ title: "Edit a clip",+ line: "Restyle, lengthen, reshape or sharpen a clip you have.",+ icon: "Scissors",+ cards: ["video-edit", "extend", "reframe", "upscale"],+ chips: ["katana", "motion-control", "character-swap", "genjutsu", "video-tools", ...toolsOf(["upscale"])],+ },+ {+ id: "sound",+ title: "Sound",+ line: "Voices, music and sound effects for anything you make.",+ icon: "AudioLines",+ cards: [],+ chips: ["audio", ...toolsOf(["audio"])],+ },+ ];+}++/** The pages that are a card on /create: a pill on /studios. */+const CREATE_CARDS: ReadonlySet<string> = new Set(createSections().flatMap((s) => s.cards));++/**+ * /studios' sections: one per launcher group, its studios as cards, then the ones whose card is on /create, their+ * tools and Apps (a page of its own) as pills.+ */+function studioSections(kind: ViewerKind | undefined): AreaSection[] {+ return LAUNCHER_GROUPS.map((g) => {+ const all = launcherEntries(kind, g.id).map((e) => e.id);+ const studios = all.filter((id) => id !== "apps");+ return {+ id: g.id,+ title: g.label,+ ...GROUP_COPY[g.id],+ cards: studios.filter((id) => !CREATE_CARDS.has(id)),+ chips: [...studios.filter((id) => CREATE_CARDS.has(id)), ...toolsOf(studios), ...all.filter((id) => id === "apps")],+ };+ });+}++/** How many cards a section shows: 8 or 4, so every row of four is full; fewer than 4 makes it pills only. */+export const cardsToShow = (n: number) => (n >= 8 ? 8 : n >= 4 ? 4 : 0);++/**+ * An area's sections as this viewer sees them: only entries they may see, cards in `order` (premium first, see+ * rankCards) and only full rows of them (cardsToShow), the rest and the PILL_ONLY pages as the first pills, no pill that+ * repeats a card (a hub's first mode is the hub's own page), no pill twice, and no empty section. Apps and Motions &+ * effects draw from the catalog instead (their pages), so they have none here.+ */+export function areaSections(id: AreaId, kind: ViewerKind | undefined, order: (ids: string[]) => string[] = (ids) => ids): AreaSection[] {+ const raw = id === "create" ? createSections() : id === "studios" ? studioSections(kind) : [];+ const seen = (e: NavEntry | undefined): e is NavEntry => !!e && visibleTo(e, kind);+ return raw+ .map((s) => {+ const visible = s.cards.map(entry).filter(seen);+ const ranked = order(visible.filter((e) => !PILL_ONLY.includes(e.id)).map((e) => e.id));+ const shown = ranked.slice(0, cardsToShow(ranked.length));+ const cards = shown.map(entry).filter(seen);+ const cardHrefs = new Set(cards.map((e) => e.href));+ const rest = [...ranked.slice(shown.length), ...visible.filter((e) => PILL_ONLY.includes(e.id)).map((e) => e.id)];+ const chips = [...rest, ...s.chips]+ .map(entry)+ .filter(seen)+ .filter((e, i, list) => !cardHrefs.has(e.href) && list.findIndex((x) => x.href === e.href) === i);+ return { ...s, cards: cards.map((e) => e.id), chips: chips.map((e) => e.id) };+ })+ .filter((s) => s.cards.length || s.chips.length);+}++/**+ * The number in an area's heading. Studios: its studios (the bar's "Studios 28"). Create: every page it shows, cards+ * and pills, but not a studio's modes or an action.+ */+export function areaCount(id: AreaId, kind: ViewerKind | undefined): number {+ const sections = areaSections(id, kind);+ const ids = new Set(sections.flatMap((s) => [...s.cards, ...s.chips]));+ const entries = [...ids].map(entry).filter((e): e is NavEntry => !!e);+ if (id === "studios") return entries.filter((e) => e.kind === "studio").length;+ return entries.filter((e) => e.kind !== "action" && !(e.kind === "tool" && e.parent && HUB_PARENTS.includes(e.parent))).length;+}++/**+ * Cards premium first: the section's lead stays first, the rest go by their cover's featured band (`band`, from+ * preset-featured.ts), keeping their order within a band. A card with no cover (drawn) keeps band 0.+ */+export function rankCards(ids: readonly string[], band: (cover: string) => number, coverOf: (id: string) => string | undefined = (id) => entry(id)?.cover): string[] {+ const [lead, ...rest] = ids;+ if (!lead) return [];+ const key = (id: string) => {+ const cover = coverOf(id);+ return cover ? band(cover) : 0;+ };+ return [lead, ...rest.map((id, i) => ({ id, i, b: key(id) })).sort((a, b) => a.b - b.b || a.i - b.i).map((x) => x.id)];+}++const NO_SEARCH = new URLSearchParams();++/**+ * The bar item that holds a page, one per page: Create for its tools (not Canvas or Assist, which have items of their+ * own), Studios for a studio and its tools, Apps for the apps, Motions & effects for both galleries; and each for its+ * own area page. None for Home, Canvas, Assist, Library and settings.+ */+export function areaOfPath(pathname: string): AreaId | undefined {+ const e = pathname ? activeEntry(pathname, NO_SEARCH) : undefined;+ if (!e) return undefined;+ const own = AREAS.find((a) => a.entryId === e.id);+ if (own) return own.id;+ if (e.id === "motions" || e.id === "effects") return "motions";+ if (e.kind === "create" && e.id !== "canvas" && e.id !== "assist") return "create";+ if (e.kind === "studio") return "studios";+ return undefined;+}++/** The area whose own page this is (/create, /studios, /apps, /motions-and-effects), or none. */+export function areaPageOf(pathname: string): AreaId | undefined {+ const path = pathname.replace(/\/$/, "") || "/";+ return AREAS.find((a) => a.href === path)?.id;+}diff --git a/src/lib/nav-icons.ts b/src/lib/nav-icons.tsindex 607dae32..76780272 100644--- a/src/lib/nav-icons.ts+++ b/src/lib/nav-icons.ts@@ -37,6 +37,7 @@ import {Plug,Plus,Presentation,+ Rotate3d,Scale,Scissors,Server,@@ -102,6 +103,7 @@ export const NAV_ICONS = {Plug,Plus,Presentation,+ Rotate3d,Scale,Scissors,Server,diff --git a/src/lib/nav-model.ts b/src/lib/nav-model.tsindex f04d5d38..508dac12 100644--- a/src/lib/nav-model.ts+++ b/src/lib/nav-model.ts@@ -9,7 +9,8 @@ import { HUB_MODES, modeHref, type HubKind } from "./hubs";import { navActive, NEW_CREATION_HREF } from "./nav";export type ViewerKind = "guest" | "account" | "owner";-export type NavKind = "home" | "action" | "create" | "studio" | "presets" | "tool" | "library" | "settings";+/** "area": a page that shows everything one of the bar's menus holds (/create, /studios, /motions-and-effects). */+export type NavKind = "home" | "action" | "create" | "studio" | "presets" | "tool" | "library" | "settings" | "area";/** Launcher columns, the Studios sheet chips and the palette's "Every studio" chips. */export type LauncherGroupId = "film" | "social" | "sell" | "people" | "sound" | "finish";/** The goal row on Home. An entry can serve several goals. */@@ -27,6 +28,11 @@ export interface NavEntry {short?: string;/** One line, 34 characters at most, sentence case, no full stop. */what: string;+ /**+ * The sentence under its cover card on an area page (/create, /studios): 64 characters at most, sentence case, a full+ * stop at the end. Home's own line wins where Home has a card for the same page (HOME_STUDIOS).+ */+ line?: string;kind: NavKind;/** Set: it is in the launcher, the Studios sheet and "Every studio". */group?: LauncherGroupId;@@ -108,7 +114,7 @@ const PAGES: NavEntry[] = [{ id: "color-grade", href: "/color-grade", label: "Color grading", what: "Grade and match colors", kind: "create", goals: ["edit", "film"], keywords: "grade lut colour color", cover: "app-color-grading", icon: "SlidersHorizontal" },{ id: "canvas", href: "/canvas", label: "Canvas", what: "Wire models together", kind: "create", goals: [], keywords: "nodes flow workflow graph", icon: "Network" },{ id: "motions", href: "/motions", label: "Camera motions", what: "Crane and drone moves for any shot", kind: "presets", goals: ["film"], keywords: "camera moves presets dolly crane drone orbit", cover: "motion-crane-up", icon: "Film" },- { id: "effects", href: "/effects", label: "Effects", what: "Visual effects for any clip", kind: "presets", goals: ["film", "social"], keywords: "vfx presets visual effects", cover: "effect-nature-bloom", icon: "Sparkles" },+ { id: "effects", href: "/effects", label: "Effects", what: "Cinematic effects from one photo", kind: "presets", goals: ["film", "social"], keywords: "vfx presets visual effects", cover: "effect-nature-bloom", icon: "Sparkles" },{ id: "library", href: "/library", label: "All creations", what: "Everything you have made", kind: "library", goals: [], keywords: "library history results creations", icon: "Library", eager: true },{ id: "favorites", href: "/library?tab=favorites", label: "Favorites", what: "The ones you starred", kind: "library", goals: [], keywords: "starred liked", icon: "Star" },{ id: "settings", href: "/settings", label: "Settings", what: "Account, GPU and preferences", kind: "settings", goals: [], keywords: "account gpu preferences", icon: "Settings" },@@ -216,7 +222,7 @@ const STUDIOS: NavEntry[] = [/** What each hub mode does, and the words people type for it. */const TOOL_COPY: Record<string, { what: string; keywords: string; cover?: string; label?: string; short?: string }> = {"upscale-image": { what: "Sharper, larger pictures", keywords: "photo picture enhance 4k 8k sharpen resolution" },- "upscale-video": { what: "Sharper, larger clips", keywords: "4k 8k enhance clip restore faces resolution" },+ "upscale-video": { label: "Upscale video", what: "Sharper, larger clips", keywords: "4k 8k enhance clip restore faces resolution" },"upscale-fps": { what: "Smoother motion", keywords: "frame interpolation 60fps 120fps slow motion slowmo" },"upscale-hdr": { what: "10-bit HDR from any clip", keywords: "sdr hdr hdr10 exr prores 10 bit" },"upscale-export": { what: "ProRes and lossless files", keywords: "export prores h265 ffv1 exr codec deliver master" },@@ -284,8 +290,57 @@ const SUB_TOOLS: NavEntry[] = [{ id: "marketing-click-to-ad", href: "/marketing/click-to-ad", label: "Click to ad", what: "From a product link to an ad", kind: "tool", goals: [], keywords: "product link url to ad shop page amazon", icon: "Megaphone", parent: "marketing" },{ id: "ads-multiplier", href: "/ads/multiplier", label: "Ad multiplier", what: "One ad in many versions", kind: "tool", goals: [], keywords: "variations versions sizes multiply", icon: "Target", parent: "ads" },{ id: "assist-skills", href: "/assist/skills", label: "Skills", what: "Reusable recipes", kind: "tool", goals: [], keywords: "skill recipe playbook automation", icon: "MessageCircle", parent: "assist" },+ // An app with a page of its own that Create lists: a tool of Apps, so the bar marks Apps on its page.+ { id: "any-angle", href: "/apps/app-any-angle", label: "Any Angle", what: "See it from any angle", kind: "tool", goals: [], keywords: "angle rotate turn view camera viewpoint orbit 3d", cover: "app-any-angle", icon: "Rotate3d", parent: "apps" },];+/** The pages that show everything one of the bar's menus holds (src/lib/nav-areas.ts lays them out). */+const AREA_PAGES: NavEntry[] = [+ { id: "area-create", href: "/create", label: "All of Create", what: "Every way to make or edit", kind: "area", goals: [], keywords: "create make edit tools all overview", icon: "Sparkles" },+ { id: "area-studios", href: "/studios", label: "All studios", what: "Every studio, with previews", kind: "area", goals: [], keywords: "studios all overview every studio", icon: "LayoutGrid" },+ { id: "area-motions", href: "/motions-and-effects", label: "Motions & effects", what: "Camera moves and effects", kind: "area", goals: [], keywords: "motions effects camera moves vfx presets overview", icon: "Film" },+];++/**+ * The sentence under each cover card on the area pages (NavEntry.line). Studios that have a card on Home use Home's+ * line instead (HOME_STUDIOS), so a studio says the same thing in both places.+ */+const CARD_LINES: Record<string, string> = {+ image: "Describe it and get a picture, from a portrait to a poster.",+ video: "Turn words or a still into a moving shot.",+ storyboard: "Plan a film frame by frame, then shoot each frame.",+ canvas: "Wire models together into a flow you can run again.",+ edit: "Change a picture with a sentence. The rest stays.",+ "live-edit": "Type a change and watch the picture follow.",+ inpaint: "Paint over one part and say what goes there.",+ layers: "Split a picture into layers you can move and swap.",+ "color-grade": "Grade a shot, or match the colors of another.",+ "any-angle": "See the same subject from any angle you choose.",+ upscale: "Make pictures and clips sharper and larger.",+ "video-edit": "Restyle a clip with words and keep its motion.",+ extend: "Make a clip longer, picking up where it ends.",+ reframe: "Any shape from any shot: vertical, square or wide.",+ "video-tools": "Trim, join, matte and caption any clip.",+ katana: "Cut your clips into a story on a timeline.",+ shorts: "Vertical reels from one idea, ready to post.",+ faceless: "A whole channel of episodes, with no face on camera.",+ "content-factory": "A series of posts and clips from one brief.",+ lipsync: "Make a photo talk, sing or present in any voice.",+ explainer: "Turn slides or a document into a narrated video.",+ virality: "Score the first three seconds before you post.",+ ads: "One campaign in every size and format.",+ moodboards: "Lock a look from references and reuse it anywhere.",+ photodump: "A whole photo pack of one person, in any setting.",+ "fashion-factory": "Outfits, try-ons and lookbooks on real-looking models.",+ influencer: "Build a character with a face that stays the same.",+ "character-sheet": "One face from every angle, ready for any shot.",+ elements: "Save your people, places and props to use anywhere.",+ "audio-music": "A track from a few words, in any mood.",+ "audio-sfx": "Any sound effect from a few words.",+ "audio-translate": "Your video, dubbed into another language.",+ "audio-clean": "Remove noise and echo from any voice.",+};+/*** Settings sections (ids as in settings-form.tsx). The install's own settings are its owner's; an account gets its* own GPU, keys and account; a guest the way to connect a GPU. Everyone may read Thanks & licences.@@ -339,7 +394,18 @@ const ACTIONS: NavEntry[] = [{ id: "login", href: "/login", label: "Log in", what: "Back to your account", kind: "action", goals: [], keywords: "log in login sign in account", icon: "LogIn", visibility: GUEST },];-export const NAV_ENTRIES: readonly NavEntry[] = [...PAGES, ...STUDIOS, ...HUB_TOOLS, ...SUB_TOOLS, ...SETTINGS, ...ACCOUNT_SETTINGS, ...ACTIONS];+export const NAV_ENTRIES: readonly NavEntry[] = [...PAGES, ...STUDIOS, ...HUB_TOOLS, ...SUB_TOOLS, ...AREA_PAGES, ...SETTINGS, ...ACCOUNT_SETTINGS, ...ACTIONS].map((e) =>+ CARD_LINES[e.id] ? { ...e, line: CARD_LINES[e.id] } : e,+);++/**+ * The bar's Create menu and the phone's Create sheet, column by column (create-menu.tsx draws them; the /create page+ * starts from them). Storyboard plans a film, so it sits with Make (its card is in the launcher's Film column).+ */+export const CREATE_COLUMNS = [+ { label: "Make", ids: ["image", "video", "assist", "canvas", "storyboard"] },+ { label: "Edit a picture", ids: ["edit", "live-edit", "inpaint", "layers", "color-grade"] },+] as const;export const LAUNCHER_GROUPS: readonly LauncherGroup[] = [{ id: "film", label: "Film & video", chip: "Film" },diff --git a/src/lib/nav-search.ts b/src/lib/nav-search.tsindex 138d41a0..5d9fb97a 100644--- a/src/lib/nav-search.ts+++ b/src/lib/nav-search.ts@@ -237,6 +237,9 @@ function kindBonus(e: SearchEntry): number {case "library":case "action":return 8;+ case "area":+ // An overview loses close calls to the page it lists ("studios" finds a studio first, the overview next).+ return 5;}return e.kind === "page" ? 8 : e.kind === "setting" ? 4 : 0;}@@ -320,10 +323,17 @@ export function searchNav(query: string, entries: SearchEntry[], opts: { intents// Letters-in-order guesses next to a real match are noise; what an intent names always stays.// With an intent to go by, the faintest guesses go too ("real estate" is not "Sign up free").const floor = Math.max(top * (top >= REAL_MATCH ? KEEP_FROM_REAL_MATCH : KEEP_FROM_BEST), fired.length ? 20 : 0);+ const hrefs = new Set<string>();const hits = scored.filter((x) => x.boost > 0 || x.text + x.bonus >= floor).map((x) => toHit(x.e, Math.max(x.text, x.boost) + 0.1 * Math.min(x.text, x.boost) + x.bonus))- .sort((a, b) => b.score - a.score);+ .sort((a, b) => b.score - a.score)+ // One hit per address: a page listed twice (Any Angle, a tool of Create and an app) shows once, as its best match.+ .filter((h) => {+ if (hrefs.has(h.href)) return false;+ hrefs.add(h.href);+ return true;+ });// Only real matches are "best" (and so what Enter opens): a word that merely appears in a name is listed by kind.// A single long word that matches nothing as written is a typo ("cinma"), and its guess is the match.@@ -357,6 +367,7 @@ const HIT_KIND: Record<NavKind, HitKind> = {create: "page",presets: "page",library: "page",+ area: "page",studio: "studio",tool: "tool",settings: "setting",diff --git a/tests/__snapshots__/home-studios.html b/tests/__snapshots__/home-studios.htmlnew file mode 100644index 00000000..6ad7d89d--- /dev/null+++ b/tests/__snapshots__/home-studios.html@@ -0,0 +1,522 @@+<section aria-labelledby="home-studios" class="home-cv -mx-4 mt-8 -mb-2 px-4 py-2 sm:mt-12 [--cv:529px] sm:[--cv:1597px] md:[--cv:1482px] lg:[--cv:770px] xl:[--cv:795px]">+<div class="mb-4">+<div class="flex items-center justify-between gap-4">+<h2 id="home-studios" class="font-heading text-[24px] leading-tight sm:text-[28px]">Studios and tools<span aria-hidden="true" class="ml-2 inline-block rounded-full bg-muted px-2 align-[0.3em] font-sans text-[13px] leading-6 tracking-normal text-muted-foreground tabular-nums">40</span>+</h2>+<a aria-label="See all 28 studios" class="group relative inline-flex shrink-0 items-center gap-1 text-[13px] text-muted-foreground transition-colors after:absolute after:-inset-x-2 after:-inset-y-3 after:content-[''] hover:text-foreground" href="/studios">See all 28 studios <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right size-3.5 transition-transform duration-150 group-hover:translate-x-0.5" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</a>+</div>+<p class="mt-1 text-[15px] text-pretty text-muted-foreground">Whole productions, start to finish: films, ads, shoots and series. Open any of them to look around, no account needed.</p>+</div>+<div class="fade-x scrollbar-none max-sm:-mx-4 max-sm:overflow-x-auto max-sm:px-4 flex snap-x snap-mandatory scroll-px-4 sm:grid sm:[mask-image:none] gap-3 sm:grid-cols-2 sm:gap-x-3 sm:gap-y-4 lg:grid-cols-4">+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/cinema">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/motion-arc-left.jpg?v=70bf35cd" srcSet="/previews/presets/thumbs/motion-arc-left.jpg?v=70bf35cd 320w, /previews/presets/motion-arc-left.jpg?v=70bf35cd 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">Cinema <span class="whitespace-nowrap">Studio<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">Direct a film shot by shot: camera, lens, light and 33 moves.</p>+</div>+</a>+</div>+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/genjutsu">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/peak/effect-turning-metal.jpg?v=26c5fac5" srcSet="/previews/presets/peak/thumbs/effect-turning-metal.jpg?v=26c5fac5 320w, /previews/presets/peak/effect-turning-metal.jpg?v=26c5fac5 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">+<span class="whitespace-nowrap">Genjutsu<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">Keep a clip’s motion. Change what’s in it.</p>+</div>+</a>+</div>+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/character-swap">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/peak/app-character-swap.jpg?v=bb9c8194" srcSet="/previews/presets/peak/thumbs/app-character-swap.jpg?v=bb9c8194 320w, /previews/presets/peak/app-character-swap.jpg?v=bb9c8194 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" style="object-position:85% 25%" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">Character <span class="whitespace-nowrap">Swap<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">Put your character into whole clips, shot by shot.</p>+</div>+</a>+</div>+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/marketing">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/app-macroshot-product.jpg?v=19da0c6d" srcSet="/previews/presets/thumbs/app-macroshot-product.jpg?v=19da0c6d 320w, /previews/presets/app-macroshot-product.jpg?v=19da0c6d 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">Marketing <span class="whitespace-nowrap">Studio<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">From a product link to a finished ad. 84 ad templates.</p>+</div>+</a>+</div>+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/mixed-media">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/peak/effect-paper.jpg?v=9ed040b9" srcSet="/previews/presets/peak/thumbs/effect-paper.jpg?v=9ed040b9 320w, /previews/presets/peak/effect-paper.jpg?v=9ed040b9 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" style="object-position:40% 50%" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">Mixed <span class="whitespace-nowrap">Media<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">Redraw a clip as collage, paper or paint, in 33 looks.</p>+</div>+</a>+</div>+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/motion-control">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/motion-static.jpg?v=7a297dfe" srcSet="/previews/presets/thumbs/motion-static.jpg?v=7a297dfe 320w, /previews/presets/motion-static.jpg?v=7a297dfe 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">Motion <span class="whitespace-nowrap">control<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">Give anyone the moves from any clip.</p>+</div>+</a>+</div>+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/audio">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/peak/app-clean-up-voice.jpg?v=e3056264" srcSet="/previews/presets/peak/thumbs/app-clean-up-voice.jpg?v=e3056264 320w, /previews/presets/peak/app-clean-up-voice.jpg?v=e3056264 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">+<span class="whitespace-nowrap">Audio<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">Voices, music and sound for any clip, made or split apart.</p>+</div>+</a>+</div>+<div class="w-[64%] shrink-0 snap-start sm:w-auto">+<a class="group/studio flex min-w-0 flex-col gap-2 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring" href="/image-to-3d">+<div class="relative isolate aspect-[4/3] overflow-hidden rounded-lg bg-muted">+<div class="absolute inset-0 ease-out motion-safe:transition-transform motion-safe:duration-[400ms] motion-safe:group-hover/studio:scale-[1.03]">+<img src="/previews/presets/peak/app-3d-rotation.jpg?v=011b454a" srcSet="/previews/presets/peak/thumbs/app-3d-rotation.jpg?v=011b454a 320w, /previews/presets/peak/app-3d-rotation.jpg?v=011b454a 512w" sizes="(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 64vw" alt="" width="512" height="384" draggable="false" loading="lazy" decoding="async" class="absolute inset-0 size-full object-cover" aria-hidden="true"/>+</div>+</div>+<div class="min-w-0 px-0.5">+<p class="text-[14px] font-medium">Image to <span class="whitespace-nowrap">3D<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right ml-1.5 inline-block size-3.5 align-[-2px] text-muted-foreground transition-transform duration-150 group-hover/studio:translate-x-0.5 group-hover/studio:text-foreground" aria-hidden="true">+<path d="M5 12h14">+</path>+<path d="m12 5 7 7-7 7">+</path>+</svg>+</span>+</p>+<p class="mt-0.5 text-[12px] leading-snug text-muted-foreground">A photo or a sentence to a 3D model you can spin.</p>+</div>+</a>+</div>+</div>+<h3 class="mt-6 mb-2 font-sans text-[13px] text-muted-foreground">Also in Fuobe</h3>+<div class="fade-x scrollbar-none max-sm:-mx-4 max-sm:overflow-x-auto max-sm:px-4">+<ul class="flex flex-wrap gap-1.5 max-sm:w-[72rem]">+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/image">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<rect width="18" height="18" x="3" y="3" rx="2" ry="2">+</rect>+<circle cx="9" cy="9" r="2">+</circle>+<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21">+</path>+</svg>Image</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/video">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5">+</path>+<rect x="2" y="6" width="14" height="12" rx="2">+</rect>+</svg>Video</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/edit">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-wand-sparkles lucide-wand-2 size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72">+</path>+<path d="m14 7 3 3">+</path>+<path d="M5 6v4">+</path>+<path d="M19 14v4">+</path>+<path d="M10 2v2">+</path>+<path d="M7 8H3">+</path>+<path d="M21 16h-4">+</path>+<path d="M11 3H9">+</path>+</svg>Edit</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/layers">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layers-2 size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z">+</path>+<path d="m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845">+</path>+</svg>Layers</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/inpaint">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-brush size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m11 10 3 3">+</path>+<path d="M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z">+</path>+<path d="M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031">+</path>+</svg>Inpaint</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/color-grade">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sliders-horizontal size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M10 5H3">+</path>+<path d="M12 19H3">+</path>+<path d="M14 3v4">+</path>+<path d="M16 17v4">+</path>+<path d="M21 12h-9">+</path>+<path d="M21 19h-5">+</path>+<path d="M21 5h-7">+</path>+<path d="M8 10v4">+</path>+<path d="M8 12H3">+</path>+</svg>Color grading</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/storyboard">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-gallery-horizontal size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M2 3v18">+</path>+<rect width="12" height="18" x="6" y="3" rx="2">+</rect>+<path d="M22 3v18">+</path>+</svg>Storyboard</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/canvas">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-network size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<rect x="16" y="16" width="6" height="6" rx="1">+</rect>+<rect x="2" y="16" width="6" height="6" rx="1">+</rect>+<rect x="9" y="2" width="6" height="6" rx="1">+</rect>+<path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3">+</path>+<path d="M12 12V8">+</path>+</svg>Canvas</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/shorts">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-smartphone size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<rect width="14" height="20" x="5" y="2" rx="2" ry="2">+</rect>+<path d="M12 18h.01">+</path>+</svg>Shorts Studio</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/ads">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-target size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<circle cx="12" cy="12" r="10">+</circle>+<circle cx="12" cy="12" r="6">+</circle>+<circle cx="12" cy="12" r="2">+</circle>+</svg>Ads Studio</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/moodboards">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-images size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16">+</path>+<path d="M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2">+</path>+<circle cx="13" cy="7" r="1" fill="currentColor">+</circle>+<rect x="8" y="2" width="14" height="14" rx="2">+</rect>+</svg>Moodboards</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/photodump">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-camera size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z">+</path>+<circle cx="12" cy="13" r="3">+</circle>+</svg>Photodump</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/fashion-factory">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shirt size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z">+</path>+</svg>Fashion Factory</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/character-sheet">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-round-cog lucide-user-cog-2 size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m14.305 19.53.923-.382">+</path>+<path d="m15.228 16.852-.923-.383">+</path>+<path d="m16.852 15.228-.383-.923">+</path>+<path d="m16.852 20.772-.383.924">+</path>+<path d="m19.148 15.228.383-.923">+</path>+<path d="m19.53 21.696-.382-.924">+</path>+<path d="M2 21a8 8 0 0 1 10.434-7.62">+</path>+<path d="m20.772 16.852.924-.383">+</path>+<path d="m20.772 19.148.924.383">+</path>+<circle cx="10" cy="8" r="5">+</circle>+<circle cx="18" cy="18" r="3">+</circle>+</svg>Character Sheet</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/influencer">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-round-pen size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M2 21a8 8 0 0 1 10.821-7.487">+</path>+<path d="M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z">+</path>+<circle cx="10" cy="8" r="5">+</circle>+</svg>AI Influencer</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/faceless">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-tv size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m17 2-5 5-5-5">+</path>+<rect width="20" height="15" x="2" y="7" rx="2">+</rect>+</svg>Faceless Studio</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/content-factory">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-factory size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M12 16h.01">+</path>+<path d="M16 16h.01">+</path>+<path d="M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z">+</path>+<path d="M8 16h.01">+</path>+</svg>Content Factory</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/explainer">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-presentation size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M2 3h20">+</path>+<path d="M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3">+</path>+<path d="m7 21 5-5 5 5">+</path>+</svg>Explainer</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/lipsync">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-mic-vocal lucide-mic-2 size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12">+</path>+<path d="M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5">+</path>+<circle cx="16" cy="7" r="5">+</circle>+</svg>Lipsync & avatars</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/video-edit">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-scissors size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<circle cx="6" cy="6" r="3">+</circle>+<path d="M8.12 8.12 12 12">+</path>+<path d="M20 4 8.12 15.88">+</path>+<circle cx="6" cy="18" r="3">+</circle>+<path d="M14.8 14.8 20 20">+</path>+</svg>Edit video</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/extend">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-fast-forward size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z">+</path>+<path d="M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z">+</path>+</svg>Extend video</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/reframe">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-crop size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M6 2v14a2 2 0 0 0 2 2h14">+</path>+<path d="M18 22V8a2 2 0 0 0-2-2H2">+</path>+</svg>Reframe</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/video-tools">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layers lucide-layers-3 size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z">+</path>+<path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12">+</path>+<path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17">+</path>+</svg>Video tools</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/elements">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-at-sign size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<circle cx="12" cy="12" r="4">+</circle>+<path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8">+</path>+</svg>Elements</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/upscale">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-in size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<circle cx="11" cy="11" r="8">+</circle>+<line x1="21" x2="16.65" y1="21" y2="16.65">+</line>+<line x1="11" x2="11" y1="8" y2="14">+</line>+<line x1="8" x2="14" y1="11" y2="11">+</line>+</svg>Upscale</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/katana">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-swords size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="m13 19 6-6">+</path>+<path d="M14.5 17.5 3.586 6.586A2 2 0 013 5.172V3h2.172a2 2 0 011.414.586L17.5 14.5">+</path>+<path d="m14.828 6.172 2.586-2.586A2 2 0 0118.828 3H21v2.172a2 2 0 01-.586 1.414l-2.586 2.586">+</path>+<path d="m16 16 4 4">+</path>+<path d="m19 21 2-2">+</path>+<path d="m5 14 4 4">+</path>+<path d="m5 21-2-2">+</path>+<path d="M7.5 16.5 4 20">+</path>+</svg>Katana</a>+</li>+<li>+<a class="group inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[13px] transition-colors hover:bg-accent" href="/virality">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trending-up size-3.5 text-muted-foreground transition-colors group-hover:text-brand-text" aria-hidden="true">+<path d="M16 7h6v6">+</path>+<path d="m22 7-8.5 8.5-5-5L2 17">+</path>+</svg>Hook check</a>+</li>+</ul>+</div>+</section>\ No newline at end of filediff --git a/tests/e2e/nav-hubs.mjs b/tests/e2e/nav-hubs.mjsnew file mode 100644index 00000000..7ffab4b4--- /dev/null+++ b/tests/e2e/nav-hubs.mjs@@ -0,0 +1,460 @@+// The area pages (/create, /studios, /apps, /motions-and-effects) and the bar's split items in a real browser: a name goes+// to its page, a chevron (or ArrowDown, or a mouse resting on Create or Motions & effects) opens the menu, every menu and+// phone sheet has "See all", section tabs stay under the bar, the bar keeps its width, taps are 44 px, nothing shifts,+// nothing scrolls sideways, no console errors.+// Usage: node tests/e2e/nav-hubs.mjs [appUrl] [shotsDir]+// E2E_OWNER_PASSWORD: the studio's password, when it has one. With public sign-up on, the account checks sign up a+// throwaway qa account (deleted at the end); without it the visitor is the owner and the guest/account checks are skipped.+// Exits 1 if any check fails; screenshots of each area page (390 and 1440, light and dark) go to shotsDir when given.+import fs from "node:fs";+import path from "node:path";+import { DESKTOP, launch, openRoute, PHONE } from "./_browser.mjs";++const args = process.argv.slice(2).filter((a) => !a.startsWith("--"));+const app = (args[0] ?? "http://localhost:3000").replace(/\/$/, "");+const shots = args[1];+if (shots) fs.mkdirSync(shots, { recursive: true });+const failures = [];+const check = (ok, what, detail = "") => {+ console.log(`${ok ? "✓" : "✗"} ${what}${detail ? ` (${detail})` : ""}`);+ if (!ok) failures.push(what);+};+const AREAS = ["/create", "/studios", "/apps", "/motions-and-effects"];+const publicSignup = !!(await fetch(`${app}/api/auth/me`).then((r) => r.json()).catch(() => null))?.publicSignup;+const browser = await launch();+const accounts = [];++/** A context as `who` ("visitor": whoever opens the site; "owner"; "account"). */+async function as(who, device = DESKTOP, extra = {}) {+ const ctx = await browser.newContext({ ...device, ...extra });+ ctx.errors = [];+ if (who === "owner" && process.env.E2E_OWNER_PASSWORD) await ctx.request.post(`${app}/api/auth/login`, { data: { password: process.env.E2E_OWNER_PASSWORD } });+ if (who === "account") {+ const email = `qa-hubs-${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}@example.com`;+ const password = `Qa-${Math.random().toString(36).slice(2)}-${Date.now()}`;+ const res = await ctx.request.post(`${app}/api/auth/signup`, { data: { email, password } });+ if (!res.ok()) throw new Error(`sign-up answered ${res.status()}`);+ accounts.push({ ctx, password });+ }+ return ctx;+}+async function page(ctx) {+ const p = await ctx.newPage();+ p.on("pageerror", (e) => ctx.errors.push(e.message.split("\n")[0]));+ p.on("console", (m) => m.type() === "error" && !/Failed to load resource/.test(m.text()) && ctx.errors.push(m.text().slice(0, 200)));+ // Layout shifts from the first paint on, summed as CLS counts them (not after input).+ await p.addInitScript(() => {+ window.__cls = 0;+ new PerformanceObserver((list) => {+ for (const e of list.getEntries()) if (!e.hadRecentInput) window.__cls += e.value;+ }).observe({ type: "layout-shift", buffered: true });+ });+ return p;+}+const bar = (p) => p.locator("[data-top-bar]");+const pathOf = (p) => new URL(p.url()).pathname;+const activeName = (p) => p.evaluate(() => (document.activeElement?.getAttribute("aria-label") || document.activeElement?.textContent || "").replace(/\s+/g, " ").trim());+const activeRole = (p) => p.evaluate(() => document.activeElement?.getAttribute("role") ?? document.activeElement?.tagName.toLowerCase());+const waitPath = (p, want) => p.waitForURL((u) => new URL(u).pathname === want, { timeout: 20_000 }).then(() => true, () => false);++try {+ // 1. Desktop: names go to their pages, chevrons open menus, keys, hover, See all.+ {+ const ctx = await as("visitor");+ const p = await page(ctx);+ await openRoute(p, `${app}/image`);+ const items = [+ { name: "Create", href: "/create", chevron: "Create menu", seeAll: "See all of Create" },+ { name: /^Studios, \d+ studios$/, href: "/studios", chevron: "Studios menu", seeAll: "See all studios" },+ { name: "Motions & effects", href: "/motions-and-effects", chevron: "Motions & effects menu", seeAll: "See all motions & effects" },+ ];+ const seeAllIn = (it) =>+ (it.href === "/studios" ? p.locator("#studios-launcher").getByRole("link", { name: it.seeAll, exact: true }) : p.getByRole("menu").getByRole("menuitem", { name: it.seeAll, exact: true }));+ for (const it of items) {+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).click();+ const went = await waitPath(p, it.href);+ await p.locator("main h1").first().waitFor();+ check(went, `${it.href}: clicking the bar's name opens it`, pathOf(p));+ const current = await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).getAttribute("aria-current");+ const others = await bar(p).locator('[data-bar-split] a[aria-current="page"]').count();+ check(current === "page" && others === 1, `${it.href}: its name is aria-current=page, and no other split item's`, `${current}, ${others}`);+ check((await p.getByRole("menu").count()) === 0 && !(await p.locator("#studios-launcher").isVisible().catch(() => false)), `${it.href}: following the name opens no menu`);+ }++ // The chevron: click opens, Esc closes and gives focus back to it.+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ for (const name of ["Create menu", "Motions & effects menu"]) {+ const chev = bar(p).getByRole("button", { name, exact: true });+ await chev.click();+ const menu = p.getByRole("menu");+ const opened = await menu.waitFor({ timeout: 5_000 }).then(() => true, () => false);+ check(opened && (await chev.getAttribute("data-state")) === "open", `${name}: the chevron opens it`);+ check(pathOf(p) === "/image", `${name}: opening it stays on the page`);+ await p.keyboard.press("Escape");+ await menu.waitFor({ state: "detached" }).catch(() => {});+ check(await chev.evaluate((b) => b === document.activeElement), `${name}: Esc closes it and focus goes back to the chevron`);+ }+ {+ const chev = bar(p).getByRole("button", { name: "Studios menu", exact: true });+ const panel = p.locator("#studios-launcher");+ await chev.click();+ await panel.waitFor({ state: "visible" });+ check(/^Cinema Studio/.test(await activeName(p)), "Studios menu: the chevron opens the launcher on Cinema Studio", await activeName(p));+ await p.keyboard.press("Escape");+ await panel.waitFor({ state: "hidden" });+ check(await chev.evaluate((b) => b === document.activeElement), "Studios menu: Esc closes it and focus goes back to the chevron");+ }++ // ArrowDown on a name opens its menu on the first row.+ for (const it of items) {+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).focus();+ await p.keyboard.press("ArrowDown");+ await p.waitForTimeout(250);+ const role = await activeRole(p);+ const name = await activeName(p);+ const ok = it.href === "/studios" ? /^Cinema Studio/.test(name) : role === "menuitem";+ check(ok && pathOf(p) === "/image", `${it.href}: ArrowDown on the name opens the menu on its first row`, `${role} ${name}`);+ await p.keyboard.press("Escape");+ if (it.href !== "/studios") {+ await p.waitForTimeout(150);+ const back = await bar(p).getByRole("link", { name: it.name, exact: true }).evaluate((a) => a === document.activeElement);+ check(back, `${it.href}: Esc after ArrowDown on the name gives focus back to the name`);+ }+ }++ // A mouse resting on Create or Motions & effects opens its menu after a moment, leaves focus in the prompt being+ // typed, and leaving closes it. The Studios launcher (it spans the page) opens by a click or a key only.+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ const prompt = p.locator("main textarea").first();+ for (const it of items) {+ await prompt.focus();+ const label = bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" });+ const box = await label.boundingBox();+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);+ await p.waitForTimeout(120);+ const early = it.href === "/studios" ? await p.locator("#studios-launcher").isVisible().catch(() => false) : (await p.getByRole("menu").count()) > 0;+ await p.waitForTimeout(450);+ const late = it.href === "/studios" ? await p.locator("#studios-launcher").isVisible().catch(() => false) : (await p.getByRole("menu").count()) > 0;+ if (it.href === "/studios") {+ check(!early && !late, "/studios: resting the mouse on Studios opens nothing (the launcher opens by a click or a key)", `${early} → ${late}`);+ } else {+ check(!early && late, `${it.href}: resting the mouse on it opens its menu after a moment, not at once`, `${early} → ${late}`);+ check((await seeAllIn(it).count()) === 1, `${it.href}: the menu has its See all`);+ }+ const kept = await prompt.evaluate((el) => el === document.activeElement);+ check(kept, `${it.href}: resting on it leaves focus in the prompt`, await activeName(p));+ await p.mouse.move(700, 800);+ await p.waitForTimeout(600);+ const gone = it.href === "/studios" ? !(await p.locator("#studios-launcher").isVisible().catch(() => false)) : (await p.getByRole("menu").count()) === 0;+ check(gone, `${it.href}: moving the mouse away closes it`);+ }++ // Resting on a pinned launcher's neighbour: one panel at a time.+ {+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ await bar(p).getByRole("button", { name: "Studios menu", exact: true }).click();+ await p.locator("#studios-launcher").waitFor({ state: "visible" });+ const box = await bar(p).getByRole("link", { name: "Create", exact: true }).boundingBox();+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);+ await p.waitForTimeout(600);+ const launcher = await p.locator("#studios-launcher").isVisible().catch(() => false);+ check(!launcher && (await p.getByRole("menu").count()) === 1, "resting on Create while the launcher is open swaps one for the other", `launcher ${launcher}`);+ await p.mouse.move(700, 800);+ await p.waitForTimeout(600);+ }++ // On an area's own page, resting on its name opens nothing over it.+ for (const it of items.filter((x) => x.href !== "/studios")) {+ await openRoute(p, app + it.href, { settleMs: 300 });+ const box = await bar(p).getByRole("link", { name: it.name, exact: true }).boundingBox();+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);+ await p.waitForTimeout(700);+ check((await p.getByRole("menu").count()) === 0, `${it.href}: resting on its own name there opens nothing`);+ await p.mouse.move(700, 800);+ }++ // See all goes to the page.+ for (const it of items) {+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ await bar(p).getByRole("button", { name: it.chevron, exact: true }).click();+ await seeAllIn(it).click();+ check(await waitPath(p, it.href), `${it.href}: See all in the menu opens it`, pathOf(p));+ }+ check(ctx.errors.length === 0, "desktop: no console errors", ctx.errors.join(" | "));+ await ctx.close();+ }++ // 2. A touch screen never opens a menu by hovering: a tap on the name goes to the page.+ {+ const ctx = await as("visitor", { viewport: { width: 1024, height: 768 }, hasTouch: true, isMobile: true });+ const p = await page(ctx);+ await openRoute(p, `${app}/image`);+ const fine = await p.evaluate(() => matchMedia("(hover: hover) and (pointer: fine)").matches);+ const label = bar(p).getByRole("link", { name: "Create", exact: true });+ const box = await label.boundingBox();+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);+ await p.waitForTimeout(500);+ check(!fine && (await p.getByRole("menu").count()) === 0, "touch: resting on Create opens nothing");+ const chev = await bar(p).getByRole("button", { name: "Create menu" }).boundingBox();+ check(chev.width >= 44 && chev.height >= 44, "touch: the chevron is 44x44", `${chev.width}x${chev.height}`);+ await label.tap();+ check((await waitPath(p, "/create")) && (await p.getByRole("menu").count()) === 0, "touch: a tap on Create goes to /create");+ await ctx.close();+ }++ // 3. The bar keeps its width: at each width, for each viewer, the bar's items fit with a classic scrollbar to spare.+ {+ const viewers = publicSignup ? ["visitor", "account", ...(process.env.E2E_OWNER_PASSWORD ? ["owner"] : [])] : ["visitor"];+ const widths = [768, 1024, 1280, 1440];+ const rows = [];+ for (const who of viewers) {+ for (const coarse of [false, true]) {+ const ctx = await as(who, { viewport: { width: 1440, height: 900 }, ...(coarse && { hasTouch: true, isMobile: true }) });+ const p = await page(ctx);+ await openRoute(p, `${app}/image`);+ const kind = (await (await ctx.request.get(`${app}/api/auth/me`)).json().catch(() => ({}))) ?? {};+ const as_ = kind.owner ? "owner" : kind.account ? "account" : "guest";+ for (const w of widths) {+ await p.setViewportSize({ width: w, height: 900 });+ await p.waitForTimeout(250);+ const m = await bar(p).evaluate((h) => {+ const nav = h.querySelector('nav[aria-label="Main"]');+ const spacer = nav.nextElementSibling;+ return { spare: Math.round(spacer.getBoundingClientRect().width), clipped: nav.scrollWidth - nav.clientWidth > 1 || h.scrollWidth - h.clientWidth > 1, hidden: nav.scrollWidth - nav.clientWidth };+ });+ rows.push(`${as_}${coarse ? " (touch)" : ""} @${w}: ${m.spare}px spare`);+ // With a mouse, each split item is exactly as wide as the plain item it replaced: its name, then 40 px (48 from+ // 1440) for the padding, the gap and the chevron.+ if (!coarse) {+ const off = await bar(p).evaluate((h, pad) => {+ const bad = [];+ for (const s of h.querySelectorAll("[data-bar-split]")) {+ const r = s.getBoundingClientRect();+ if (!r.width) continue;+ const range = document.createRange();+ range.selectNodeContents(s.querySelector("a"));+ const text = range.getBoundingClientRect().width;+ if (Math.abs(r.width - (text + pad)) > 1) bad.push(`${s.textContent.trim()} ${Math.round(r.width)} vs ${Math.round(text + pad)}`);+ }+ return bad;+ }, w >= 1440 ? 48 : 40);+ check(off.length === 0, `bar width: ${as_} at ${w}, each split item is as wide as the item it replaced`, off.join("; "));+ }+ // Nothing cut off. With a mouse, the split items are the old items' width (checked above), so a cut there is the+ // bar's own (a guest's Log in and Sign up at 1440 cut 15 px before the split items too): reported, not failed.+ // On a touch screen the chevrons are wider (44 px), so there the bar must still fit.+ if (coarse || !m.clipped) check(!m.clipped, `bar width: ${as_}${coarse ? " on touch" : ""} at ${w}, everything fits`, `${m.spare}px spare, ${m.hidden}px cut`);+ else console.log(`note: bar width: ${as_} at ${w}: the bar's items are cut by ${m.hidden}px (as before the split items)`);+ }+ await ctx.close();+ }+ }+ if (shots) fs.writeFileSync(path.join(shots, "bar-widths.txt"), `${rows.join("\n")}\n`);+ }++ // 4. Phone: the Create and Studios sheets' See all; the Studios sheet still fits 390x844.+ {+ const ctx = await as("visitor", PHONE);+ const p = await page(ctx);+ const tabs = p.locator("[data-phone-tabs]");+ const sheet = p.locator("#phone-sheet");+ for (const [tab, href] of [+ ["Create", "/create"],+ ["Studios", "/studios"],+ ]) {+ await openRoute(p, `${app}/image`);+ await tabs.getByRole("button", { name: tab }).tap();+ await sheet.waitFor({ state: "visible" });+ await p.waitForTimeout(350);+ const see = sheet.getByRole("link", { name: `See all ${tab.toLowerCase()}` });+ const box = await see.boundingBox();+ check(!!box && box.height >= 44 && box.x + box.width <= 390, `phone ${tab} sheet: See all is in its header, 44 px tall`, box ? `${box.width}x${box.height}` : "missing");+ if (tab === "Studios") {+ const tiles = sheet.locator("ul").first().getByRole("link");+ const seen = await tiles.evaluateAll((els) => els.map((el) => el.getBoundingClientRect()).map((r) => r.top >= 0 && r.bottom <= innerHeight));+ check(seen.length === 33 && seen.every(Boolean), "phone Studios sheet: all 33 tiles fit 390x844 with See all in the header", `${seen.filter(Boolean).length}/${seen.length}`);+ check((await sheet.getByRole("button", { name: "Search everything" }).count()) === 1, "phone Studios sheet: Search everything is an icon button");+ if (shots) await p.screenshot({ path: path.join(shots, "phone-studios-sheet-390.png") });+ }+ await see.tap();+ const went = await waitPath(p, href);+ const closed = await sheet.waitFor({ state: "detached", timeout: 5_000 }).then(() => true, () => false);+ check(went && closed, `phone ${tab} sheet: See all opens ${href} and closes the sheet`);+ const selected = await tabs.locator(`[data-tab="${tab.toLowerCase()}"]`).evaluate((t) => t.getAttribute("aria-current") ?? t.getAttribute("data-selected") ?? t.getAttribute("aria-pressed") ?? t.className);+ check(/page|true|selected|text-foreground/.test(String(selected)), `phone: on ${href} the ${tab} tab is selected`, String(selected).slice(0, 80));+ }+ check(ctx.errors.length === 0, "phone: no console errors", ctx.errors.join(" | "));+ await ctx.close();+ }++ // 5. Each area page at 390: taps of 44 px, no sideways scroll, no layout shift; and screenshots in both schemes.+ for (const scheme of ["light", "dark"]) {+ for (const [device, tag] of [+ [PHONE, "390"],+ [DESKTOP, "1440"],+ ]) {+ const ctx = await as("visitor", device, { colorScheme: scheme });+ const p = await page(ctx);+ for (const route of AREAS) {+ await openRoute(p, app + route, { settleMs: 1500 });+ const h1 = (await p.locator("main h1").first().textContent())?.trim();+ check(!!h1, `${route} ${tag} ${scheme}: has its heading`, h1);+ const cls = await p.evaluate(() => window.__cls);+ check(cls < 0.02, `${route} ${tag} ${scheme}: no layout shift on load (CLS < 0.02)`, cls.toFixed(4));+ if (tag === "390") {+ const over = await p.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);+ check(over <= 0, `${route} 390 ${scheme}: no sideways scroll`, `${over}px`);+ // Everything this page adds (its header, tabs, sections, More in Fuobe), not the shared gallery or footer.+ const small = await p.evaluate(() => {+ const out = [];+ const scope = [...document.querySelectorAll("main header, main section:not(#every-app):not(#every-app *), main nav")];+ const seen = new Set();+ for (const s of scope)+ for (const el of s.querySelectorAll("a[href], button")) {+ // Not the shared gallery or footer, nor a control inside a picture that is out of reach (inert).+ if (seen.has(el) || el.closest("#every-app, footer, [inert]")) continue;+ seen.add(el);+ const r = el.getBoundingClientRect();+ if (!r.width || !r.height || getComputedStyle(el).visibility === "hidden") continue;+ const after = getComputedStyle(el, "::after");+ let h = r.height;+ let w = r.width;+ if (after.content !== "none" && after.position === "absolute") {+ h = r.height - (parseFloat(after.top) || 0) - (parseFloat(after.bottom) || 0);+ w = r.width - (parseFloat(after.left) || 0) - (parseFloat(after.right) || 0);+ }+ if (h < 43.5 || w < 24) out.push(`${(el.getAttribute("aria-label") || el.textContent || "").trim().slice(0, 30)} ${Math.round(w)}x${Math.round(h)}`);+ }+ return out;+ });+ check(small.length === 0, `${route} 390 ${scheme}: every tap target is at least 44 px tall`, small.slice(0, 6).join("; "));+ }+ if (shots) {+ const name = `${route.slice(1)}-${tag}-${scheme}`;+ await p.screenshot({ path: path.join(shots, `${name}.png`) });+ await p.screenshot({ path: path.join(shots, `${name}-full.png`), fullPage: true });+ }+ }+ check(ctx.errors.length === 0, `${tag} ${scheme}: no console errors`, ctx.errors.join(" | "));+ await ctx.close();+ }+ }++ // 6. Signed in: "Jump back in" lists what was opened in this area; a guest never sees it.+ {+ const who = publicSignup ? "account" : "visitor";+ const ctx = await as(who);+ const p = await page(ctx);+ await openRoute(p, `${app}/extend`, { settleMs: 600 });+ await openRoute(p, `${app}/studios`, { settleMs: 800 });+ const jump = p.getByRole("heading", { name: "Jump back in" });+ check((await jump.count()) === 1 && (await p.locator("section[aria-labelledby=jump-back-in]").getByRole("link", { name: /^Extend/ }).count()) === 1, `${who}: /studios shows Jump back in with Extend video`);+ if (shots) await jump.scrollIntoViewIfNeeded().then(() => p.screenshot({ path: path.join(shots, `studios-jump-back-in-${who}.png`) }));+ await ctx.close();+ if (publicSignup) {+ const g = await as("visitor");+ const gp = await page(g);+ await openRoute(gp, `${app}/extend`, { settleMs: 600 });+ await openRoute(gp, `${app}/studios`, { settleMs: 800 });+ check((await gp.getByRole("heading", { name: "Jump back in" }).count()) === 0, "guest: no Jump back in");+ const restore = await gp.getByRole("link", { name: "Restore & colourise" }).count();+ check(restore === 0, "guest: no owner-only pill (Restore & colourise)");+ await g.close();+ } else {+ // The visitor is the owner here: their own mode shows.+ const o = await as("visitor");+ const op = await page(o);+ await openRoute(op, `${app}/studios`, { settleMs: 1000 });+ check((await op.getByRole("link", { name: "Restore & colourise" }).count()) === 1, "owner: their own pill (Restore & colourise) shows");+ await o.close();+ }+ }++ // 7. Search inside an area: only its pages, named on a chip that removes it.+ {+ const ctx = await as("visitor");+ const p = await page(ctx);+ await openRoute(p, `${app}/studios`);+ await p.locator("main header").getByRole("button", { name: /^Search studios/ }).locator("visible=true").click();+ const dialog = p.getByRole("dialog", { name: "Search Fuobe" });+ await dialog.waitFor();+ check((await dialog.getByRole("button", { name: /^Searching in Studios/ }).count()) === 1, "area search: opens on a Studios chip");+ await p.keyboard.type("extend");+ await p.waitForTimeout(400);+ const text = await dialog.innerText();+ check(/Extend video/.test(text), "area search: finds a studio in the area");+ await p.keyboard.press("Escape");+ await ctx.close();+ }++ // 8. Gallery links: a "by kind" pill opens the gallery on that category; the tab rows only jump within their page, and+ // /apps has one category control (the gallery's).+ {+ const ctx = await as("visitor");+ const p = await page(ctx);+ await openRoute(p, `${app}/motions-and-effects`);+ const tabHrefs = await p.locator('main nav[aria-label$="sections"] a').evaluateAll((as) => as.map((a) => a.getAttribute("href")));+ check(tabHrefs.length === 2 && tabHrefs.every((h) => h.startsWith("#")), "motions-and-effects: its tabs only jump within the page", tabHrefs.join(" "));+ const pill = p.locator('main section a[href^="/motions?category="]').first();+ const cat = decodeURIComponent((await pill.getAttribute("href")).split("=")[1]);+ await pill.click();+ await waitPath(p, "/motions");+ await p.waitForTimeout(800);+ const pressed = await p.locator('[aria-label="Categories"] button[aria-pressed="true"]').innerText();+ check(pressed.trim() === cat, `motions: the ${cat} pill opens the gallery on ${cat}`, pressed);+ check((await p.getByRole("link", { name: "Motions & effects" }).first().count()) === 1, "/motions links back to Motions & effects");+ await openRoute(p, `${app}/apps`);+ check((await p.locator('main a[href*="category="]').count()) === 0, "apps: no category tabs over the gallery's own filter row");+ await p.locator("main header").getByRole("link", { name: /^See all \d+/ }).click();+ await p.waitForTimeout(600);+ const top = await p.locator("#every-app").evaluate((el) => el.getBoundingClientRect().top);+ check(top >= 0 && top < 200, "apps: See all jumps to every app", `${Math.round(top)}px`);+ check(ctx.errors.length === 0, "galleries: no console errors", ctx.errors.join(" | "));+ await ctx.close();+ }++ // 9. Section tabs stay under the bar and mark the section being read; a phone shows two cards a row.+ for (const [device, tag, barH] of [+ [DESKTOP, "1440", 56],+ [PHONE, "390", 48],+ ]) {+ const ctx = await as("visitor", device);+ const p = await page(ctx);+ await openRoute(p, `${app}/studios`, { settleMs: 600 });+ const tabs = p.locator('main nav[aria-label="Studios sections"]');+ await tabs.getByRole("link", { name: "Sound" }).click();+ await p.waitForTimeout(1200);+ const r = await tabs.evaluate((n) => n.getBoundingClientRect().toJSON());+ check(Math.abs(r.top - barH) <= 2, `/studios ${tag}: the tabs stay under the bar after a jump`, `top ${Math.round(r.top)}`);+ const sound = await p.locator("#sound").evaluate((el) => el.getBoundingClientRect().top);+ check(sound >= r.bottom - 2 && sound < r.bottom + 60, `/studios ${tag}: the section starts under the tabs`, `${Math.round(sound)} vs ${Math.round(r.bottom)}`);+ const on = await tabs.locator('a[aria-current="true"]').innerText().catch(() => "");+ check(on.trim() === "Sound", `/studios ${tag}: the Sound tab is marked`, on);+ if (tag === "390") {+ const cols = await p.locator("#film a.group\\/studio").evaluateAll((els) => [...new Set(els.map((el) => Math.round(el.getBoundingClientRect().left)))].length);+ check(cols === 2, "/studios 390: two cards a row", `${cols} columns`);+ }+ for (const [route, label] of [+ ["/create", "Create sections"],+ ["/motions-and-effects", "Motions & effects sections"],+ ]) {+ await openRoute(p, app + route, { settleMs: 400 });+ await p.evaluate(() => window.scrollBy(0, 2400));+ await p.waitForTimeout(600);+ const t = await p.locator(`main nav[aria-label="${label}"]`).evaluate((n) => n.getBoundingClientRect().top);+ check(Math.abs(t - barH) <= 2, `${route} ${tag}: the tabs stay under the bar while scrolling`, `top ${Math.round(t)}`);+ }+ if (shots) await p.screenshot({ path: path.join(shots, `x-sticky-tabs-${tag}.png`) });+ check(ctx.errors.length === 0, `sticky tabs ${tag}: no console errors`, ctx.errors.join(" | "));+ await ctx.close();+ }+} catch (e) {+ check(false, "the run finished", e.message.split("\n")[0]);+} finally {+ for (const { ctx, password } of accounts) await ctx.request.delete(`${app}/api/auth/me`, { data: { password } }).catch(() => {});+ await browser.close();+}+console.log(failures.length ? `\n${failures.length} failed` : "\nall passed");+process.exit(failures.length ? 1 : 0);diff --git a/tests/e2e/nav.mjs b/tests/e2e/nav.mjsindex d3aa91a1..27a8c2aa 100644--- a/tests/e2e/nav.mjs+++ b/tests/e2e/nav.mjs@@ -73,15 +73,16 @@ try {await openRoute(p, `${app}/image`);const order = [];let rings = true;- for (let i = 0; i < 12; i++) {+ for (let i = 0; i < 15; i++) {await p.keyboard.press("Tab");const f = await focused(p);order.push(f?.name ?? "");if (i > 0 && !f?.ring) rings = false;}- const want = ["Skip to content", "Fuobe home", "Create", /^Studios/, "Apps", "Motions & effects", "Canvas", "Assist", "Library", /^Search/, "New creation"];+ // Create, Studios and Motions & effects are a link to their page, then their menu's chevron.+ const want = ["Skip to content", "Fuobe home", "Create", "Create menu", /^Studios, [0-9]+ studios$/, "Studios menu", "Apps", "Motions & effects", "Motions & effects menu", "Canvas", "Assist", "Library", /^Search/, "New creation"];const ok = want.every((w, i) => (typeof w === "string" ? order[i] === w : w.test(order[i])));- check(ok, "Tab order: Skip, wordmark, Create, Studios, Apps, Motions & effects, Canvas, Assist, Library, Search, New creation", order.join(" › "));+ check(ok, "Tab order: Skip, wordmark, Create (+ menu), Studios (+ menu), Apps, Motions & effects (+ menu), Canvas, Assist, Library, Search, New creation", order.join(" › "));check(rings, "every bar stop shows a focus ring");// The search field is 280 px from 1440 (an lg rule must not win over it) and its name is the words it shows.const field = await p.locator('[data-top-bar] button[aria-keyshortcuts="/ Meta+K Control+K"]').evaluate((b) => ({ w: b.getBoundingClientRect().width, text: b.innerText.trim(), label: b.getAttribute("aria-label") }));@@ -160,10 +161,10 @@ try {await p.setViewportSize({ width: w, height: h });await trigger.click();await panel.waitFor({ state: "visible" });- const links = panel.getByRole("link");- const seen = await inView(links);+ const links = panel.locator("a[data-col]");+ const seen = [...(await inView(links)), ...(await inView(panel.getByRole("link", { name: "See all studios", exact: true })))];const scrolls = await panel.evaluate((el) => el.scrollHeight > el.clientHeight + 1);- check(seen.length === 33 && seen.every(Boolean) && !scrolls, `launcher at ${w}x${h}: all 33 links on screen, no scrolling`, `${seen.filter(Boolean).length}/${seen.length}`);+ check(seen.length === 34 && seen.every(Boolean) && !scrolls, `launcher at ${w}x${h}: all 33 studios and See all on screen, no scrolling`, `${seen.filter(Boolean).length}/${seen.length}`);await p.keyboard.press("Escape");}await p.setViewportSize(DESKTOP.viewport);@@ -171,7 +172,7 @@ try {await panel.getByRole("link", { name: /^Marketing Studio/ }).click();const landed = await (p.waitForURL((u) => new URL(u).pathname === "/marketing", { timeout: 20_000 }).then(() => panel.waitFor({ state: "hidden" }))).then(() => true, () => false);check(landed, "launcher: Marketing Studio lands on /marketing and the launcher closes");- check((await trigger.getAttribute("data-active")) !== null, "on /marketing the Studios trigger is marked");+ check((await trigger.locator("xpath=ancestor::*[@data-bar-split][1]").getAttribute("data-active")) !== null, "on /marketing the Studios item is marked");await trigger.click();check((await panel.getByRole("link", { name: /^Marketing Studio/ }).getAttribute("aria-current")) === "page", "…and Marketing Studio has aria-current=page");await p.keyboard.press("Escape");@@ -184,7 +185,7 @@ try {const ctx = await as("guest");const p = await page(ctx);await openRoute(p, `${app}/`);- for (const name of ["Create", "Menu"]) {+ for (const name of ["Create menu", "Menu"]) {const button = p.locator("[data-top-bar]").getByRole("button", { name, exact: true });await button.focus();await p.keyboard.press("Enter");diff --git a/tests/home-studios-markup.test.ts b/tests/home-studios-markup.test.tsnew file mode 100644index 00000000..d3390458--- /dev/null+++ b/tests/home-studios-markup.test.ts@@ -0,0 +1,29 @@+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { createElement, type ReactNode } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it, vi } from "vitest";++/*+ * Home's "Studios and tools" section is the pattern every area page (/create, /studios…) repeats. The area pages share+ * its component, and Home must look exactly as it did: its markup is pinned here.+ */++vi.mock("next/cache", () => ({ cacheLife: () => {} }));+vi.mock("next/navigation", () => ({+ useRouter: () => ({ prefetch: () => {}, push: () => {}, replace: () => {}, back: () => {}, refresh: () => {} }),+ usePathname: () => "/",+ useSearchParams: () => new URLSearchParams(),+}));++const { StudiosSection } = await import("@/components/home/home-sections");+const { homeShowcase } = await import("@/lib/home-showcase");++const render = (node: ReactNode) => renderToStaticMarkup(createElement(QueryClientProvider, { client: new QueryClient() }, node));++describe("Home's Studios and tools", () => {+ it("renders the same markup as before the area pages shared it", async () => {+ const home = await homeShowcase();+ const html = render(createElement(StudiosSection, { facts: home.facts, studios: home.studios, audioTools: home.audioTools, pills: home.pills }));+ await expect(html.replace(/></g, ">\n<")).toMatchFileSnapshot("__snapshots__/home-studios.html");+ });+});diff --git a/tests/nav-areas.test.ts b/tests/nav-areas.test.tsnew file mode 100644index 00000000..be1ce152--- /dev/null+++ b/tests/nav-areas.test.ts@@ -0,0 +1,292 @@+import { describe, expect, it, vi } from "vitest";++/*+ * The area pages (/create, /studios, /apps, /motions-and-effects): what each one lists, against the navigation model, for+ * each kind of viewer; their premium-first order; which bar item and phone tab each page marks; and the routes their+ * menus load ahead.+ */++vi.mock("next/cache", () => ({ cacheLife: () => {} }));+vi.mock("next/navigation", () => ({+ useRouter: () => ({ prefetch: () => {}, push: () => {}, replace: () => {}, back: () => {}, refresh: () => {} }),+ usePathname: () => "/",+ useSearchParams: () => new URLSearchParams(),+}));++const { AREAS, areaCount, areaOfPath, areaPageOf, areaSections, cardsToShow, PILL_ONLY, rankCards } = await import("@/lib/nav-areas");+const { appsAreaShowcase, areaCover, areaShowcase, MOTIONS_AREA_LINE_MAX, MOTIONS_AREA_WALL, motionsAreaShowcase, premiumFirst } = await import("@/lib/area-showcase");+const { CREATE_COLUMNS, activeEntry, entry, launcherEntries, LAUNCHER_GROUPS, NAV_ENTRIES, studioCount, visibleTo } = await import("@/lib/nav-model");+const createMenu = await import("@/components/nav/create-menu");+const { barActive, prefetchHrefs } = await import("@/components/nav/top-bar");+const { activePhoneTab } = await import("@/components/nav/phone-nav");+const { HOME_STUDIOS } = await import("@/lib/home-showcase");+const { HOME_CAPTION_MAX } = await import("@/lib/home-showcase");+const { FEATURED_BANDS, featuredBand } = await import("@/lib/preset-featured");+const { PRESET_COVERS } = await import("@/lib/preset-covers.generated");+const { APPS, EFFECTS, MOTIONS } = await import("@/lib/catalog");+const { categoryFrom, skippedInAll } = await import("@/lib/gallery-category");++const KINDS = [undefined, "guest", "account", "owner"] as const;+/** Words no visitor reads about the site itself. */+const STATUS = /\b(beta|unverified|not checked|coming soon|demo|placeholder|experimental|wip)\b/i;+const ids = (id: "create" | "studios", kind?: (typeof KINDS)[number]) => areaSections(id, kind).flatMap((s) => [...s.cards, ...s.chips]);++describe("what each area lists", () => {+ it("names only entries of the navigation model, each once per page, and only what the viewer may see", () => {+ for (const id of ["create", "studios"] as const)+ for (const kind of KINDS) {+ const all = ids(id, kind);+ for (const i of all) {+ const e = entry(i);+ expect(e, `${id}: ${i}`).toBeDefined();+ expect(visibleTo(e!, kind), `${id} for ${kind}: ${i}`).toBe(true);+ }+ expect(new Set(all).size, `${id} for ${kind}`).toBe(all.length);+ }+ });++ it("shows a guest and an account nothing that is the owner's", () => {+ for (const id of ["create", "studios"] as const)+ for (const kind of [undefined, "guest", "account"] as const)+ for (const i of ids(id, kind)) expect(entry(i)!.visibility ?? [], `${id}: ${i}`).not.toEqual(["owner"]);+ // The owner's own modes (Restore & colourise) are theirs alone.+ expect(ids("studios", "owner")).toContain("video-tools-restore");+ expect(ids("studios", "guest")).not.toContain("video-tools-restore");+ });++ it("gives every card a cover from the catalog, or a picture drawn for it, and a line that fits two lines", async () => {+ for (const id of ["create", "studios"] as const) {+ const { sections } = await areaShowcase(id);+ for (const s of sections)+ for (const c of s.cards) {+ if (c.card) expect(PRESET_COVERS, `${id}: ${c.id}`).toHaveProperty(c.card.id);+ else expect(["live-edit", "canvas"], `${id}: ${c.id} has no cover`).toContain(c.id);+ expect(c.line, `${id}: ${c.id}`).toMatch(/[.!?]$/);+ if (!HOME_STUDIOS.some((h) => h.href === c.href)) expect(c.line.length, `${id}: ${c.id}`).toBeLessThanOrEqual(64);+ }+ }+ // The model's lines too, wherever an area draws its entry as a card.+ for (const e of NAV_ENTRIES) if (e.line) expect(e.line.length, e.id).toBeLessThanOrEqual(64);+ });++ it("says the same thing about a studio as Home does", async () => {+ const { sections } = await areaShowcase("studios");+ const cinema = sections.flatMap((s) => s.cards).find((c) => c.id === "cinema")!;+ expect(cinema.line).toMatch(/^Direct a film shot by shot/);+ });++ it("puts no status words in front of a visitor", async () => {+ for (const a of AREAS) expect(`${a.title} ${a.line}`).not.toMatch(STATUS);+ for (const id of ["create", "studios"] as const) {+ const { sections } = await areaShowcase(id);+ for (const s of sections) {+ expect(`${s.title} ${s.line}`).not.toMatch(STATUS);+ for (const c of s.cards) expect(`${c.label} ${c.line}`, c.id).not.toMatch(STATUS);+ for (const p of s.pills) expect(p.label, p.id).not.toMatch(STATUS);+ }+ }+ });+});++describe("/studios", () => {+ it("has a section per launcher group, every studio in its own group's section once, and Apps as a pill", () => {+ for (const kind of KINDS) {+ const sections = areaSections("studios", kind);+ expect(sections.map((s) => s.id)).toEqual(LAUNCHER_GROUPS.map((g) => g.id));+ const listed = sections.flatMap((s) => [...s.cards, ...s.chips]);+ const studios = launcherEntries(kind).filter((e) => e.kind === "studio");+ for (const s of studios) {+ expect(listed.filter((c) => c === s.id), s.id).toHaveLength(1);+ const own = sections.find((x) => x.id === s.group)!;+ expect([...own.cards, ...own.chips], s.id).toContain(s.id);+ }+ expect(sections.flatMap((s) => s.cards)).not.toContain("apps");+ expect(sections.find((s) => s.id === "finish")!.chips).toContain("apps");+ }+ });++ it("gives each page one home: a card on /create is a pill here, and no card is on both pages", () => {+ const create = new Set(areaSections("create", "guest").flatMap((s) => s.cards));+ const studios = areaSections("studios", "guest");+ for (const id of studios.flatMap((s) => s.cards)) expect(create.has(id), id).toBe(false);+ for (const id of ["video-edit", "extend", "reframe", "upscale", "image-to-3d"]) {+ expect(create.has(id), id).toBe(true);+ expect(studios.flatMap((s) => s.chips), id).toContain(id);+ }+ for (const id of ["katana", "motion-control", "character-swap", "genjutsu", "video-tools", "audio"]) expect(create.has(id), id).toBe(false);+ });++ it("counts its studios as the bar does", () => {+ for (const kind of KINDS) expect(areaCount("studios", kind)).toBe(studioCount());+ });++ it("lists a studio's own tools under it, never a pill that repeats a card", () => {+ const sections = areaSections("studios", "guest");+ const film = sections.find((s) => s.id === "film")!;+ expect(film.chips).toContain("video-tools-captions");+ expect(film.chips).not.toContain("video-tools-matte"); // Video tools' first mode is the studio's own page+ expect(sections.find((s) => s.id === "sell")!.chips).toEqual(expect.arrayContaining(["marketing-click-to-ad", "ads-multiplier"]));+ for (const s of sections) {+ const hrefs = new Set(s.cards.map((c) => entry(c)!.href));+ for (const c of s.chips) expect(hrefs.has(entry(c)!.href), `${s.id}: ${c}`).toBe(false);+ }+ });+});++describe("/create", () => {+ it("shows every entry of the Create menu but Assist (an item of the bar), as a card or a pill, and the menu reads the model's own columns", () => {+ const all = ids("create", "guest");+ for (const c of CREATE_COLUMNS) for (const id of c.ids) if (id !== "assist") expect(all, id).toContain(id);+ expect(all).not.toContain("assist");+ expect(all).not.toContain("new");+ expect(createMenu.CREATE_COLUMNS).toBe(CREATE_COLUMNS);+ });++ it("has Make, Edit a picture, Edit a clip and Sound, with Any Angle as an app of its own", () => {+ const sections = areaSections("create", "guest");+ expect(sections.map((s) => s.title)).toEqual(["Make", "Edit a picture", "Edit a clip", "Sound"]);+ expect(sections[0].cards).toContain("any-angle");+ expect(sections[3].cards).toEqual([]);+ expect(sections[3].chips[0]).toBe("audio");+ expect(entry("any-angle")).toMatchObject({ href: "/apps/app-any-angle", kind: "tool", parent: "apps" });+ });+});++describe("full rows", () => {+ it("shows 4 or 8 cards a section, or none, the rest as its first pills", async () => {+ expect([0, 1, 3, 4, 5, 7, 8, 12].map(cardsToShow)).toEqual([0, 0, 0, 4, 4, 4, 8, 8]);+ for (const id of ["create", "studios"] as const) {+ const { sections } = await areaShowcase(id);+ for (const s of sections) expect([0, 4, 8], `${id} › ${s.id}`).toContain(s.cards.length);+ }+ });++ it("never draws a flat or drawn cover as a card", () => {+ for (const id of ["create", "studios"] as const)+ for (const kind of KINDS) for (const s of areaSections(id, kind)) for (const p of PILL_ONLY) expect(s.cards, `${id} › ${s.id}`).not.toContain(p);+ });++ it("shows the owner the same cards and sections as everyone (only their pills differ)", () => {+ for (const id of ["create", "studios"] as const) {+ const guest = areaSections(id, undefined, premiumFirst);+ const owner = areaSections(id, "owner", premiumFirst);+ expect(owner.map((s) => s.id)).toEqual(guest.map((s) => s.id));+ owner.forEach((s, i) => expect(s.cards, `${id} › ${s.id}`).toEqual(guest[i].cards));+ }+ });++ it("uses Home's cover for a studio Home shows, unless another page already has that picture", () => {+ expect(areaCover("mixed-media")).toBe(HOME_STUDIOS.find((h) => h.href === "/mixed-media")!.id);+ expect(areaCover("audio")).toBe(entry("audio")!.cover);+ });+});++describe("premium first", () => {+ it("keeps each section's lead first and orders the rest by their cover's featured band", () => {+ const band = (c: string) => ({ "app-relight": 2, "app-packshot": 0, "app-change-background": 1 })[c] ?? 3;+ expect(rankCards(["edit", "inpaint", "layers"], band)).toEqual(["edit", "layers", "inpaint"]);+ expect(rankCards([], band)).toEqual([]);+ });++ it("never fills a section's first row with a cover from the last band", async () => {+ for (const id of ["create", "studios"] as const) {+ const { sections } = await areaShowcase(id);+ for (const s of sections)+ for (const c of s.cards.slice(0, 4)) if (c.card) expect(featuredBand(c.card.id), `${id} › ${s.id}: ${c.id}`).toBeLessThan(FEATURED_BANDS - 1);+ }+ });+});++describe("Motions & effects and Apps", () => {+ it("opens on a wall of real clips that fit a phone's tile, and rows that leave the wall out", async () => {+ const m = await motionsAreaShowcase();+ expect(m.wall).toHaveLength(8);+ for (const t of MOTIONS_AREA_WALL) expect(t.caption.length, t.id).toBeLessThanOrEqual(HOME_CAPTION_MAX.wall);+ for (const t of m.wall) expect(t.card.preview.video, t.id).toBeTruthy();+ for (const t of m.wall) expect(featuredBand(t.id), t.id).toBe(0);+ const wall = new Set<string>(m.wall.map((t) => t.id));+ for (const r of [...m.motions.row, ...m.effects.row]) expect(wall.has(r.card.id), r.card.id).toBe(false);+ for (const r of [...m.motions.row, ...m.effects.row]) {+ expect(r.caption.length, r.card.id).toBeLessThanOrEqual(MOTIONS_AREA_LINE_MAX);+ expect(r.caption, r.card.id).not.toMatch(/…|\.\.\.$/);+ }+ expect(m.motions.count).toBe(MOTIONS.length);+ expect(m.effects.count).toBe(EFFECTS.length);+ expect(new Set(m.motions.categories)).toEqual(new Set(MOTIONS.map((p) => p.category)));+ });++ it("starts /apps with Home's Apps section and keeps those apps out of the gallery's All view only", async () => {+ const a = await appsAreaShowcase();+ expect(a.shown.length).toBeGreaterThan(0);+ for (const id of a.shown) expect(APPS.some((p) => p.id === id), id).toBe(true);+ const items = [{ id: "a" }, { id: "b" }, { id: "c" }];+ expect(skippedInAll(items, ["b"], false).map((i) => i.id)).toEqual(["a", "c"]);+ expect(skippedInAll(items, ["b"], true)).toHaveLength(3);+ expect(skippedInAll(items, undefined, false)).toHaveLength(3);+ });++ it("opens a gallery on the category a link asks for, and only one it has", () => {+ expect(categoryFrom("?category=Orbit", ["Orbit", "Lateral"])).toBe("Orbit");+ expect(categoryFrom("?category=Drone%20%26%20Vehicle", ["Drone & Vehicle"])).toBe("Drone & Vehicle");+ expect(categoryFrom("?category=Nope", ["Orbit"])).toBe("All");+ expect(categoryFrom("", ["Orbit"])).toBe("All");+ });+});++describe("which bar item and tab a page marks", () => {+ it("gives each page one area, and Canvas and Assist none (they have items of their own)", () => {+ const cases: [string, string | undefined][] = [+ ["/create", "create"],+ ["/image", "create"],+ ["/live-edit", "create"],+ ["/canvas", undefined],+ ["/canvas/p1", undefined],+ ["/assist", undefined],+ ["/assist/skills", undefined],+ ["/studios", "studios"],+ ["/extend", "studios"],+ ["/audio/music", "studios"],+ ["/apps", "apps"],+ ["/apps/app-any-angle", "apps"],+ ["/motions", "motions"],+ ["/effects", "motions"],+ ["/motions-and-effects", "motions"],+ ["/", undefined],+ ["/library", undefined],+ ["/settings", undefined],+ ];+ for (const [path, want] of cases) expect(areaOfPath(path), path).toBe(want);+ });++ it("marks the name (aria-current) on the area's own page only", () => {+ expect(areaPageOf("/create")).toBe("create");+ expect(areaPageOf("/studios/")).toBe("studios");+ expect(areaPageOf("/apps")).toBe("apps");+ expect(areaPageOf("/motions-and-effects")).toBe("motions");+ for (const p of ["/image", "/apps/app-relight", "/motions", "/cinema", "/"]) expect(areaPageOf(p), p).toBeUndefined();+ expect(barActive("/create")).toMatchObject({ create: true, studios: false, page: "create" });+ expect(barActive("/image")).toMatchObject({ create: true, page: undefined });+ expect(barActive("/studios")).toMatchObject({ studios: true, create: false, page: "studios" });+ expect(barActive("/motions-and-effects")).toMatchObject({ motions: true, page: "motions" });+ expect(barActive("/canvas")).toMatchObject({ canvas: true, create: false });+ expect(barActive("/assist")).toMatchObject({ assist: true, create: false });+ });++ it("selects the Create and Studios tabs on their own pages, and none on the galleries' page", () => {+ const tab = (p: string) => activePhoneTab(p, null, activeEntry(p, new URLSearchParams()));+ expect(tab("/create")).toBe("create");+ expect(tab("/studios")).toBe("studios");+ expect(tab("/motions-and-effects")).toBeNull();+ });++ it("loads each menu's area page with its rows when the menu opens", () => {+ expect(prefetchHrefs(undefined, "create")).toContain("/create");+ expect(prefetchHrefs(undefined, "studios")).toContain("/studios");+ expect(prefetchHrefs(undefined, "more")).toContain("/motions-and-effects");+ expect(prefetchHrefs(undefined)).toEqual(expect.arrayContaining(["/create", "/studios", "/motions-and-effects"]));+ });++ it("lets search find the area pages", () => {+ for (const a of AREAS) expect(entry(a.entryId)?.href, a.id).toBe(a.href);+ });+});diff --git a/tests/nav-bar.test.ts b/tests/nav-bar.test.tsindex 96dc3377..61fe9a6d 100644--- a/tests/nav-bar.test.ts+++ b/tests/nav-bar.test.ts@@ -236,8 +236,8 @@ describe("the bar's shell", () => {expect(html).toContain('aria-label="Menu"');for (const w of OWNER_WORDS) expect(words(html), w).not.toContain(w.replace("&", "&"));expect(html).not.toContain("data-dot");- // On a studio's page the Studios button is marked.- expect(html).toMatch(/<button[^>]*data-studios-trigger[^>]*data-active="true"/);+ // On a studio's page the Studios item is marked (the pill around its name and its chevron).+ expect(html).toMatch(/<div[^>]*data-bar-split[^>]*data-active="true"[^>]*>\s*<a[^>]*href="\/studios"/);});it("gives an account its avatar, with a dot only when its own GPU answers", () => {@@ -357,6 +357,46 @@ describe("the avatar's dot", () => {});});+describe("split items: the name goes to the area page, the chevron opens the menu", () => {+ /** The opening tag of the link to `href` in the bar's markup. */+ const linkTo = (html: string, href: string) => anchors(html).find((a) => a.href === href)?.tag ?? "";++ it("gives Create, Studios and Motions & effects a link to their page and a named chevron, in one pill", () => {+ const html = render(createElement(TopBar));+ for (const href of ["/create", "/studios", "/motions-and-effects"]) expect(linkTo(html, href), href).not.toBe("");+ expect(linkTo(html, "/studios")).toContain(`aria-label="Studios, ${studioCount()} studios"`);+ for (const name of ["Create menu", "Studios menu", "Motions & effects menu"]) expect(html, name).toContain(`aria-label="${name}"`);+ // The Studios chevron is still the launcher's disclosure button (search hands focus back to it).+ expect(html).toMatch(/<button[^>]*aria-label="Studios menu"[^>]*aria-expanded="false"[^>]*data-studios-trigger/);+ expect(count(html, "data-bar-split")).toBe(3);+ });++ it("marks the name on its own page and the pill inside its area, never both items", () => {+ state.path = "/create";+ let html = render(createElement(TopBar));+ expect(linkTo(html, "/create")).toContain('aria-current="page"');+ expect(linkTo(html, "/studios")).not.toContain("aria-current");+ state.path = "/image";+ html = render(createElement(TopBar));+ expect(linkTo(html, "/create")).not.toContain("aria-current");+ expect(html).toMatch(/<div[^>]*data-bar-split[^>]*data-active="true"[^>]*>\s*<a[^>]*href="\/create"/);+ expect(count(html, 'data-active="true"')).toBe(1);+ state.path = "/canvas";+ html = render(createElement(TopBar));+ expect(html).not.toMatch(/<div[^>]*data-bar-split[^>]*data-active="true"[^>]*>\s*<a[^>]*href="\/create"/);+ });++ it("links the launcher's header to every studio with previews", async () => {+ const { LauncherPanel } = await import("@/components/nav/studios-launcher");+ const html = render(createElement(LauncherPanel, { onClose: () => {}, onSearch: () => {} }));+ expect(linkTo(html, "/studios")).not.toBe("");+ expect(words(html)).toContain("See all");+ expect(linkTo(html, "/studios")).toContain('aria-label="See all studios"');+ // Not a grid cell: the grid's arrow keys skip it.+ expect(linkTo(html, "/studios")).not.toContain("data-col");+ });+});+describe("create and prefetch", () => {it("puts the create tools in two columns of five", () => {const cols = createColumns(undefined);diff --git a/tests/nav-model.test.ts b/tests/nav-model.test.tsindex c46eb370..b3de8237 100644--- a/tests/nav-model.test.ts+++ b/tests/nav-model.test.ts@@ -121,6 +121,13 @@ describe("nav model: entries", () => {expect(fs.existsSync(path.join(root, "src/app/login/page.tsx")), e.id).toBe(true);continue;}+ // An app's own page (/apps/<id>) is the dynamic /apps/[id] route, for an app the catalog has.+ const app = /^\/apps\/(app-[\w-]+)$/.exec(pathOf(e.href));+ if (app) {+ expect(routes.patterns, e.id).toContain("/apps/[id]");+ expect(APPS.some((a) => a.id === app[1]), `${e.id}: ${app[1]}`).toBe(true);+ continue;+ }expect(routes.paths.has(pathOf(e.href)), `${e.id} → ${e.href}`).toBe(true);const hash = e.href.split("#")[1];if (hash) expect(form, `${e.id}: section #${hash}`).toContain(`id="${hash}"`);diff --git a/tests/nav-search.test.ts b/tests/nav-search.test.tsindex 8a309b97..5cc38a73 100644--- a/tests/nav-search.test.ts+++ b/tests/nav-search.test.ts@@ -112,7 +112,7 @@ describe("search by what you want to make", () => {it("still matches every word of a name first: “video tools”, “video”, “upscale video”", () => {expect(labels("video tools")[0]).toBe("Video tools");expect(labels("video")[0]).toBe("Video");- expect(labels("upscale video")[0]).toBe("Video");+ expect(labels("upscale video")[0]).toBe("Upscale video");expect(searchNav("upscale video", OWNER).best[0].hint).toBe("Upscale");expect(labels("settings")[0]).toBe("Settings");expect(labels("library")[0]).toBe("All creations");