Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

explain why the deck's prompt/render buttons are disabled instead of tooltipping it

[._.]/ Adam Eivy06ffd83788dd
diff --git a/client/src/components/decks/DeckCardGrid.jsx b/client/src/components/decks/DeckCardGrid.jsx
index 52e9205b1c..c314542296 100644
--- a/client/src/components/decks/DeckCardGrid.jsx
+++ b/client/src/components/decks/DeckCardGrid.jsx
@@ -1,87 +1,101 @@
import { useMemo } from 'react';
-import { Link2 } from 'lucide-react';
+import { AlertTriangle, Check, Hourglass, Link2, PencilLine, Play } from 'lucide-react';
import EntryThumbSlot from '../universe/EntryThumbSlot';
import Pill from '../ui/Pill';
-import { CARD_STATUS, cardInFlightJobId, cardStatus } from '../../lib/decks';
+import { CARD_STATUS, cardInFlightJobId, cardStatus, deckCompletion } from '../../lib/decks';
-const STATUS_TONE = {
- [CARD_STATUS.EMPTY]: 'context',
- [CARD_STATUS.PROMPTED]: 'muted',
- [CARD_STATUS.QUEUED]: 'accent',
- [CARD_STATUS.RUNNING]: 'accent',
- [CARD_STATUS.RENDERED]: 'success',
- [CARD_STATUS.FAILED]: 'error',
-};
-const STATUS_LABEL = {
- [CARD_STATUS.EMPTY]: 'needs prompt',
- [CARD_STATUS.PROMPTED]: 'ready',
+// One badge per card state, named for what the user can DO next rather than for
+// the internal status word: "ready" alone did not answer "does this card have a
+// prompt yet?", which is the question the grid exists to answer at a glance.
+const STATUS_META = {
+ [CARD_STATUS.EMPTY]: { tone: 'warning', icon: PencilLine, label: 'Needs prompt' },
+ [CARD_STATUS.PROMPTED]: { tone: 'accent', icon: Play, label: 'Ready to render' },
// The queue never stamps 'running' on the card; the slot's live thumb shows
- // progress, so both in-flight states read as one word.
- [CARD_STATUS.QUEUED]: 'rendering',
- [CARD_STATUS.RUNNING]: 'rendering',
- [CARD_STATUS.RENDERED]: 'rendered',
- [CARD_STATUS.FAILED]: 'failed',
+ // progress, so both in-flight states read the same.
+ [CARD_STATUS.QUEUED]: { tone: 'muted', icon: Hourglass, label: 'Rendering…' },
+ [CARD_STATUS.RUNNING]: { tone: 'muted', icon: Hourglass, label: 'Rendering…' },
+ [CARD_STATUS.RENDERED]: { tone: 'success', icon: Check, label: 'Rendered' },
+ [CARD_STATUS.FAILED]: { tone: 'error', icon: AlertTriangle, label: 'Failed' },
};
/**
* The deck laid out by group (suit / arcana / jokers / back), one three-state
* thumbnail slot per card: pending render → live progress, rendered → the
- * primary image, empty → a one-click render affordance. Status and in-flight
- * job derive from the card's persisted `render` record, so a slot settling
- * locally and a reload after the server filed the render read the same way.
- * Clicking a card's name opens its drawer; the slot's image opens the lightbox.
+ * primary image, empty → a one-click render (or, with no prompt written yet, a
+ * shortcut into the card editor). Status and in-flight job derive from the
+ * card's persisted `render` record, so a slot settling locally and a reload
+ * after the server filed the render read the same way. Clicking a card's name
+ * opens its drawer; the slot's image opens the lightbox.
+ *
+ * Every card wears a labelled badge for its state and every group header spells
+ * its counts out in words, so "which cards still need a prompt, and which are
+ * ready to render" is answerable without opening a single card.
*/
export default function DeckCardGrid({ deck, onOpenCard, onRenderCard, onPreview, onRenderComplete, onRenderTerminal }) {
const groups = useMemo(() => {
const byGroup = Map.groupBy(deck.cards, (card) => card.group);
- return [...byGroup].map(([key, cards]) => ({ key, label: cards[0].groupLabel || key, cards }));
+ return [...byGroup].map(([key, cards]) => {
+ const counts = deckCompletion(cards);
+ return { key, label: cards[0].groupLabel || key, cards, counts, needPrompt: counts.total - counts.prompted };
+ });
}, [deck.cards]);
return (
<div className="space-y-6">
{groups.map((group) => (
- <section key={group.key} aria-label={group.label}>
- <h2 className="text-sm font-medium text-white mb-2 flex items-center gap-2">
- {group.label}
- <span className="text-xs text-gray-500">{group.cards.filter((c) => c.imageRefs?.length).length}/{group.cards.length}</span>
- </h2>
- <ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-6">
- {group.cards.map((card) => {
- const inFlight = cardInFlightJobId(card);
- const status = cardStatus(card);
- return (
- <li key={card.id} className="flex flex-col items-center gap-1.5 rounded-lg border border-port-border bg-port-card p-2">
- <EntryThumbSlot
- size="xl"
- inFlightJobId={inFlight}
- imageRefs={card.imageRefs}
- primaryImageRef={card.primaryImageRef}
- onRender={() => onRenderCard(card)}
- onPreview={() => onPreview(card)}
- onComplete={(filename) => onRenderComplete(card.id, filename)}
- onTerminalStatus={(s) => onRenderTerminal(card.id, s)}
- canRender={!!card.prompt && !inFlight}
- alt={card.name}
- />
- <button
- type="button"
- onClick={() => onOpenCard(card)}
- className="w-full min-h-[44px] text-center text-xs text-gray-200 hover:text-white leading-tight"
- title="Edit this card"
- >
- <span className="block truncate font-medium">{card.name}</span>
- {card.canonRef?.name ? (
- <span className="mt-0.5 inline-flex max-w-full items-center gap-1 text-[11px] text-gray-400">
- <Link2 size={10} aria-hidden="true" /><span className="truncate">{card.canonRef.name}</span>
- </span>
- ) : null}
- </button>
- <Pill tone={STATUS_TONE[status]} size="xs">{STATUS_LABEL[status]}</Pill>
- </li>
- );
- })}
- </ul>
- </section>
+ <section key={group.key} aria-label={group.label}>
+ <h2 className="text-sm font-medium text-white mb-2 flex items-center gap-2 flex-wrap">
+ {group.label}
+ <span className="text-xs font-normal text-gray-400">
+ {group.counts.rendered}/{group.counts.total} rendered
+ </span>
+ {group.needPrompt ? (
+ <Pill tone="warning" size="xs" icon={PencilLine}>{group.needPrompt} need a prompt</Pill>
+ ) : null}
+ </h2>
+ <ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-6">
+ {group.cards.map((card) => {
+ const inFlight = cardInFlightJobId(card);
+ const status = cardStatus(card);
+ const meta = STATUS_META[status];
+ const needsPrompt = !card.prompt;
+ return (
+ <li key={card.id} className="flex h-full flex-col items-center gap-1.5 rounded-lg border border-port-border bg-port-card p-2">
+ <EntryThumbSlot
+ size="xl"
+ inFlightJobId={inFlight}
+ imageRefs={card.imageRefs}
+ primaryImageRef={card.primaryImageRef}
+ // A card with no prompt has nothing to render, so its
+ // empty slot opens the editor rather than sitting there
+ // greyed out — the one thing that unblocks it.
+ onRender={() => (needsPrompt ? onOpenCard(card) : onRenderCard(card))}
+ onPreview={() => onPreview(card)}
+ onComplete={(filename) => onRenderComplete(card.id, filename)}
+ onTerminalStatus={(s) => onRenderTerminal(card.id, s)}
+ emptyIcon={needsPrompt ? PencilLine : undefined}
+ emptyHint={needsPrompt ? `Write a prompt for ${card.name}` : `Render ${card.name}`}
+ alt={card.name}
+ />
+ <button
+ type="button"
+ onClick={() => onOpenCard(card)}
+ className="w-full min-h-[44px] text-center text-xs text-gray-200 hover:text-white leading-tight"
+ title="Edit this card"
+ >
+ <span className="block truncate font-medium">{card.name}</span>
+ {card.canonRef?.name ? (
+ <span className="mt-0.5 inline-flex max-w-full items-center gap-1 text-[11px] text-gray-400">
+ <Link2 size={10} aria-hidden="true" /><span className="truncate">{card.canonRef.name}</span>
+ </span>
+ ) : null}
+ </button>
+ <Pill tone={meta.tone} size="xs" icon={meta.icon} className="mt-auto">{meta.label}</Pill>
+ </li>
+ );
+ })}
+ </ul>
+ </section>
))}
</div>
);
diff --git a/client/src/components/decks/DeckCardGrid.test.jsx b/client/src/components/decks/DeckCardGrid.test.jsx
index 44fb4567e9..7819a0337e 100644
--- a/client/src/components/decks/DeckCardGrid.test.jsx
+++ b/client/src/components/decks/DeckCardGrid.test.jsx
@@ -33,32 +33,39 @@ const renderGrid = (over = {}) => {
};
describe('DeckCardGrid', () => {
- it('groups cards by suit/arcana with a rendered count per group', () => {
+ it('spells out each group\'s rendered count and how many still need a prompt', () => {
renderGrid();
const major = screen.getByRole('region', { name: 'Major Arcana' });
- expect(within(major).getByText('1/2')).toBeInTheDocument();
- expect(within(screen.getByRole('region', { name: 'Cups' })).getByText('0/3')).toBeInTheDocument();
+ expect(within(major).getByText('1/2 rendered')).toBeInTheDocument();
+ expect(within(major).queryByText(/need a prompt/)).toBeNull();
+ const cups = screen.getByRole('region', { name: 'Cups' });
+ expect(within(cups).getByText('0/3 rendered')).toBeInTheDocument();
+ expect(within(cups).getByText('1 need a prompt')).toBeInTheDocument();
});
- it('offers a render only for prompted, idle cards and routes the click to that card', () => {
+ it('renders a prompted card from its slot and sends a promptless one to its editor', () => {
const props = renderGrid();
- // EntryThumbSlot names the empty slot by its state: a renderable card reads
- // "Render image…", a blocked one carries the slot's disabled copy. Card a
- // (prompted) and d (failed, retryable) are enabled; e has no prompt.
- const enabled = screen.getAllByRole('button', { name: /render image for this item/i });
- expect(enabled).toHaveLength(2);
- expect(screen.getByRole('button', { name: /save the universe first/i })).toBeDisabled();
- fireEvent.click(enabled[0]);
+ // Card a (prompted) and d (failed, retryable) render; e has no prompt, so
+ // its slot is an opening into the editor rather than a dead grey button.
+ const renderable = screen.getAllByRole('button', { name: /^Render Card [ad]$/ });
+ expect(renderable).toHaveLength(2);
+ fireEvent.click(renderable[0]);
expect(props.onRenderCard).toHaveBeenCalledWith(expect.objectContaining({ id: 'a' }));
+
+ const write = screen.getByRole('button', { name: 'Write a prompt for Card e' });
+ expect(write).toBeEnabled();
+ fireEvent.click(write);
+ expect(props.onOpenCard).toHaveBeenCalledWith(expect.objectContaining({ id: 'e' }));
+ expect(props.onRenderCard).toHaveBeenCalledTimes(1);
});
it('derives every badge from the card record: in-flight, rendered, failed, ready, needs prompt', () => {
renderGrid();
- expect(screen.getByText('rendering')).toBeInTheDocument();
- expect(screen.getByText('rendered')).toBeInTheDocument();
- expect(screen.getByText('failed')).toBeInTheDocument();
- expect(screen.getByText('ready')).toBeInTheDocument();
- expect(screen.getByText('needs prompt')).toBeInTheDocument();
+ expect(screen.getByText('Rendering…')).toBeInTheDocument();
+ expect(screen.getByText('Rendered')).toBeInTheDocument();
+ expect(screen.getByText('Failed')).toBeInTheDocument();
+ expect(screen.getByText('Ready to render')).toBeInTheDocument();
+ expect(screen.getByText('Needs prompt')).toBeInTheDocument();
});
it('opens the drawer from the card name and shows the cast canon entry', () => {
diff --git a/client/src/components/decks/DeckLlmPinPicker.jsx b/client/src/components/decks/DeckLlmPinPicker.jsx
index da17602317..9e5e98dc37 100644
--- a/client/src/components/decks/DeckLlmPinPicker.jsx
+++ b/client/src/components/decks/DeckLlmPinPicker.jsx
@@ -8,6 +8,11 @@ import useProviderModels from '../../hooks/useProviderModels';
* picker whenever it changes (a refetched deck, another surface's edit), and
* every user change is lifted as `{ providerId, model, effort }` — an empty
* provider means "the active provider", matching the server's fallback.
+ *
+ * Deliberately NOT `compact`: compact mode hides the field labels, which left
+ * the deck page showing three unexplained dropdowns ("Claude Code CLI",
+ * "claude-sonnet-5", "Default effort") stacked under the labelled image-backend
+ * row with nothing saying they were the prompt writer's settings.
*/
export default function DeckLlmPinPicker({ pin, onChange, label = 'Prompt model', disabled = false }) {
const {
@@ -45,7 +50,6 @@ export default function DeckLlmPinPicker({ pin, onChange, label = 'Prompt model'
emptyProviderOption="Active provider"
emptyModelOption="Default model"
alwaysShowModel
- compact
label={label}
loading={loading}
disabled={disabled}
diff --git a/client/src/components/decks/DeckRenderControls.jsx b/client/src/components/decks/DeckRenderControls.jsx
index 7723193dd1..d436e90d6f 100644
--- a/client/src/components/decks/DeckRenderControls.jsx
+++ b/client/src/components/decks/DeckRenderControls.jsx
@@ -1,23 +1,38 @@
-import { Loader2, Play, Sparkles, WandSparkles } from 'lucide-react';
+import { useId } from 'react';
+import { Loader2, Play, RefreshCw, Sparkles, WandSparkles } from 'lucide-react';
import RecordRenderPinRow from '../imageGen/RecordRenderPinRow';
import DeckLlmPinPicker from './DeckLlmPinPicker';
import useImageRenderSettings from '../../hooks/useImageRenderSettings';
import { RENDER_TARGET, modeLabel } from '../../lib/imageGenBackends';
+import { pluralize } from '../../lib/textUtils';
+
+const PRIMARY_BTN = 'inline-flex min-h-[38px] items-center gap-1.5 rounded bg-port-accent px-3 py-2 text-sm text-white hover:bg-port-accent/90 disabled:opacity-40 disabled:cursor-not-allowed';
+const SECONDARY_BTN = 'inline-flex min-h-[38px] items-center gap-1.5 rounded border border-port-border px-3 py-2 text-sm text-gray-200 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed';
/**
- * The action bar above the card grid: which image backend this deck renders
- * on (its own pin over the Settings "Deck card renders" default), the LLM pin
- * for casting + prompt writing, and the three batch buttons — generate
- * prompts for empty cards, render every card still missing an image, render
- * the whole deck again.
+ * The action bar above the card grid: which image backend this deck renders on
+ * (its own pin over the Settings "Deck card renders" default), the LLM pin for
+ * casting + prompt writing, and the batch actions — split into the two ordered
+ * steps a deck actually goes through, write prompts then render them.
+ *
+ * Each step carries a plain-language note that says what its buttons will do,
+ * or why they are greyed out — a disabled "Generate prompts" is the normal
+ * resting state of a fully-prompted deck, which is exactly the state that
+ * looked broken. The accent button is whichever step is the next one to take,
+ * so the deck always points at its own next action.
*/
export default function DeckRenderControls({
deck, completion, onPatch, onGeneratePrompts, onRenderMissing, onRenderAll, generating = false, rendering = false,
}) {
const { imageCfg, backends } = useImageRenderSettings({ record: deck, target: RENDER_TARGET.DECK });
- const missing = Math.max(0, (completion?.total || 0) - (completion?.rendered || 0) - (completion?.inFlight || 0));
- const unprompted = Math.max(0, (completion?.total || 0) - (completion?.prompted || 0));
+ const total = completion?.total || 0;
+ const prompted = completion?.prompted || 0;
+ const rendered = completion?.rendered || 0;
+ const inFlight = completion?.inFlight || 0;
+ const missing = Math.max(0, total - rendered - inFlight);
+ const unprompted = Math.max(0, total - prompted);
const busy = generating || rendering;
+ const promptsAreTheNextStep = unprompted > 0;
return (
<div className="bg-port-card border border-port-border rounded-md p-3 space-y-3">
@@ -47,48 +62,98 @@ export default function DeckRenderControls({
disabled={busy}
/>
</div>
- <div className="flex items-center gap-2 flex-wrap">
- <button
- type="button"
- onClick={() => onGeneratePrompts({ overwrite: false })}
- disabled={busy || unprompted === 0}
- title={unprompted === 0 ? 'Every card already has a prompt' : `Write prompts for ${unprompted} card(s) without one`}
- className="inline-flex min-h-[38px] items-center gap-1.5 rounded bg-port-accent px-3 py-2 text-sm text-white disabled:opacity-50"
- >
- {generating ? <Loader2 size={14} className="animate-spin" aria-hidden="true" /> : <WandSparkles size={14} aria-hidden="true" />}
- {generating ? 'Writing prompts…' : `Generate prompts${unprompted ? ` (${unprompted})` : ''}`}
- </button>
- <button
- type="button"
- onClick={() => onGeneratePrompts({ overwrite: true })}
- disabled={busy}
- title="Rewrite every card's prompt (keeps the universe casting)"
- className="min-h-[38px] rounded border border-port-border px-3 py-2 text-sm text-gray-200 hover:bg-white/5 disabled:opacity-50"
- >
- Rewrite all prompts
- </button>
- <span className="hidden sm:block h-6 w-px bg-port-border" aria-hidden="true" />
- <button
- type="button"
- onClick={onRenderMissing}
- disabled={busy || missing === 0 || !completion?.prompted}
- title={missing === 0 ? 'Every card is rendered' : `Render the ${missing} card(s) without an image`}
- className="inline-flex min-h-[38px] items-center gap-1.5 rounded border border-port-accent/40 px-3 py-2 text-sm text-port-accent hover:bg-port-accent/10 disabled:opacity-50"
- >
- {rendering ? <Loader2 size={14} className="animate-spin" aria-hidden="true" /> : <Play size={14} aria-hidden="true" />}
- Render missing{missing ? ` (${missing})` : ''}
- </button>
- <button
- type="button"
- onClick={onRenderAll}
- disabled={busy || !completion?.prompted}
- title="Queue a fresh render for every card with a prompt"
- className="inline-flex min-h-[38px] items-center gap-1.5 rounded border border-port-border px-3 py-2 text-sm text-gray-200 hover:bg-white/5 disabled:opacity-50"
- >
- <Sparkles size={14} aria-hidden="true" />
- Render whole deck
- </button>
+
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <Step step="1" title="Prompts" note={promptNote({ generating, unprompted, total })}>
+ {(noteId) => (<>
+ <button
+ type="button"
+ onClick={() => onGeneratePrompts({ overwrite: false })}
+ disabled={busy || unprompted === 0}
+ aria-describedby={noteId}
+ className={promptsAreTheNextStep ? PRIMARY_BTN : SECONDARY_BTN}
+ >
+ {generating ? <Loader2 size={14} className="animate-spin" aria-hidden="true" /> : <WandSparkles size={14} aria-hidden="true" />}
+ {generating ? 'Writing prompts…' : `Generate prompts${unprompted ? ` (${unprompted})` : ''}`}
+ </button>
+ <button
+ type="button"
+ onClick={() => onGeneratePrompts({ overwrite: true })}
+ disabled={busy || total === 0}
+ aria-describedby={noteId}
+ title="Replaces every card's prompt (the universe casting is kept)"
+ className={SECONDARY_BTN}
+ >
+ <RefreshCw size={14} aria-hidden="true" />
+ Rewrite all{total ? ` (${total})` : ''}
+ </button>
+ </>)}
+ </Step>
+
+ <Step step="2" title="Render" note={renderNote({ prompted, rendering, missing, inFlight })}>
+ {(noteId) => (<>
+ <button
+ type="button"
+ onClick={onRenderMissing}
+ disabled={busy || missing === 0 || !prompted}
+ aria-describedby={noteId}
+ className={promptsAreTheNextStep ? SECONDARY_BTN : PRIMARY_BTN}
+ >
+ {rendering ? <Loader2 size={14} className="animate-spin" aria-hidden="true" /> : <Play size={14} aria-hidden="true" />}
+ Render missing{missing ? ` (${missing})` : ''}
+ </button>
+ <button
+ type="button"
+ onClick={onRenderAll}
+ disabled={busy || !prompted}
+ aria-describedby={noteId}
+ title="Queues a fresh render for every card that has a prompt"
+ className={SECONDARY_BTN}
+ >
+ <Sparkles size={14} aria-hidden="true" />
+ Render all{prompted ? ` (${prompted})` : ''}
+ </button>
+ </>)}
+ </Step>
</div>
</div>
);
}
+
+// What step 1's buttons will do, or why they can't.
+const promptNote = ({ generating, unprompted, total }) => {
+ if (generating) return 'Writing prompts…';
+ if (unprompted) return `${unprompted} of ${pluralize(total, 'card')} still need a prompt.`;
+ return `All ${pluralize(total, 'card')} have a prompt — rewrite to replace them.`;
+};
+
+// The same for step 2. The two counts compose into one sentence rather than
+// each owning a phrasing, so "some missing, some in flight" reads like the two
+// states it is instead of a third variant.
+const renderNote = ({ prompted, rendering, missing, inFlight }) => {
+ if (!prompted) return 'A card renders from its prompt. Write prompts first.';
+ if (rendering) return 'Queueing renders…';
+ const parts = [];
+ if (missing) parts.push(`${pluralize(missing, 'prompted card')} not rendered yet`);
+ if (inFlight) parts.push(`${pluralize(inFlight, 'card')} rendering now`);
+ return parts.length ? `${parts.join(' · ')}.` : 'Every card is rendered — re-render to replace them.';
+};
+
+// One numbered step: heading, its buttons, then the note explaining what they
+// will do or why they can't. `children` is a function of the note's id because
+// `aria-describedby` does not inherit from a wrapper, so each button has to
+// carry it. The note is real page text rather than a `title`: a disabled button
+// is neither focusable nor hoverable on touch, so a tooltip on it reaches
+// nobody.
+function Step({ step, title, note, children }) {
+ const noteId = useId();
+ return (
+ <section className="rounded border border-port-border/60 bg-port-bg/30 p-2.5 space-y-2" aria-label={`Step ${step}: ${title}`}>
+ <h3 className="text-[11px] font-medium uppercase tracking-wide text-gray-500">
+ <span className="text-port-accent">{step}</span> · {title}
+ </h3>
+ <div className="flex items-center gap-2 flex-wrap">{children(noteId)}</div>
+ <p id={noteId} className="text-[11px] leading-snug text-gray-400">{note}</p>
+ </section>
+ );
+}
diff --git a/client/src/components/decks/DeckRenderControls.test.jsx b/client/src/components/decks/DeckRenderControls.test.jsx
new file mode 100644
index 0000000000..5bce930fba
--- /dev/null
+++ b/client/src/components/decks/DeckRenderControls.test.jsx
@@ -0,0 +1,64 @@
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import DeckRenderControls from './DeckRenderControls';
+
+// The backend row and the LLM pin both fetch provider/settings state; this
+// suite is about the batch actions and the notes that explain them.
+vi.mock('../../hooks/useImageRenderSettings', () => ({
+ default: () => ({ imageCfg: { mode: 'local', modelId: 'qwen-image' }, backends: [{ id: 'local', label: 'Local' }] }),
+}));
+vi.mock('./DeckLlmPinPicker', () => ({ default: () => <div /> }));
+
+const deck = { id: 'd1', imageMode: null, imageModelId: null, promptLlm: null, cardSize: { width: 1024, height: 1536 } };
+const completion = (over) => ({ total: 79, prompted: 0, rendered: 0, inFlight: 0, failed: 0, percent: 0, ...over });
+
+const renderControls = (over = {}) => {
+ const props = {
+ deck,
+ completion: completion(),
+ onPatch: vi.fn(),
+ onGeneratePrompts: vi.fn(),
+ onRenderMissing: vi.fn(),
+ onRenderAll: vi.fn(),
+ ...over,
+ };
+ return { ...props, ...render(<DeckRenderControls {...props} />) };
+};
+
+const btn = (name) => screen.getByRole('button', { name });
+
+describe('DeckRenderControls', () => {
+ it('says in the page why generating prompts is unavailable on a fully prompted deck', () => {
+ renderControls({ completion: completion({ prompted: 79, inFlight: 1 }) });
+ expect(btn(/^Generate prompts$/)).toBeDisabled();
+ // The reason is rendered text, not a title — a disabled button has no
+ // hover on touch and no focus anywhere.
+ expect(screen.getByText('All 79 cards have a prompt — rewrite to replace them.')).toBeInTheDocument();
+ expect(btn(/^Rewrite all \(79\)$/)).toBeEnabled();
+ });
+
+ it('says why rendering is unavailable before any prompt exists', () => {
+ renderControls();
+ expect(btn(/^Render missing \(79\)$/)).toBeDisabled();
+ expect(btn(/^Render all$/)).toBeDisabled();
+ expect(screen.getByText('A card renders from its prompt. Write prompts first.')).toBeInTheDocument();
+ expect(screen.getByText('79 of 79 cards still need a prompt.')).toBeInTheDocument();
+ });
+
+ it('counts in-flight cards out of the render-missing total and names them', () => {
+ renderControls({ completion: completion({ prompted: 79, rendered: 0, inFlight: 1 }) });
+ expect(btn(/^Render missing \(78\)$/)).toBeEnabled();
+ expect(screen.getByText('78 prompted cards not rendered yet · 1 card rendering now.')).toBeInTheDocument();
+ });
+
+ it('moves the accent button from step 1 to step 2 as the deck becomes fully prompted', () => {
+ const { unmount } = renderControls({ completion: completion({ prompted: 10 }) });
+ expect(btn(/^Generate prompts \(69\)$/).className).toContain('bg-port-accent');
+ expect(btn(/^Render missing \(79\)$/).className).not.toContain('bg-port-accent');
+ unmount();
+
+ renderControls({ completion: completion({ prompted: 79 }) });
+ expect(btn(/^Generate prompts$/).className).not.toContain('bg-port-accent');
+ expect(btn(/^Render missing \(79\)$/).className).toContain('bg-port-accent');
+ });
+});
diff --git a/client/src/components/imageGen/RecordRenderPinRow.jsx b/client/src/components/imageGen/RecordRenderPinRow.jsx
index 3a059407d5..53eb391f80 100644
--- a/client/src/components/imageGen/RecordRenderPinRow.jsx
+++ b/client/src/components/imageGen/RecordRenderPinRow.jsx
@@ -39,7 +39,7 @@ export default function RecordRenderPinRow({
id={`${idPrefix}-mode`}
value={pinnedMode}
onChange={(e) => onChange({ imageMode: e.target.value || null, imageModelId: null })}
- className="w-full max-w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent sm:w-44"
+ className="w-full max-w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent sm:w-auto sm:min-w-[11rem]"
>
{showAuto ? <option value="">{autoLabel}</option> : (!pinnedMode && <option value="" disabled>Pick a backend</option>)}
{optionList.map((o) => <option key={o.id} value={o.id}>{o.label || o.id}</option>)}
@@ -53,7 +53,7 @@ export default function RecordRenderPinRow({
onBlur={modelDraft.onBlur}
placeholder="Model (optional)"
aria-label={`${label} model`}
- className="w-full max-w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent sm:w-52"
+ className="w-full max-w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent sm:w-auto sm:min-w-[11rem]"
/>
) : <span className="hidden sm:block" />}
</div>
diff --git a/client/src/components/pipeline/CanonCard.jsx b/client/src/components/pipeline/CanonCard.jsx
index dc684315da..f0475c7bcc 100644
--- a/client/src/components/pipeline/CanonCard.jsx
+++ b/client/src/components/pipeline/CanonCard.jsx
@@ -468,6 +468,7 @@ export default function CanonCard({
onPreview={onPreview ? (visibleFilename) => onPreview(visibleFilename || thumbnailRef) : null}
onRender={onRender}
canRender={canRender}
+ disabledHint="Give this entry a description to enable rendering"
/>
);
diff --git a/client/src/components/universe/EntryThumbSlot.jsx b/client/src/components/universe/EntryThumbSlot.jsx
index 6f7aeadcf2..a622ace2e9 100644
--- a/client/src/components/universe/EntryThumbSlot.jsx
+++ b/client/src/components/universe/EntryThumbSlot.jsx
@@ -10,14 +10,16 @@
* `EntryCardThumbnail` behavior, extracted here to keep both paths in
* lock-step).
* 3. Empty — no jobId, no images → 48x48 placeholder box with a centered
- * Sparkles button that fires `onRender()`. Keeps row heights consistent
- * across freshly-extracted entries (no images yet) and rendered ones,
- * and surfaces a one-click render affordance without scrolling to the
- * row's action column.
+ * `emptyIcon` button (Sparkles by default) that fires `onRender()`. Keeps
+ * row heights consistent across freshly-extracted entries (no images yet)
+ * and rendered ones, and surfaces a one-click render affordance without
+ * scrolling to the row's action column.
*
- * The fixed footprint avoids row-height jitter between empty / pending /
- * rendered states. Disabled when `canRender` is false (no backend selected,
- * save pending, etc.) so the button shape is still visible but inert.
+ * All three states are laid out in the same `THUMB_DIMENSIONS` box, so a row
+ * never jitters as a render starts and finishes. Disabled when `canRender` is
+ * false (no backend selected, save pending, etc.) so the button shape is still
+ * visible but inert — `disabledHint` is what says why, and every host has a
+ * different reason, so it has no useful default beyond a neutral one.
*/
import { useCallback, useState, useEffect } from 'react';
import { Sparkles, Star } from 'lucide-react';
@@ -52,6 +54,16 @@ export default function EntryThumbSlot({
// arity note above; fires after it, so the clear happens first either way.
onTerminalStatus = null,
canRender = true,
+ // The empty slot's affordance. Glyph and label travel together because a host
+ // whose empty state is not "render this" needs to change both: a deck card
+ // with no prompt yet points at its editor instead.
+ emptyIcon: EmptyIcon = Sparkles,
+ emptyHint = 'Render image for this item',
+ // Why the affordance is inert, in the host's own words — shown on hover and
+ // announced as the button's name. There is no shared right answer (an empty
+ // description, an unsaved world, a locked story, no configured backend), so a
+ // host that can disable the slot should always pass this.
+ disabledHint = 'Render unavailable',
alt = 'Render',
// `'lg'` renders the empty-state box at 64x96 with a bigger Sparkles
// affordance (reserved for slots that ride a wider card). `'xl'` is the
@@ -75,14 +87,15 @@ export default function EntryThumbSlot({
[onComplete, onTerminalStatus],
);
if (inFlightJobId) {
- // `xs` (48x80) matches the empty + completed states below so all three
- // states share a footprint and the row doesn't jump mid-render. `'lg'`
- // upgrades the pending box to `sm` (64x64); `'xl'` uses `lg` (128x128).
- // `MediaJobThumb` doesn't have portrait variants past `xs`, so the
- // larger pending states are square — one-time jitter when the render
- // finishes and the portrait completed-thumb takes over.
+ // `xs` (48x80) matches the empty + completed states below. `'lg'` upgrades
+ // the pending box to `sm` (64x64); `'xl'` uses `lg` (128x128).
+ // `MediaJobThumb` has no portrait variant past `xs`, so the larger pending
+ // states are square — centered inside the slot's own portrait box, or every
+ // host would have to reserve the height itself to stop the row jumping when
+ // a render starts and again when it finishes.
const pendingSize = size === 'xl' ? 'lg' : size === 'lg' ? 'sm' : 'xs';
return (
+ <div className={`${THUMB_DIMENSIONS[size] || THUMB_DIMENSIONS.sm} shrink-0 flex items-center justify-center`}>
<MediaJobThumb
jobId={inFlightJobId}
label={alt}
@@ -97,6 +110,7 @@ export default function EntryThumbSlot({
// returns to an actionable state and the entity can be re-rendered.
onStatus={onStatus}
/>
+ </div>
);
}
const refs = Array.isArray(imageRefs) ? imageRefs : [];
@@ -122,15 +136,16 @@ export default function EntryThumbSlot({
// completed image, eliminating row jitter across the three states.
const dim = THUMB_DIMENSIONS[size] || THUMB_DIMENSIONS.sm;
const iconSize = size === 'xl' ? 32 : size === 'lg' ? 18 : 14;
+ const hint = canRender ? emptyHint : disabledHint;
return (
<button
type="button"
onClick={() => onRender?.()}
disabled={!onRender || !canRender}
- title={canRender ? 'Render image for this item' : 'Save the universe first to enable render'} aria-label={canRender ? 'Render image for this item' : 'Save the universe first to enable render'}
+ title={hint} aria-label={hint}
className={`${dim} shrink-0 flex items-center justify-center rounded border border-dashed border-port-border bg-port-bg/40 text-gray-500 hover:border-port-accent/50 hover:text-port-accent hover:bg-port-accent/5 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:border-port-border disabled:hover:text-gray-500 disabled:hover:bg-port-bg/40 transition-colors`}
>
- <Sparkles size={iconSize} />
+ <EmptyIcon size={iconSize} />
</button>
);
}
diff --git a/client/src/components/universe/StyleProbeImage.jsx b/client/src/components/universe/StyleProbeImage.jsx
index be5882df6f..1594d20ac1 100644
--- a/client/src/components/universe/StyleProbeImage.jsx
+++ b/client/src/components/universe/StyleProbeImage.jsx
@@ -154,6 +154,7 @@ export default function StyleProbeImage({ universe, onUniverseChange, canRender
onComplete={handleComplete}
onPreview={onPreview}
canRender={canProbe && Boolean(universe?.id) && styleReady}
+ disabledHint="Save the world and add embrace influences to enable"
alt="Base style"
size="xl"
/>
diff --git a/client/src/components/universeBuilder/CompositeSheetsEditor.jsx b/client/src/components/universeBuilder/CompositeSheetsEditor.jsx
index 827ac27958..ace163d36c 100644
--- a/client/src/components/universeBuilder/CompositeSheetsEditor.jsx
+++ b/client/src/components/universeBuilder/CompositeSheetsEditor.jsx
@@ -276,6 +276,7 @@ function SheetRow({
imageRefs={renders}
alt={`${sheet.label} render`}
canRender={canRender}
+ disabledHint="Save the world and configure a render backend to enable"
onRender={onRender}
onPreview={onPreview}
onComplete={handleSettled}
diff --git a/client/src/components/universeBuilder/UniverseCategoryEditor.jsx b/client/src/components/universeBuilder/UniverseCategoryEditor.jsx
index c6589f0451..eaf0e2fdf7 100644
--- a/client/src/components/universeBuilder/UniverseCategoryEditor.jsx
+++ b/client/src/components/universeBuilder/UniverseCategoryEditor.jsx
@@ -479,6 +479,7 @@ function VariationCard({
imageRefs={renders}
alt={`${v.label} render`}
canRender={!!onRenderVariation && canRender}
+ disabledHint="Save the world and configure a render backend to enable"
onRender={onRenderVariation ? () => onRenderVariation(v) : null}
onPreview={onPreviewVariation || null}
/>
diff --git a/client/src/pages/DeckDetail.jsx b/client/src/pages/DeckDetail.jsx
index eee09bddf9..2762d5fb03 100644
--- a/client/src/pages/DeckDetail.jsx
+++ b/client/src/pages/DeckDetail.jsx
@@ -228,7 +228,9 @@ function DeckEditor({ id }) {
{universe ? (
<Link to={`/universes/${universe.id}`} className="inline-flex items-center gap-1 hover:text-white"><Globe className="w-3 h-3" aria-hidden="true" />{universe.name}</Link>
) : null}
- <span>{completion.rendered}/{completion.total} rendered · {completion.prompted} prompted{completion.inFlight ? ` · ${completion.inFlight} rendering` : ''}{completion.failed ? ` · ${completion.failed} failed` : ''}</span>
+ {/* Both counters read as fractions of the deck: a bare "79 prompted"
+ beside "0/79 rendered" looks like a different denominator. */}
+ <span>{completion.rendered}/{completion.total} rendered · {completion.prompted}/{completion.total} prompted{completion.inFlight ? ` · ${completion.inFlight} rendering` : ''}{completion.failed ? ` · ${completion.failed} failed` : ''}</span>
</div>
<div className="max-w-md">
<ProgressBar percent={completion.percent} label="Deck render progress" tone={completion.percent === 100 ? 'success' : 'accent'} />
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index 728907fe1e..06836ab032 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -890,6 +890,7 @@ function StepCharacters({ session, universe, locked, onChanged, onUniverseCharRe
onRender={() => renderChar(c)}
onComplete={(fn) => onCharComplete(fn, c.id)}
canRender={!locked && Boolean(universe?.id)}
+ disabledHint={locked ? 'This story is locked' : 'Pick a universe to enable rendering'}
alt={c.name}
/>
<div className="flex-1 min-w-0">