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.

Home hydrates without a status mismatch; models table fits phones; shorter how-to line

Claude9240371a173b
diff --git a/src/components/home-view.tsx b/src/components/home-view.tsx
index 2e29af81..e08b6825 100644
--- a/src/components/home-view.tsx
+++ b/src/components/home-view.tsx
@@ -7,7 +7,7 @@ import { lazy, Suspense, useState } from "react";
import { PageShell } from "@/components/page-shell";
import { PresetCard } from "@/components/preset-gallery";
import { Skeleton } from "@/components/ui/skeleton";
-import { useEngine, useGenerations, useStatus } from "@/lib/api";
+import { useEngine, useGenerations, useHydrated, useStatus } from "@/lib/api";
import { EngineSwitch } from "@/components/studio/engine-switch";
import type { PresetCardData } from "@/lib/preset-cards";
import { cn } from "@/lib/utils";
@@ -68,7 +68,11 @@ export function HomeView({ counts, motions, apps, effects }: { counts: Counts; m
const [prompt, setPrompt] = useState("");
const [engine, setEngine, engineMode] = useEngine();
const recent = useGenerations({ limit: 6 });
- const status = useStatus().data;
+ // The page hydrates inside the route's Suspense boundary, possibly after the sidebar already fetched
+ // the status: render the server's (status-less) view until hydrated, as useEngineMode does.
+ const hydrated = useHydrated();
+ const statusData = useStatus().data;
+ const status = hydrated ? statusData : undefined;
const cloudReady = !!(status?.providers.fal?.configured || status?.providers.replicate?.configured || status?.providers.higgsfield?.configured);
const comfyReady = !!status?.providers.comfyui?.configured;
const nothingConnected = status && !(engineMode === "open" ? comfyReady : engineMode === "cloud" ? cloudReady : cloudReady || comfyReady);
diff --git a/src/components/models-table.tsx b/src/components/models-table.tsx
index a4bf1ad7..e67bf297 100644
--- a/src/components/models-table.tsx
+++ b/src/components/models-table.tsx
@@ -24,7 +24,7 @@ function RouteDetails({ row }: { row: ModelRow }) {
<PopoverTrigger asChild>
<button
type="button"
- className="inline-flex h-7 items-center gap-1 rounded-full px-2 text-[12px] text-muted-foreground hover:bg-accent hover:text-foreground"
+ className="inline-flex h-7 items-center gap-1 rounded-full px-2 text-[12px] whitespace-nowrap text-muted-foreground hover:bg-accent hover:text-foreground"
aria-label={`Where ${row.name} runs`}
>
<Info className="size-3.5" />
@@ -71,7 +71,10 @@ const Row = memo(function Row({ m }: { m: ModelRow }) {
<div className="text-[12px] text-muted-foreground">
{m.vendor} — {m.tagline}
</div>
- <div className="mt-1 text-[11px] text-subtle-foreground md:hidden">{m.ops.join(" · ")}</div>
+ <div className="mt-1 text-[11px] text-subtle-foreground md:hidden">
+ <span className="font-mono text-muted-foreground sm:hidden">{m.price} · </span>
+ {m.ops.join(" · ")}
+ </div>
</td>
<td className="hidden px-4 py-3 whitespace-nowrap md:table-cell">
<span className="inline-flex items-center gap-1">
@@ -80,7 +83,7 @@ const Row = memo(function Row({ m }: { m: ModelRow }) {
</span>
</td>
<td className="hidden px-4 py-3 text-[12px] text-muted-foreground md:table-cell">{m.ops.join(" · ")}</td>
- <td className="px-3 py-3 font-mono text-[12px] whitespace-nowrap sm:px-4">{m.price}</td>
+ <td className="hidden px-4 py-3 font-mono text-[12px] whitespace-nowrap sm:table-cell">{m.price}</td>
<td className="px-2 py-2.5 text-right">
<RouteDetails row={m} />
</td>
@@ -141,7 +144,7 @@ export function ModelsTable({ models }: { models: ModelRow[] }) {
<th className="px-3 py-2.5 font-medium sm:px-4">Model</th>
<th className="hidden px-4 py-2.5 font-medium md:table-cell">Engine</th>
<th className="hidden px-4 py-2.5 font-medium md:table-cell">Can do</th>
- <th className="px-3 py-2.5 font-medium sm:px-4">Price</th>
+ <th className="hidden px-4 py-2.5 font-medium sm:table-cell">Price</th>
<th className="px-2 py-2.5">
<span className="sr-only">Details</span>
</th>
diff --git a/src/lib/preset-cards.ts b/src/lib/preset-cards.ts
index cb6936fa..68e4506f 100644
--- a/src/lib/preset-cards.ts
+++ b/src/lib/preset-cards.ts
@@ -425,10 +425,10 @@ export function presetRouteLines(
export function presetHowTo(p: Pick<Preset, "inputs" | "userPrompt" | "type">): string {
const needs = p.inputs.filter((i) => i.required).map((i) => article(lowerFirst(i.label)));
const optional = p.inputs.filter((i) => !i.required).map((i) => article(lowerFirst(i.label)));
- const say = p.userPrompt === "required" ? "describe what you want" : p.userPrompt === "optional" ? "add a few words if you like" : "";
if (!needs.length) {
const first = p.userPrompt === "required" ? "Describe what you want" : optional.length ? `Add ${joinList(optional)} (optional)` : "Press Generate";
return first === "Press Generate" ? "Press Generate — no inputs needed." : `${first}, then Generate.`;
}
- return `Add ${joinList(needs)}${say ? `, ${say}` : ""}, then Generate.`;
+ // An optional prompt goes unsaid: the composer shows its placeholder anyway.
+ return `Add ${joinList(needs)}${p.userPrompt === "required" ? " and describe what you want" : ""}, then Generate.`;
}
diff --git a/tests/preset-cards.test.ts b/tests/preset-cards.test.ts
index f7e3c2e3..bf9b9cc3 100644
--- a/tests/preset-cards.test.ts
+++ b/tests/preset-cards.test.ts
@@ -264,13 +264,19 @@ describe("preset how-to line", () => {
it("names the required inputs", () => {
expect(presetHowTo(byName(APPS, "Face Swap"))).toMatch(/^Add .+ and .+, then Generate\.$/);
expect(presetHowTo({ type: "motion", userPrompt: "optional", inputs: [{ key: "image", label: "Start frame", accept: "image", required: true }] })).toBe(
- "Add a start frame, add a few words if you like, then Generate.",
+ "Add a start frame, then Generate.",
);
expect(presetHowTo({ type: "app", userPrompt: "none", inputs: [{ key: "image", label: "Your photo", accept: "image", required: true }] })).toBe(
"Add your photo, then Generate.",
);
});
+ it("asks for the prompt only when it's required", () => {
+ expect(presetHowTo({ type: "app", userPrompt: "required", inputs: [{ key: "image", label: "Product photo", accept: "image", required: true }] })).toBe(
+ "Add a product photo and describe what you want, then Generate.",
+ );
+ });
+
it("handles presets without inputs", () => {
expect(presetHowTo({ type: "app", userPrompt: "required", inputs: [] })).toBe("Describe what you want, then Generate.");
expect(presetHowTo({ type: "app", userPrompt: "none", inputs: [] })).toBe("Press Generate — no inputs needed.");