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

ux: give index-page empty states a real next action via EmptyState (#5710)

Adam Eivy8640897ca456
diff --git a/client/src/components/EmptyState.test.jsx b/client/src/components/EmptyState.test.jsx
index b47b3258bc..54acef857f 100644
--- a/client/src/components/EmptyState.test.jsx
+++ b/client/src/components/EmptyState.test.jsx
@@ -34,6 +34,28 @@ describe('EmptyState', () => {
expect(onAction).toHaveBeenCalledTimes(1);
});
+ it('exposes the actionTo call to action as a link with an accessible name', () => {
+ renderWithRouter(
+ <EmptyState title="No boards yet" message="msg" actionTo="/mood-boards/new" actionLabel="Create your first board" />
+ );
+ // Role + name is the contract the converted index pages assert against —
+ // a conversion that drops actionLabel leaves a dead-end empty state.
+ const link = screen.getByRole('link', { name: 'Create your first board' });
+ expect(link.getAttribute('href')).toBe('/mood-boards/new');
+ expect(screen.queryByRole('button')).toBeNull();
+ });
+
+ it('exposes the onAction call to action as a button with an accessible name', () => {
+ const onAction = vi.fn();
+ renderWithRouter(
+ <EmptyState title="No sprites yet" message="msg" actionLabel="Create your first sprite" onAction={onAction} />
+ );
+ const btn = screen.getByRole('button', { name: 'Create your first sprite' });
+ expect(screen.queryByRole('link')).toBeNull();
+ fireEvent.click(btn);
+ expect(onAction).toHaveBeenCalledTimes(1);
+ });
+
it('renders no action element when only a label is given', () => {
const { container } = renderWithRouter(<EmptyState message="msg" actionLabel="Nowhere" />);
expect(container.querySelector('a')).toBeNull();
diff --git a/client/src/components/agents/AgentList.jsx b/client/src/components/agents/AgentList.jsx
index dd0fa546c6..eacd0b236c 100644
--- a/client/src/components/agents/AgentList.jsx
+++ b/client/src/components/agents/AgentList.jsx
@@ -1,9 +1,10 @@
import { useState, useEffect, useCallback } from 'react';
import { Link } from 'react-router';
-import { Sparkles } from 'lucide-react';
+import { Bot, Sparkles } from 'lucide-react';
import toast from '../ui/Toast';
import BrailleSpinner from '../BrailleSpinner';
import { FormField } from '../ui/FormField';
+import EmptyState from '../EmptyState';
import * as api from '../../services/api';
import { PERSONALITY_STYLES, DEFAULT_PERSONALITY, DEFAULT_AVATAR } from './constants';
import { DEFAULT_AVATAR_COLOR } from '../../themes/portosThemes';
@@ -375,10 +376,13 @@ export default function AgentList() {
{/* Agent Cards Grid */}
{agents.length === 0 ? (
- <div className="text-center py-12 text-gray-400">
- <p className="text-lg mb-2">No agents yet</p>
- <p className="text-sm">Create your first AI agent to get started</p>
- </div>
+ <EmptyState
+ icon={Bot}
+ title="No agents yet"
+ message="An agent is a named personality that posts, replies, and runs on a schedule across your connected accounts."
+ actionLabel="Create your first agent"
+ onAction={() => setShowForm(true)}
+ />
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{agents.map(agent => (
diff --git a/client/src/components/sprites/NewSpritePanel.jsx b/client/src/components/sprites/NewSpritePanel.jsx
index 99ad68f373..e81768fb8a 100644
--- a/client/src/components/sprites/NewSpritePanel.jsx
+++ b/client/src/components/sprites/NewSpritePanel.jsx
@@ -4,6 +4,9 @@
* characters carry the reference/walk/publish workflows, which the kind hint
* spells out before the record exists. The created record bubbles up so the page
* can refresh the library and navigate into it.
+ *
+ * Open/closed is controlled by the page so the library's empty state can offer
+ * "create your first sprite" as its call to action.
*/
import { useState } from 'react';
@@ -13,8 +16,7 @@ import { createSpriteRecord } from '../../services/apiSprites.js';
import { useAsyncAction } from '../../hooks/useAsyncAction.js';
import { NEW_SPRITE_KINDS } from '../../lib/spriteRecordGroups.js';
-export default function NewSpritePanel({ onCreated }) {
- const [open, setOpen] = useState(false);
+export default function NewSpritePanel({ onCreated, open, onOpenChange }) {
const [name, setName] = useState('');
const [id, setId] = useState('');
const [kind, setKind] = useState('character');
@@ -25,7 +27,7 @@ export default function NewSpritePanel({ onCreated }) {
kind,
...(id.trim() ? { id: id.trim() } : {}),
}, { silent: true });
- setOpen(false);
+ onOpenChange(false);
setName('');
setId('');
setKind('character');
@@ -35,16 +37,16 @@ export default function NewSpritePanel({ onCreated }) {
return (
<>
<button
- onClick={() => setOpen(true)}
+ onClick={() => onOpenChange(true)}
className="flex items-center gap-2 px-3 py-1.5 bg-port-card border border-port-border hover:border-port-accent text-gray-300 rounded text-sm"
>
<Plus className="w-4 h-4" /> New Sprite
</button>
- <Modal open={open} onClose={() => setOpen(false)} size="sm" ariaLabel="New sprite" closeOnBackdrop={false}>
+ <Modal open={open} onClose={() => onOpenChange(false)} size="sm" ariaLabel="New sprite" closeOnBackdrop={false}>
<div className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
<div className="flex items-center justify-between">
<h3 className="text-sm font-semibold text-white">New sprite</h3>
- <button onClick={() => setOpen(false)} aria-label="Close new sprite panel" className="p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-400 hover:text-white">
+ <button onClick={() => onOpenChange(false)} aria-label="Close new sprite panel" className="p-2 min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-400 hover:text-white">
<X className="w-4 h-4" />
</button>
</div>
diff --git a/client/src/pages/CreativeCommissions.jsx b/client/src/pages/CreativeCommissions.jsx
index 867fcbb51d..bdb185ca07 100644
--- a/client/src/pages/CreativeCommissions.jsx
+++ b/client/src/pages/CreativeCommissions.jsx
@@ -18,6 +18,7 @@ import { useEffect, useMemo, useState, useCallback } from 'react';
import { useNavigate, useLocation } from 'react-router';
import { Plus, Sparkles, Trash2, Clock, Cpu, Pause, Play, Zap } from 'lucide-react';
import PageSkeleton from '../components/ui/PageSkeleton';
+import EmptyState from '../components/EmptyState';
import toast from '../components/ui/Toast';
import Drawer from '../components/Drawer';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
@@ -148,19 +149,13 @@ export default function CreativeCommissions() {
{loading ? (
<PageSkeleton header="none" label="Loading commissions" cards={3} sidebar={false} />
) : sorted.length === 0 ? (
- <div className="border border-dashed border-port-border rounded-lg p-10 text-center">
- <Sparkles className="w-8 h-8 text-gray-600 mx-auto mb-3" />
- <p className="text-gray-400 mb-1">No commissions yet</p>
- <p className="text-gray-600 text-sm mb-4">
- Create a standing brief like “every night at 2am, make me something surreal” and it runs unattended.
- </p>
- <button
- onClick={() => navigate('/creative-commission/new')}
- className="inline-flex items-center gap-2 bg-port-accent hover:bg-blue-600 text-white px-3 py-2 rounded text-sm font-medium"
- >
- <Plus className="w-4 h-4" /> New Commission
- </button>
- </div>
+ <EmptyState
+ icon={Sparkles}
+ title="No commissions yet"
+ message="Create a standing brief like “every night at 2am, make me something surreal” and it runs unattended."
+ actionTo="/creative-commission/new"
+ actionLabel="Create your first commission"
+ />
) : (
<div className="space-y-2">
{sorted.map((c) => (
diff --git a/client/src/pages/CreativeCommissions.test.jsx b/client/src/pages/CreativeCommissions.test.jsx
new file mode 100644
index 0000000000..6137bac60c
--- /dev/null
+++ b/client/src/pages/CreativeCommissions.test.jsx
@@ -0,0 +1,50 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+
+vi.mock('../services/api', async (importOriginal) => ({
+ ...(await importOriginal()),
+ listCommissions: vi.fn(),
+ createCommission: vi.fn(),
+ updateCommission: vi.fn(),
+ deleteCommission: vi.fn(),
+ runCommissionNow: vi.fn(),
+}));
+// The create drawer's config form loads model catalogs on mount — irrelevant to
+// the index's empty state, and it would put real requests behind these renders.
+vi.mock('../components/creative-commission/CommissionConfigForm.jsx', () => ({ default: () => null }));
+vi.mock('../components/ui/Toast', () => ({
+ default: { success: vi.fn(), error: vi.fn(), info: vi.fn(), warning: vi.fn() },
+}));
+
+import CreativeCommissions from './CreativeCommissions';
+import { listCommissions } from '../services/api';
+
+const renderPage = () => render(
+ <MemoryRouter initialEntries={['/creative-commission']}>
+ <CreativeCommissions />
+ </MemoryRouter>
+);
+
+describe('CreativeCommissions index empty state', () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ it('routes the empty state to the create drawer via a named link', async () => {
+ listCommissions.mockResolvedValue([]);
+ renderPage();
+ expect(await screen.findByText('No commissions yet')).toBeInTheDocument();
+ // The only actionTo conversion — assert the Link branch in situ so a
+ // dropped actionTo/actionLabel leaves a detectable dead end.
+ const cta = screen.getByRole('link', { name: 'Create your first commission' });
+ expect(cta.getAttribute('href')).toBe('/creative-commission/new');
+ });
+
+ it('renders the commission list instead of the empty state once one exists', async () => {
+ listCommissions.mockResolvedValue([
+ { id: 'commission-1', name: 'Example Commission', enabled: true, schedule: {}, createdAt: '2026-01-01T00:00:00.000Z' },
+ ]);
+ renderPage();
+ expect(await screen.findByText('Example Commission')).toBeInTheDocument();
+ expect(screen.queryByRole('link', { name: 'Create your first commission' })).toBeNull();
+ });
+});
diff --git a/client/src/pages/Instances.jsx b/client/src/pages/Instances.jsx
index 11c1056acc..6799ee5b28 100644
--- a/client/src/pages/Instances.jsx
+++ b/client/src/pages/Instances.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useCallback, useMemo } from 'react';
+import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
import {
Network, Plus, Trash2, RefreshCw, Edit3, Check, X,
Wifi, WifiOff, CircleDot,
@@ -11,6 +11,7 @@ import {
} from 'lucide-react';
import toast from '../components/ui/Toast';
import Pill from '../components/ui/Pill';
+import EmptyState from '../components/EmptyState';
import socket from '../services/socket';
import {
getInstances, updateSelfInstance, addPeer, updatePeer,
@@ -205,7 +206,7 @@ function SelfCard({ self, onUpdate, syncStatus, tailnetInfo }) {
// Exported for focused tests (the port input's placeholder must advertise the
// same default the form actually submits — see Instances.test.jsx).
-export function AddPeerForm({ onAdd }) {
+export function AddPeerForm({ onAdd, addressRef }) {
const [address, setAddress] = useState('');
const [port, setPort] = useState(String(DEFAULT_PEER_PORT));
const [name, setName] = useState('');
@@ -243,6 +244,7 @@ export function AddPeerForm({ onAdd }) {
</h3>
<div className="flex flex-wrap gap-2">
<input
+ ref={addressRef}
aria-label="Peer address"
value={address}
onChange={e => setAddress(e.target.value)}
@@ -1245,6 +1247,9 @@ function PeerCard({ peer, onRefresh, syncStatus, tailnetInfo, parityReport }) {
}
export default function Instances() {
+ // The Add Peer form is always on screen above the peer grid, so the empty
+ // state's call to action focuses its address field rather than opening one.
+ const peerAddressRef = useRef(null);
const [self, setSelf] = useState(null);
const [peers, setPeers] = useState([]);
const [syncStatus, setSyncStatus] = useState(null);
@@ -1323,7 +1328,7 @@ export default function Instances() {
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<SelfCard self={self} onUpdate={fetchData} syncStatus={syncStatus} tailnetInfo={tailnetInfo} />
- <AddPeerForm onAdd={fetchData} />
+ <AddPeerForm onAdd={fetchData} addressRef={peerAddressRef} />
</div>
{/* Outside the peer-count guard on purpose: removing the last peer must
@@ -1359,11 +1364,13 @@ export default function Instances() {
)}
{peers.length === 0 && (
- <div className="text-center py-12 text-gray-500">
- <Network size={48} className="mx-auto mb-4 opacity-30" />
- <p>No peers registered yet.</p>
- <p className="text-sm mt-1">Add a Tailscale IP address to connect to another PortOS instance.</p>
- </div>
+ <EmptyState
+ icon={Network}
+ title="No peers registered yet"
+ message="Add another PortOS instance by its Tailscale IP address to federate records between your machines."
+ actionLabel="Add your first peer"
+ onAction={() => peerAddressRef.current?.focus()}
+ />
)}
</div>
);
diff --git a/client/src/pages/Loops.jsx b/client/src/pages/Loops.jsx
index 04135c4608..143abecad2 100644
--- a/client/src/pages/Loops.jsx
+++ b/client/src/pages/Loops.jsx
@@ -12,6 +12,7 @@ import { formatDurationMs } from '../utils/formatters';
import BrailleSpinner from '../components/BrailleSpinner';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
import { clickableProps } from '../lib/a11yKeyboard.js';
+import EmptyState from '../components/EmptyState';
const INTERVAL_PRESETS = [
{ label: '30s', value: '30s' },
@@ -40,7 +41,7 @@ function StatusBadge({ loop }) {
);
}
-function CreateLoopForm({ providers, onCreated }) {
+function CreateLoopForm({ providers, onCreated, promptRef }) {
const [prompt, setPrompt] = useState('');
const [interval, setIntervalPreset] = useState('10m');
const [customInterval, setCustomInterval] = useState('');
@@ -84,6 +85,7 @@ function CreateLoopForm({ providers, onCreated }) {
</div>
<textarea
+ ref={promptRef}
aria-label="Loop prompt"
value={prompt}
onChange={e => setPrompt(e.target.value)}
@@ -339,6 +341,9 @@ const ACTION_MAP = {
};
export default function Loops() {
+ // The create form is always on screen above the list, so the empty state's
+ // call to action focuses its prompt field rather than opening anything.
+ const promptRef = useRef(null);
const [loops, setLoops] = useState([]);
const [providers, setProviders] = useState([]);
const [loading, setLoading] = useState(true);
@@ -401,17 +406,20 @@ export default function Loops() {
</div>
</div>
- <CreateLoopForm providers={providers} onCreated={fetchLoops} />
+ <CreateLoopForm providers={providers} onCreated={fetchLoops} promptRef={promptRef} />
{loading ? (
<div className="flex items-center justify-center py-12 text-gray-500">
<Loader2 size={20} className="animate-spin mr-2" /> Loading loops...
</div>
) : loops.length === 0 ? (
- <div className="text-center py-12 text-gray-500">
- <RefreshCw size={32} className="mx-auto mb-2 opacity-30" />
- <p className="text-sm">No loops yet. Create one above to get started.</p>
- </div>
+ <EmptyState
+ icon={RefreshCw}
+ title="No loops yet"
+ message="A loop re-runs one prompt on a schedule with any AI provider. Describe the first one in the form above."
+ actionLabel="Describe your first loop"
+ onAction={() => promptRef.current?.focus()}
+ />
) : (
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4 items-start">
{loops.map(loop => (
diff --git a/client/src/pages/Loops.test.jsx b/client/src/pages/Loops.test.jsx
index 2deacf6202..345cea90fd 100644
--- a/client/src/pages/Loops.test.jsx
+++ b/client/src/pages/Loops.test.jsx
@@ -1,5 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
vi.mock('../services/api', () => ({
getLoops: vi.fn(() => Promise.resolve([])),
@@ -15,9 +16,19 @@ vi.mock('../services/socket', () => ({
default: { on: vi.fn(), off: vi.fn(), emit: vi.fn() },
}));
-vi.mock('../hooks/useAutoRefetch', () => ({
- useAutoRefetch: vi.fn(),
-}));
+// Mirror the real hook's on-mount fetch (the page clears `loading` only from
+// that callback) while dropping the interval, which jsdom has no use for.
+vi.mock('../hooks/useAutoRefetch', async () => {
+ const { useEffect, useRef } = await import('react');
+ return {
+ useAutoRefetch: (fetchFn) => {
+ const fetchRef = useRef(fetchFn);
+ fetchRef.current = fetchFn;
+ useEffect(() => { fetchRef.current(); }, []);
+ return { refetch: () => fetchRef.current() };
+ },
+ };
+});
import Loops from './Loops';
@@ -33,3 +44,13 @@ describe('Loops new-loop form label associations', () => {
expect(label.getAttribute('for')).toBe(input.id);
});
});
+
+describe('Loops index empty state', () => {
+ it('offers a call to action that focuses the new-loop prompt', async () => {
+ render(<Loops />);
+ expect(await screen.findByText('No loops yet')).toBeInTheDocument();
+ const cta = screen.getByRole('button', { name: 'Describe your first loop' });
+ await userEvent.click(cta);
+ expect(screen.getByLabelText('Loop prompt')).toHaveFocus();
+ });
+});
diff --git a/client/src/pages/MediaCollections.jsx b/client/src/pages/MediaCollections.jsx
index de2b0158f6..14a2f7e6d8 100644
--- a/client/src/pages/MediaCollections.jsx
+++ b/client/src/pages/MediaCollections.jsx
@@ -1,7 +1,8 @@
-import { useEffect, useMemo, useState } from 'react';
+import { useEffect, useMemo, useRef, useState } from 'react';
import { Link, useNavigate } from 'react-router';
import { Plus, FolderOpen, Inbox, Trash2, Image as ImageIcon, Film, Search } from 'lucide-react';
import PageSkeleton from '../components/ui/PageSkeleton';
+import EmptyState from '../components/EmptyState';
import toast from '../components/ui/Toast';
import {
listMediaCollections, createMediaCollection, deleteMediaCollection,
@@ -63,6 +64,9 @@ const resolveCover = (collection, imagesByName, videosById) => {
};
export default function MediaCollections() {
+ // Focus target for the empty state's call to action — the create form sits
+ // above the list, so the button has to point back up at it.
+ const nameInputRef = useRef(null);
const navigate = useNavigate();
const [searchParams, updateParams] = useUrlParams();
const [collections, setCollections] = useState([]);
@@ -203,6 +207,7 @@ export default function MediaCollections() {
<div className="space-y-4">
<form onSubmit={handleCreate} className="flex gap-2 items-center">
<input
+ ref={nameInputRef}
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
@@ -271,9 +276,13 @@ export default function MediaCollections() {
isn't on screen. The grid is independent of both — a fresh install
with loose media shows the onboarding copy AND its Unsorted card. */}
{collections.length === 0 && !query ? (
- <div className="text-gray-500 text-sm bg-port-card border border-port-border rounded-lg p-6 text-center">
- No collections yet. Create one above, or use the folder icon on any image/video card to start a new collection.
- </div>
+ <EmptyState
+ icon={FolderOpen}
+ title="No collections yet"
+ message="Group images and videos into a collection — name one above, or use the folder icon on any image/video card."
+ actionLabel="Name your first collection"
+ onAction={() => nameInputRef.current?.focus()}
+ />
) : (
<>
{hiddenEmptyCount > 0 && (
diff --git a/client/src/pages/MediaCollections.test.jsx b/client/src/pages/MediaCollections.test.jsx
index d6a4b49709..297c0c0278 100644
--- a/client/src/pages/MediaCollections.test.jsx
+++ b/client/src/pages/MediaCollections.test.jsx
@@ -248,6 +248,18 @@ describe('MediaCollections', () => {
expect(screen.queryByText(/Every collection here is empty/)).not.toBeInTheDocument();
});
+ it('gives the fresh-install empty state a call to action that focuses the create field', async () => {
+ const { listMediaCollections } = await import('../services/api');
+ listMediaCollections.mockResolvedValueOnce([]);
+ mockUnsortedItems = [];
+ renderPage();
+ const cta = await screen.findByRole('button', { name: 'Name your first collection' });
+ await userEvent.click(cta);
+ // Without the action the empty state is a dead end: the create form is
+ // above the list, so the button has to point back up at it.
+ expect(screen.getByLabelText('New collection name')).toHaveFocus();
+ });
+
it('reports a failed search as a failed search, not as a fresh install', async () => {
const { listMediaCollections } = await import('../services/api');
listMediaCollections.mockResolvedValueOnce([]);
diff --git a/client/src/pages/MoodBoards.jsx b/client/src/pages/MoodBoards.jsx
index 0cb824c408..9083d911d3 100644
--- a/client/src/pages/MoodBoards.jsx
+++ b/client/src/pages/MoodBoards.jsx
@@ -14,6 +14,7 @@ import { Plus, Palette, Trash2, ImageIcon, FileText } from 'lucide-react';
import PageSkeleton from '../components/ui/PageSkeleton';
import toast from '../components/ui/Toast';
import InlineConfirmRow from '../components/ui/InlineConfirmRow';
+import EmptyState from '../components/EmptyState';
import { timeAgo } from '../utils/formatters';
import { listMoodBoards, createMoodBoard, deleteMoodBoard } from '../services/api';
@@ -46,6 +47,10 @@ export default function MoodBoards() {
useEffect(() => { load(); }, [load]);
const handleCreate = async () => {
+ // The header button is disabled while a create is in flight, but the empty
+ // state's call to action has no disabled state — guard here so a double
+ // click can't mint two boards.
+ if (creating) return;
setCreating(true);
const board = await createMoodBoard({ name: 'Untitled board' }, { silent: true }).catch(() => null);
setCreating(false);
@@ -86,9 +91,13 @@ export default function MoodBoards() {
{loading ? (
<PageSkeleton header="none" label="Loading mood boards" cards={3} sidebar={false} />
) : boards.length === 0 ? (
- <div className="text-gray-400 text-sm py-12 text-center border border-dashed border-port-border rounded">
- No mood boards yet. Create one to start pinning references.
- </div>
+ <EmptyState
+ icon={Palette}
+ title="No mood boards yet"
+ message="A board is a canvas of image and text references that feeds the Create suite. Make one to start pinning."
+ actionLabel="Create your first board"
+ onAction={handleCreate}
+ />
) : (
<ul className="space-y-2">
{boards.map((board) => {
diff --git a/client/src/pages/MoodBoards.test.jsx b/client/src/pages/MoodBoards.test.jsx
new file mode 100644
index 0000000000..d837698810
--- /dev/null
+++ b/client/src/pages/MoodBoards.test.jsx
@@ -0,0 +1,43 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { MemoryRouter } from 'react-router';
+
+vi.mock('../services/api', () => ({
+ listMoodBoards: vi.fn(),
+ createMoodBoard: vi.fn(),
+ deleteMoodBoard: vi.fn(),
+}));
+
+import MoodBoards from './MoodBoards';
+import { listMoodBoards, createMoodBoard } from '../services/api';
+
+const renderPage = () => render(<MemoryRouter><MoodBoards /></MemoryRouter>);
+
+describe('MoodBoards index empty state', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ createMoodBoard.mockResolvedValue({ id: 'board-1' });
+ });
+
+ it('offers a call to action with an accessible name when no boards exist', async () => {
+ listMoodBoards.mockResolvedValue([]);
+ renderPage();
+ expect(await screen.findByText('No mood boards yet')).toBeInTheDocument();
+ // Scope to the empty state's own button — the header "New Board" control is
+ // a separate element with its own name, so a conversion that drops
+ // actionLabel would leave a dead-end empty state this assertion catches.
+ const cta = await screen.findByRole('button', { name: 'Create your first board' });
+ await userEvent.click(cta);
+ await waitFor(() => expect(createMoodBoard).toHaveBeenCalled());
+ });
+
+ it('renders the board list instead of the empty state once boards exist', async () => {
+ listMoodBoards.mockResolvedValue([
+ { id: 'board-1', name: 'Example Board', items: [], updatedAt: '2026-01-01T00:00:00.000Z' },
+ ]);
+ renderPage();
+ expect(await screen.findByText('Example Board')).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Create your first board' })).toBeNull();
+ });
+});
diff --git a/client/src/pages/Sprites.jsx b/client/src/pages/Sprites.jsx
index 04c9710db9..4d0a9aebef 100644
--- a/client/src/pages/Sprites.jsx
+++ b/client/src/pages/Sprites.jsx
@@ -2,6 +2,7 @@ import { useEffect, useState, useCallback, useMemo, useRef } from 'react';
import { useParams, useNavigate, useSearchParams } from 'react-router';
import { PersonStanding, LayoutGrid, Images, Scissors, Film } from 'lucide-react';
import PageSkeleton from '../components/ui/PageSkeleton';
+import EmptyState from '../components/EmptyState';
import toast from '../components/ui/Toast';
import {
listSpriteRecords, getSpriteRecord,
@@ -180,6 +181,18 @@ export default function Sprites() {
return params;
});
}, [setSearchParams]);
+ // Same deal for the "New Sprite" modal — library-wide, and now openable from
+ // two places (the header button and the empty-library call to action), so its
+ // open state belongs in the URL rather than inside the panel.
+ const newSpriteOpen = searchParams.get('newSprite') === '1';
+ const setNewSpriteOpen = useCallback((next) => {
+ setSearchParams((prev) => {
+ const params = new URLSearchParams(prev);
+ if (next) params.set('newSprite', '1');
+ else params.delete('newSprite');
+ return params;
+ });
+ }, [setSearchParams]);
// Open the trimmer deep-linked to a run. `replace` keeps an in-trimmer source
// switch out of history; the default push lets Back return to the Library.
const openTrimmer = useCallback((runId, { replace = false } = {}) => {
@@ -464,7 +477,11 @@ export default function Sprites() {
>
<Film className="w-4 h-4" /> Animation types
</button>
- <NewSpritePanel onCreated={(record) => { refresh(); navigate(`/sprites/${record.id}`); }} />
+ <NewSpritePanel
+ open={newSpriteOpen}
+ onOpenChange={setNewSpriteOpen}
+ onCreated={(record) => { refresh(); navigate(`/sprites/${record.id}`); }}
+ />
{/* Re-import while a sprite is open must refresh the open detail too,
not just the library list. */}
<ImportPanel onImported={() => { refresh(); if (id) setRetryTick((t) => t + 1); }} />
@@ -482,9 +499,13 @@ export default function Sprites() {
gridColsClass="grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"
/>
) : records.length === 0 ? (
- <p className="text-sm text-gray-500">
- No sprites yet. Import a production set from a sprite-pipeline checkout to get started.
- </p>
+ <EmptyState
+ icon={PersonStanding}
+ title="No sprites yet"
+ message="Create a character or props sprite here, or import a production set from a sprite-pipeline checkout."
+ actionLabel="Create your first sprite"
+ onAction={() => setNewSpriteOpen(true)}
+ />
) : (
<SpriteCatalog
records={records}
diff --git a/client/src/pages/ThreejsModels.jsx b/client/src/pages/ThreejsModels.jsx
index cd67c12f63..65666d8797 100644
--- a/client/src/pages/ThreejsModels.jsx
+++ b/client/src/pages/ThreejsModels.jsx
@@ -3,6 +3,7 @@ import { Box, ImagePlus, LoaderCircle, Sparkles } from 'lucide-react';
import { Link, useNavigate, useSearchParams } from 'react-router';
import GalleryImagePicker from '../components/imageGen/GalleryImagePicker';
import PageSkeleton from '../components/ui/PageSkeleton';
+import EmptyState from '../components/EmptyState';
import MediaImage from '../components/MediaImage';
import ProviderModelSelector from '../components/ProviderModelSelector';
import useProviderModels from '../hooks/useProviderModels';
@@ -214,9 +215,13 @@ export default function ThreejsModels() {
{loading ? (
<PageSkeleton header="none" label="Loading model workspaces" layout="grid" cards={3} gridColsClass="sm:grid-cols-2 lg:grid-cols-3" />
) : models.length === 0 ? (
- <div className="rounded-xl border border-dashed border-port-border py-10 text-center text-sm text-gray-500">
- No procedural models yet.
- </div>
+ <EmptyState
+ icon={Box}
+ title="No procedural models yet"
+ message="Pick a gallery image, then generate a Three.js workspace from it. Each model gets its own editable scene."
+ actionLabel="Choose a source image"
+ onAction={() => setPickerOpen(true)}
+ />
) : (
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{models.map((model) => (
diff --git a/client/src/pages/ThreejsModels.test.jsx b/client/src/pages/ThreejsModels.test.jsx
index bfff5b9e7b..30ac978344 100644
--- a/client/src/pages/ThreejsModels.test.jsx
+++ b/client/src/pages/ThreejsModels.test.jsx
@@ -104,6 +104,20 @@ describe('ThreejsModels', () => {
));
});
+ it('offers a call to action that opens the image picker when no models exist', async () => {
+ render(
+ <MemoryRouter initialEntries={['/media/threejs']}>
+ <ThreejsModels />
+ </MemoryRouter>
+ );
+ expect(await screen.findByText('No procedural models yet')).toBeInTheDocument();
+ const cta = screen.getByRole('button', { name: 'Choose a source image' });
+ fireEvent.click(cta);
+ // The picker only renders while open, so its appearance proves the action
+ // is wired — a conversion that dropped it would leave a dead-end block.
+ expect(await screen.findByRole('button', { name: 'Pick alternate beacon' })).toBeInTheDocument();
+ });
+
it('hides the family picker rather than showing an empty select when the fetch fails', async () => {
// Creation must still work — it simply gets the general-purpose prompt.
listThreejsModelFamilies.mockRejectedValue(new Error('offline'));