Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Menus: badge beside the name, wider panel, steady short-window rows

Adarshabdc83e78920
diff --git a/src/app/nav-subs.css b/src/app/nav-subs.css
index 85f63e95..a098abc2 100644
--- a/src/app/nav-subs.css
+++ b/src/app/nav-subs.css
@@ -76,7 +76,8 @@
--subs-pad: 4px;
flex-direction: row;
flex-wrap: wrap;
- column-gap: 4px;
+ /* 4 + 8 + 4 px: 16 px between two names, so a pair never reads as one name. */
+ column-gap: 8px;
}
.nav-subs[data-subs-line] > li > a {
font-size: 12px;
diff --git a/src/components/nav/create-menu.tsx b/src/components/nav/create-menu.tsx
index 10d6bb16..8ff6db8d 100644
--- a/src/components/nav/create-menu.tsx
+++ b/src/components/nav/create-menu.tsx
@@ -87,7 +87,7 @@ export function CreateList({ variant, onNavigate }: { variant: "menu" | "sheet";
))}
</div>
<div role="separator" className="mx-2.5 my-1.5 h-px bg-border" />
- <IntentLink href={NEW_CREATION_HREF} eager data-col={0} data-row={columns[0]?.entries.length ?? 0} className={cn(CARD_ROW, MENU_ROW_1, "w-1/2 font-medium")}>
+ <IntentLink href={NEW_CREATION_HREF} eager data-col={0} data-row={columns[0]?.entries.length ?? 0} className={cn(CARD_ROW, MENU_ROW_1, "font-medium")}>
<Plus aria-hidden className="size-4 text-brand-text" />
New creation
<Kbd aria-hidden className="ml-auto [@media(hover:none)]:hidden">
diff --git a/src/components/nav/mega-launcher.tsx b/src/components/nav/mega-launcher.tsx
index 68c67dc9..0365d1a2 100644
--- a/src/components/nav/mega-launcher.tsx
+++ b/src/components/nav/mega-launcher.tsx
@@ -71,7 +71,7 @@ export function preloadMegaPanel(): void {
export function MegaSkeleton({ id }: { id?: MegaId }) {
if (id === "canvas") {
return (
- <div aria-hidden data-mega-skeleton className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">
+ <div aria-hidden data-mega-skeleton className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 lg:gap-x-3">
<div className="col-span-3 flex flex-col gap-2 lg:col-span-2">
<span className="h-4 w-24 rounded bg-muted" />
<span className="aspect-[4/3] max-h-[max(64px,calc(100dvh-592px))] w-full rounded-t-[14px] bg-muted" />
@@ -92,7 +92,7 @@ export function MegaSkeleton({ id }: { id?: MegaId }) {
);
}
return (
- <div aria-hidden data-mega-skeleton className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">
+ <div aria-hidden data-mega-skeleton className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 lg:gap-x-3">
{Array.from({ length: 6 }, (_, i) => (
<div key={i} className="flex flex-col gap-2">
<span className="h-4 w-24 rounded bg-muted" />
@@ -180,7 +180,7 @@ export function MegaLauncher({ id, active, className }: { id: MegaId; active?: b
/* The body's place while its chunk loads: the count line's height, then the columns' skeleton. */
<Suspense
fallback={
- <div className="max-w-[1440px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
+ <div className="max-w-[1680px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
<div className="min-h-10 pb-4" />
<MegaSkeleton id={id} />
</div>
diff --git a/src/components/nav/mega-panel.tsx b/src/components/nav/mega-panel.tsx
index b7784ade..abf618f0 100644
--- a/src/components/nav/mega-panel.tsx
+++ b/src/components/nav/mega-panel.tsx
@@ -93,26 +93,21 @@ function Row({ e, col, row, current, inside, now, className }: { e: MegaItem; co
aria-current={current ? "page" : undefined}
data-active={inside ? "" : undefined}
title={e.line ? `${e.label}: ${e.line}` : e.label}
- className={cn("nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1 md:max-lg:min-h-10 md:max-lg:py-0.5", className)}
+ className={cn("nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1 md:max-lg:min-h-10 md:max-lg:py-0.5 [@media(pointer:coarse)]:min-h-11", className)}
>
{/* Six columns leave a row its name and line below 1440 px, and its name alone below 1280 px. Its picture loads
when the row shows (lazy): a row hidden by the window's height never fetches it. */}
<CoverThumb id={e.navCover} cover={e.cover} size="row" icon={e.icon} className="max-[1439.98px]:hidden" />
{/* Centred while it fits; a name on two lines starts at the top and pushes the line out of the 36 px box. */}
- <span data-row-text className="flex max-h-9 min-w-0 flex-1 flex-wrap items-center gap-x-1.5 overflow-hidden [align-content:safe_center] max-xl:flex-nowrap">
+ <span data-row-text className="flex max-h-9 min-w-0 flex-1 flex-wrap items-center gap-x-1 overflow-hidden [align-content:safe_center] max-xl:flex-nowrap">
<span data-row-name className={cn("line-clamp-2 min-w-0 text-[13px] leading-[18px] font-medium", (current || inside) && "font-semibold")}>
{e.label}
</span>
{fresh && <NewBadge />}
{/* After a badge that wrapped, the line fills the rest of the second line; after one beside the name it can't fit
- there and starts its own. A studio whose links become one line on a short window gives that line its room. */}
- <span
- className={cn(
- "min-w-0 flex-1 truncate text-[12px] leading-4 text-muted-foreground max-xl:hidden",
- fresh ? "basis-[calc(100%-48px)]" : "basis-full",
- e.subsLine && "[@media(max-height:799.98px)]:hidden",
- )}
- >
+ there and starts its own. Its basis leaves 48 px: the badge (about 34 px) and the 4 px gap, with room to spare.
+ A wider badge needs a smaller basis, or the line falls to a third line and is hidden. */}
+ <span className={cn("min-w-0 flex-1 truncate text-[12px] leading-4 text-muted-foreground max-xl:hidden", fresh ? "basis-[calc(100%-48px)]" : "basis-full")}>
{e.line}
</span>
</span>
@@ -190,9 +185,10 @@ function Tile({ e, col, row, current, eager }: { e: MegaItem; col: number; row:
data-row={row}
aria-current={current ? "page" : undefined}
title={e.line ? `${e.label}: ${e.line}` : e.label}
- className="nav-row nav-mark-under -m-1.5 flex min-w-0 flex-col gap-1.5 rounded-[12px] p-1.5"
+ className="nav-row nav-mark-under -m-1.5 flex min-w-0 flex-col gap-1.5 rounded-[12px] p-1.5 [container-type:inline-size]"
>
- <CoverThumb cover={e.cover} size="tile16" icon={e.icon} eager={eager} />
+ {/* 16:9, its height rounded down to the 4 px grid, so a second row of tiles sits on a whole pixel. */}
+ <CoverThumb cover={e.cover} size="tile16" icon={e.icon} eager={eager} className="aspect-auto h-[round(down,56.25cqw,4px)]" />
<span className="flex min-w-0 flex-col">
<span className={cn("truncate text-[13px] leading-[18px] font-medium", current && "font-semibold")}>{e.label}</span>
<span className="truncate text-[12px] leading-4 text-muted-foreground">{e.line}</span>
@@ -333,11 +329,11 @@ export function MegaColumns({ model, current, now, kind }: { model: MegaModel; c
};
return (
- <div className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6">
+ <div className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 lg:gap-x-3">
{families
? model.families!.map((f) => (
<Fragment key={f.id}>
- <div className={cn("flex h-10 items-center gap-2 border-b lg:row-start-1", f.span >= 3 ? "col-span-3" : SPAN[f.span])} data-family={f.id}>
+ <div className={cn("flex h-10 items-center gap-2 border-b pb-px lg:row-start-1", f.span >= 3 ? "col-span-3" : SPAN[f.span])} data-family={f.id}>
<p className="text-[12px] leading-4 font-semibold text-foreground">
{f.label} <span className="font-normal text-muted-foreground tabular-nums">· {f.count}</span>
</p>
@@ -377,7 +373,7 @@ export function MegaPanel({ id, onClose, onSearch }: { id: MegaId; onClose: () =
// The query too: moving from one preset to another (/video?preset=…) keeps the path.
const search = useSearchParams()?.toString() ?? "";
return (
- <div className="max-w-[1440px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
+ <div className="max-w-[1680px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
<div className="flex min-h-10 items-center gap-3 pb-4">
<p className="text-[13px] text-muted-foreground" data-count-line>
{model ? model.countLine : failed ? "Couldn't load this menu" : " "}
@@ -388,7 +384,7 @@ export function MegaPanel({ id, onClose, onSearch }: { id: MegaId; onClose: () =
aria-current={pathname === area.href ? "page" : undefined}
aria-label={model?.seeAll.name ?? `See all ${area.label.toLowerCase()}`}
data-see-all
- className="nav-row group/all -ml-1 inline-flex h-8 items-center gap-1 rounded-[8px] px-2 text-[13px] font-medium text-brand-text"
+ className="nav-row group/all -ml-1 inline-flex h-8 items-center gap-1 rounded-[8px] px-2 text-[13px] font-medium text-brand-text [@media(pointer:coarse)]:h-11"
>
See all
<ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />
diff --git a/src/components/nav/search-palette.tsx b/src/components/nav/search-palette.tsx
index b56d1d20..0e41642f 100644
--- a/src/components/nav/search-palette.tsx
+++ b/src/components/nav/search-palette.tsx
@@ -367,7 +367,7 @@ export function PaletteBody({
<CommandPrimitive.Group key={g.kind} heading={g.label} className={cn("mb-4", sectionHeading)}>
<div className="flex flex-col gap-1">
{g.hits.map((h) => (
- <HitRow key={h.key} hit={h} onPick={pickHit} />
+ <HitRow key={h.key} hit={h} onPick={pickHit} bare={g.kind.startsWith("in-")} />
))}
</div>
</CommandPrimitive.Group>
diff --git a/src/components/nav/search-results.tsx b/src/components/nav/search-results.tsx
index 60c74132..3803588a 100644
--- a/src/components/nav/search-results.tsx
+++ b/src/components/nav/search-results.tsx
@@ -180,8 +180,8 @@ export function AlsoTile({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) =>
);
}
-/** Any other match, in its kind's group. */
-export function HitRow({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) => void }) {
+/** Any other match, in its kind's group. `bare`: under its own studio's heading ("In Marketing Studio"), so no crumb. */
+export function HitRow({ hit, onPick, bare }: { hit: NavHit; onPick: (h: NavHit) => void; bare?: boolean }) {
return (
<CommandPrimitive.Item
value={hit.key}
@@ -190,7 +190,7 @@ export function HitRow({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) => vo
className={cn("group/hit flex h-11 cursor-pointer items-center gap-3 rounded-[10px] pr-3 pl-2 text-[14px]", selected)}
>
<HitCover hit={hit} size="row" />
- <Name hit={hit} crumb={hit.kind === "tool" ? hit.hint : undefined} className="min-w-0 flex-1 font-medium" />
+ <Name hit={hit} crumb={!bare && hit.kind === "tool" ? hit.hint : undefined} className="min-w-0 flex-1 font-medium" />
{hit.kind !== "tool" && (hit.what ?? hit.hint) && (
<span className="max-w-[45%] shrink-0 truncate pl-2 text-[12px] text-muted-foreground max-sm:hidden">{hit.what ?? hit.hint}</span>
)}
diff --git a/src/components/nav/studios-sheet.tsx b/src/components/nav/studios-sheet.tsx
index 82c0ba9b..3aeb7e0a 100644
--- a/src/components/nav/studios-sheet.tsx
+++ b/src/components/nav/studios-sheet.tsx
@@ -59,14 +59,14 @@ function SheetSubs({ items, kind, current }: { items: MegaItem[]; kind: ViewerKi
const groups = items.map((e) => ({ e, subs: studioSubs(e.id, kind, "sheet").filter((s) => !tiles.has(s.id)) })).filter((g) => g.subs.length > 0);
if (!groups.length) return null;
return (
- <div data-sheet-subs className="flex flex-col gap-3 border-t pt-3 pb-3">
+ <div data-sheet-subs className="flex flex-col gap-4 border-t pt-3 pb-3">
{groups.map(({ e, subs }) => (
<section key={e.id} aria-labelledby={`sheet-subs-${e.id}`}>
<p id={`sheet-subs-${e.id}`} className="text-[11px] leading-4 font-semibold tracking-[.08em] text-brand-text uppercase">
{e.label}
</p>
{/* 32 px pills whose touch area reaches 6 px past each edge (44 px): rows 12 px apart, so no two overlap. */}
- <ul aria-labelledby={`sheet-subs-${e.id}`} className="mt-2 flex flex-wrap gap-x-1.5 gap-y-3">
+ <ul aria-labelledby={`sheet-subs-${e.id}`} className="mt-2 flex flex-wrap gap-x-2 gap-y-3">
{subs.map((s) => (
<li key={s.id}>
<IntentLink data-sub="" href={s.href} aria-current={current === s.id ? "page" : undefined} title={s.what} className={SUB_PILL}>
diff --git a/tests/e2e/mega-menus.mjs b/tests/e2e/mega-menus.mjs
index f44b040f..47d23b14 100644
--- a/tests/e2e/mega-menus.mjs
+++ b/tests/e2e/mega-menus.mjs
@@ -38,6 +38,7 @@ const SIZES = [
{ width: 1280, height: 720 },
{ width: 1366, height: 768 },
{ width: 1440, height: 900 },
+ { width: 1680, height: 1050 },
{ width: 1920, height: 1080 },
];
const SHOT_WIDTHS = [1280, 1440, 1920];
@@ -194,7 +195,8 @@ try {
// 1c. One spacing system (nav-subs.css, mega-panel.tsx): in every list column, a feature's name starts on its
// studio's text column and the hairline ends at the last feature shown; rows 44 px (40 below lg), 4 px apart, on
// whole pixels; a card 8 px above the next row (4 above its features), a feature list 4 px above it; See all 32 px;
- // Canvas' tiles on their column's edge and top; and no name cut beside a New badge.
+ // Canvas' tiles on their column's edge and top, on whole pixels; no name cut beside a New badge (and from 1440 px
+ // Fuobe Kinetic Motion's badge beside its name); every row's line shown from 1280 px unless a two-line name takes it.
{
const widths = {};
for (const who of ["guest", "owner"]) {
@@ -219,7 +221,7 @@ try {
return rg.getClientRects()[0]?.left ?? NaN;
};
const near = (a, b, tol = 0.75) => Math.abs(a - b) <= tol;
- const out = { text: [], line: [], gaps: [], heights: [], halves: [], cut: [], badge: [], clipped: [], seeAll: [], canvas: [], widths: [] };
+ const out = { text: [], line: [], gaps: [], heights: [], halves: [], cut: [], badge: [], clipped: [], seeAll: [], seeAllHalves: [], canvas: [], tileHalves: [], widths: [], beside: {}, noLine: [] };
for (const group of el.querySelectorAll("[data-group]")) {
const list = group.querySelector(":scope > ul");
const colX = box(group).left;
@@ -252,7 +254,13 @@ try {
if (name.scrollWidth > name.clientWidth + 0.5 || name.scrollHeight > name.clientHeight + 0.5) out.cut.push(a.textContent.trim().slice(0, 30));
const holder = badge.parentElement;
if (box(badge).bottom > box(holder).bottom + 0.5 || box(badge).right > box(holder).right + 0.5) out.badge.push(a.textContent.trim().slice(0, 30));
+ // Beside: the badge's middle on the name's first line.
+ out.beside[name.textContent.trim()] = Math.abs((box(badge).top + box(badge).bottom) / 2 - (box(name).top + 9)) <= 3;
}
+ // A row's line shows inside its words' box, unless its name takes two lines.
+ const rowLine = holderBox && [...holderBox.children].find((c) => c !== name && !c.matches("[data-new]"));
+ if (rowLine && rowLine.textContent.trim() && box(name).height < 20 && (!vis(rowLine) || box(rowLine).bottom > box(holderBox).bottom + 0.5))
+ out.noLine.push(name.textContent.trim().slice(0, 24));
if (vis(subs)) {
const first = [...subs.querySelectorAll(":scope > li > a")].find(vis);
const links = [...subs.querySelectorAll(":scope > li")].filter(vis);
@@ -271,7 +279,11 @@ try {
}
}
}
- for (const s of el.querySelectorAll("a:not([data-sub])")) if (vis(s) && /^See all/.test(s.textContent.trim())) out.seeAll.push(+box(s).height.toFixed(2));
+ for (const s of el.querySelectorAll("a:not([data-sub])"))
+ if (vis(s) && /^See all/.test(s.textContent.trim())) {
+ out.seeAll.push(+box(s).height.toFixed(2));
+ if (Math.abs(box(s).top - Math.round(box(s).top)) > 0.05) out.seeAllHalves.push(`${s.getAttribute("aria-label") ?? "See all"} ${box(s).top.toFixed(2)}`);
+ }
// Canvas: a tile's picture on its column's edge, the first row's tops on the lead column's first item.
const tiles = [...el.querySelectorAll("[data-group] > ul.grid")].filter(vis);
if (tiles.length) {
@@ -280,6 +292,7 @@ try {
const g = ul.closest("[data-group]");
const ib = box(ul.querySelector(":scope > li > a > *"));
out.canvas.push({ dx: +(ib.left - box(g).left).toFixed(2), top: +ib.top.toFixed(2), lead: firstItem ? +box(firstItem).top.toFixed(2) : null });
+ for (const t of ul.querySelectorAll(":scope > li > a")) if (vis(t) && Math.abs(box(t).top - Math.round(box(t).top)) > 0.05) out.tileHalves.push(`${t.textContent.trim().slice(0, 20)} ${box(t).top.toFixed(2)}`);
}
}
return out;
@@ -296,6 +309,10 @@ try {
if (size.width >= 1280) check(r.cut.length === 0 && r.badge.length === 0, `${label} ${id}: no name cut beside a New badge, the badge whole`, [...r.cut, ...r.badge].join(", "));
check(r.clipped.length === 0, `${label} ${id}: every row's name whole, none pushed out of its row`, r.clipped.join(", "));
check(r.seeAll.every((h) => Math.abs(h - 32) <= 0.5), `${label} ${id}: every See all 32 px`, r.seeAll.join(", "));
+ check(r.seeAllHalves.length === 0, `${label} ${id}: every See all on a whole pixel`, r.seeAllHalves.join(", "));
+ if (size.width >= 1440 && "Fuobe Kinetic Motion" in r.beside) check(r.beside["Fuobe Kinetic Motion"], `${label} ${id}: Fuobe Kinetic Motion's New badge beside its name`, JSON.stringify(r.beside));
+ if (size.width >= 1280) check(r.noLine.length === 0, `${label} ${id}: every one-line row shows its line`, r.noLine.join(", "));
+ if (id === "canvas") check(r.tileHalves.length === 0, `${label} canvas: every tile on a whole pixel`, r.tileHalves.join(", "));
if (id === "canvas")
check(r.canvas.every((c) => Math.abs(c.dx) <= 0.75 && c.lead !== null && Math.abs(c.top - c.lead) <= 0.75) || r.canvas.length === 0, `${label} canvas: tiles on their column's edge, level with the first column`, JSON.stringify(r.canvas));
if (id === "studios") (widths[size.width] ??= []).push(...r.widths);
@@ -305,7 +322,7 @@ try {
await ctx.close();
}
}
- // Wider windows never get narrower columns (the panel stops at 1440 px with one gutter).
+ // Wider windows never get narrower columns (the panel stops at 1680 px with one gutter).
const w = (x) => Math.min(...(widths[x] ?? [0]));
check(w(1920) >= w(1440) - 0.5, "Studios: columns at 1920 at least as wide as at 1440", `${w(1440).toFixed(1)} → ${w(1920).toFixed(1)}`);
}