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.

Example cards: each grid tells the browser how wide its cards show

Adarshd1e99b949cd0
diff --git a/src/components/examples/example-cards.tsx b/src/components/examples/example-cards.tsx
index 39741957..1171e6c3 100644
--- a/src/components/examples/example-cards.tsx
+++ b/src/components/examples/example-cards.tsx
@@ -225,6 +225,14 @@ export function ExampleCardView({
);
}
+/** How wide a grid's card shows (its picture's `sizes`), by how many cards it has: as the grid below lays them out. */
+function gridSizes(n: number): string {
+ if (n === 1) return "(min-width: 392px) 360px, calc(100vw - 32px)";
+ if (n === 2) return "(min-width: 640px) 252px, 50vw";
+ if (n === 3) return "(min-width: 640px) 245px, 50vw";
+ return "(min-width: 1032px) 240px, (min-width: 640px) 25vw, 50vw";
+}
+
/** Cards in a grid: two across a phone, four across a desktop (1000 px at most; one or two cards centred, one alone at 360 px). */
export function ExampleGrid({ cards, activeId, onPick, aspect, className }: { cards: ExampleCard[]; activeId?: string; onPick: ExamplePick; aspect?: ExampleAspect; className?: string }) {
return (
@@ -238,7 +246,7 @@ export function ExampleGrid({ cards, activeId, onPick, aspect, className }: { ca
)}
>
{cards.map((c, i) => (
- <ExampleCardView key={c.id} card={c} index={i} active={!!activeId && exampleKey(c) === activeId} onPick={onPick} aspect={aspect} />
+ <ExampleCardView key={c.id} card={c} index={i} active={!!activeId && exampleKey(c) === activeId} onPick={onPick} aspect={aspect} sizes={gridSizes(cards.length)} />
))}
</div>
);
diff --git a/tests/e2e/preset-covers-hd.mjs b/tests/e2e/preset-covers-hd.mjs
index 5cf0c765..86ce0e3e 100644
--- a/tests/e2e/preset-covers-hd.mjs
+++ b/tests/e2e/preset-covers-hd.mjs
@@ -77,6 +77,9 @@ function watch() {
const img = v.parentElement?.querySelector("img");
if (!img?.complete || !img.naturalWidth || !/\/(previews\/presets|examples)\//.test(img.currentSrc)) return;
v.__seen = true;
+ // A card resting on its peak that the viewer asked to play (a hover or focus) starts before the change, by design
+ // (PresetPreview's Clip, `rest.from`, under a 150 ms fade): only a clip that plays by itself is held to its still.
+ if (!v.loop && v.currentTime < 1) return;
try {
const a = grey(v);
const b = grey(img);