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: reserve layout dimensions on 20 primary pages with PageSkeleton (#2843)

[._.]/ Adam Eivy1fae0435caca
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 92512b37b2..b0a7f99054 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -39,6 +39,7 @@
- **[issue-2833] Decompose the ~1000-line `spawnTuiAgent()`** — extract the output buffering/spooling pipeline into `agentTuiSpawning/outputSpooler.js` and the failure-analysis + worktree-inspection helpers into `agentTuiSpawning/finalizeHelpers.js`, leaving `spawnTuiAgent` as a thinner orchestrator. No behavior change to spawn/timeout/completion semantics; adds unit coverage for both extracted modules.
- Route client `localStorage` access through the `safeStorage` helpers (Layout, MorseTrainer, calendar persisted-state, MoodBoard reference strip, VoiceWidget, WorkEditor, Tribe) — several sites previously threw uncaught in Safari private mode instead of degrading gracefully.
- Replace inline `new Promise(r => setTimeout(r, …))` delays with the shared `sleep(ms)` helper across nine server modules.
+- **[issue-2843] Dimension-reserving loading skeletons on 20 primary pages** — Dashboard, Apps, Brain, Calendar, Messages, Wiki, Goals, Review, Character, Digital Twin, Data Manager, Capabilities, Feature Agents (index + detail), Uploads, System Health, Submodules, Action History, AI Runs History, and AI Usage now render `PageSkeleton` instead of a centered spinner, so the first paint reserves the header/tab/card dimensions the loaded page occupies and content no longer pops in above the fold. `PageSkeleton` grew `header` (`inline`/`bar`/`none`), `layout` (`stack`/`grid`), `tabs`, `showSubtitle`, `padded`, and `fullHeight` to cover both padded and full-width route shells; padding is now opt-in, which also fixes the double padding the DataDog/Jira/GitHub skeletons had inside Layout's already-padded main.
## Removed
diff --git a/client/src/components/ui/PageSkeleton.jsx b/client/src/components/ui/PageSkeleton.jsx
index 79650b1c03..66e9af57d2 100644
--- a/client/src/components/ui/PageSkeleton.jsx
+++ b/client/src/components/ui/PageSkeleton.jsx
@@ -1,33 +1,58 @@
-// Lightweight full-page loading skeleton for the DevTools integration pages
-// (DataDog / Jira / GitHub). Reserves the header + `[1fr_360px]` card-grid
-// dimensions those pages render once loaded so the first paint doesn't reflow.
-// Mirrors the WidgetSkeleton pattern (port design tokens + animate-pulse) and
-// renders inside Layout's scrolling main — no full-height wrapper.
+// Shared full-page loading skeleton. Reserves the dimensions a page renders
+// once loaded so the first paint doesn't reflow (issue #2843 — most pages used
+// to show a centered BrailleSpinner with no reserved layout, so content popped
+// in above the fold on every navigation).
+//
+// Three axes cover every primary page shape in PortOS:
+//
+// header 'inline' — the page renders its own `<h2>` + action row inside the
+// padded scrolling main (Apps, DataDog, Jira, GitHub, …).
+// 'bar' — the page renders the shared `PageHeader` bar: icon +
+// title (+ subtitle) with a `border-b` (Brain, Calendar,
+// Messages, Wiki, …). Matches PageHeader's compact
+// `px-3 py-2 sm:px-4 sm:py-3` padding.
+// 'none' — the page already rendered its own header and only the
+// body region is loading (Goals).
+// layout 'stack' — vertically stacked cards, optional right sidebar.
+// 'grid' — responsive card grid (dashboard widgets, tiles).
+// tabs n > 0 — reserves a `TabPills` (underline variant) strip under
+// the header, matching its `min-h-[44px] sm:min-h-[40px]`.
+//
+// Container flags:
+// padded — add page padding. Leave FALSE on routes that render inside
+// Layout's default `overflow-auto p-4 md:p-6` main (padding
+// twice is itself a layout pop); pass TRUE on `isFullWidth`
+// routes, whose main is a bare `relative overflow-hidden`.
+// fullHeight — fill the height and own the scroll, for `isFullWidth` routes.
export default function PageSkeleton({
+ header = 'inline',
titleWidthClass = 'w-48',
+ showSubtitle = false,
showAction = true,
+ tabs = 0,
cards = 3,
sidebar = true,
+ layout = 'stack',
+ gridColsClass = 'sm:grid-cols-2 xl:grid-cols-3',
+ padded = false,
+ fullHeight = false,
}) {
- return (
- <div className="p-4 sm:p-6" role="status" aria-busy="true" aria-label="Loading">
- <div className="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4 mb-6">
- <div className={`h-8 rounded bg-port-card animate-pulse ${titleWidthClass}`} />
- {showAction && <div className="h-10 w-full sm:w-48 rounded bg-port-card animate-pulse" />}
- </div>
+ const cardBlocks = Array.from({ length: Math.max(0, cards) }).map((_, i) => (
+ <div
+ key={i}
+ className="rounded-lg border border-port-border bg-port-card p-4 sm:p-6 animate-pulse"
+ >
+ <div className="h-5 w-2/3 rounded bg-port-border mb-3" />
+ <div className="h-4 w-1/2 rounded bg-port-border mb-2" />
+ <div className="h-4 w-1/3 rounded bg-port-border" />
+ </div>
+ ));
+
+ const body = layout === 'grid'
+ ? <div className={`grid grid-cols-1 gap-4 items-start ${gridColsClass}`}>{cardBlocks}</div>
+ : (
<div className={`grid grid-cols-1 gap-6 items-start ${sidebar ? 'lg:grid-cols-[1fr_360px]' : ''}`}>
- <div className="space-y-4">
- {Array.from({ length: cards }).map((_, i) => (
- <div
- key={i}
- className="rounded-lg border border-port-border bg-port-card p-4 sm:p-6 animate-pulse"
- >
- <div className="h-5 w-2/3 rounded bg-port-border mb-3" />
- <div className="h-4 w-1/2 rounded bg-port-border mb-2" />
- <div className="h-4 w-1/3 rounded bg-port-border" />
- </div>
- ))}
- </div>
+ <div className="space-y-4">{cardBlocks}</div>
{sidebar && (
<div className="rounded-lg border border-port-border bg-port-card p-4 sm:p-6 animate-pulse">
<div className="h-5 w-1/3 rounded bg-port-border mb-4" />
@@ -39,6 +64,68 @@ export default function PageSkeleton({
</div>
)}
</div>
+ );
+
+ const tabStrip = tabs > 0 ? (
+ <div className="shrink-0 flex gap-1 border-b border-port-border overflow-hidden">
+ {Array.from({ length: tabs }).map((_, i) => (
+ <div key={i} className="h-[44px] sm:h-[40px] w-20 sm:w-24 flex items-center px-2">
+ <div className="h-4 w-full rounded bg-port-card animate-pulse" />
+ </div>
+ ))}
+ </div>
+ ) : null;
+
+ // `bar` pages are the flex-column shells: the header bar and tab strip are
+ // full-bleed, only the body region takes padding and owns the scroll.
+ if (header === 'bar') {
+ return (
+ <div
+ className={`flex flex-col min-h-0 ${fullHeight ? 'h-full' : ''}`}
+ role="status"
+ aria-busy="true"
+ aria-label="Loading"
+ >
+ <div className="shrink-0 px-3 py-2 sm:px-4 sm:py-3 border-b border-port-border">
+ <div className="flex items-center gap-2 sm:gap-3">
+ <div className="w-6 h-6 sm:w-7 sm:h-7 shrink-0 rounded bg-port-card animate-pulse" />
+ <div className="min-w-0 flex-1">
+ <div className={`h-6 sm:h-7 rounded bg-port-card animate-pulse ${titleWidthClass}`} />
+ {showSubtitle && (
+ <div className="hidden sm:block h-4 w-64 max-w-full rounded bg-port-card animate-pulse mt-1" />
+ )}
+ </div>
+ {showAction && <div className="h-6 w-24 rounded bg-port-card animate-pulse" />}
+ </div>
+ </div>
+ {tabStrip}
+ <div className={`flex-1 min-h-0 ${fullHeight ? 'overflow-y-auto' : ''} ${padded ? 'p-3 sm:p-4' : ''}`}>
+ {body}
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <div
+ className={`${padded ? 'p-4 md:p-6' : ''} ${fullHeight ? 'h-full overflow-y-auto' : ''}`}
+ role="status"
+ aria-busy="true"
+ aria-label="Loading"
+ >
+ {header !== 'none' && (
+ <div className="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4 mb-6">
+ <div className="min-w-0">
+ <div className={`h-8 rounded bg-port-card animate-pulse ${titleWidthClass}`} />
+ {showSubtitle && (
+ <div className="h-4 w-56 max-w-full rounded bg-port-card animate-pulse mt-2" />
+ )}
+ </div>
+ {showAction && <div className="h-10 w-full sm:w-48 rounded bg-port-card animate-pulse" />}
+ </div>
+ )}
+ {tabStrip && <div className="mb-4">{tabStrip}</div>}
+ {body}
</div>
);
}
diff --git a/client/src/components/ui/PageSkeleton.test.jsx b/client/src/components/ui/PageSkeleton.test.jsx
new file mode 100644
index 0000000000..1dea942023
--- /dev/null
+++ b/client/src/components/ui/PageSkeleton.test.jsx
@@ -0,0 +1,91 @@
+import { describe, it, expect } from 'vitest';
+import { render, screen } from '@testing-library/react';
+
+import PageSkeleton from './PageSkeleton';
+
+// The skeleton's whole job is to reserve dimensions, so the assertions are on
+// structure + the layout classes that establish those dimensions.
+const status = () => screen.getByRole('status');
+const cardCount = (container) =>
+ container.querySelectorAll('.rounded-lg.border.border-port-border.bg-port-card').length;
+
+describe('PageSkeleton', () => {
+ it('announces itself as a busy status region', () => {
+ render(<PageSkeleton />);
+ expect(status()).toHaveAttribute('aria-busy', 'true');
+ expect(status()).toHaveAttribute('aria-label', 'Loading');
+ });
+
+ it('defaults to an unpadded inline header so it does not double-pad Layout main', () => {
+ render(<PageSkeleton />);
+ expect(status().className).not.toContain('p-4');
+ });
+
+ it('adds page padding only when padded is set', () => {
+ render(<PageSkeleton padded />);
+ expect(status().className).toContain('p-4');
+ expect(status().className).toContain('md:p-6');
+ });
+
+ it('owns its scroll when fullHeight is set', () => {
+ render(<PageSkeleton fullHeight />);
+ expect(status().className).toContain('h-full');
+ expect(status().className).toContain('overflow-y-auto');
+ });
+
+ it('renders the requested number of cards plus the sidebar block', () => {
+ const { container } = render(<PageSkeleton cards={2} />);
+ // 2 body cards + 1 sidebar card.
+ expect(cardCount(container)).toBe(3);
+ });
+
+ it('drops the sidebar and its grid track when sidebar is false', () => {
+ const { container } = render(<PageSkeleton cards={2} sidebar={false} />);
+ expect(cardCount(container)).toBe(2);
+ expect(container.innerHTML).not.toContain('lg:grid-cols-[1fr_360px]');
+ });
+
+ it('lays cards out in a responsive grid (no sidebar) for layout="grid"', () => {
+ const { container } = render(
+ <PageSkeleton layout="grid" cards={4} gridColsClass="grid-cols-2 sm:grid-cols-4" />
+ );
+ expect(cardCount(container)).toBe(4);
+ expect(container.innerHTML).toContain('grid-cols-2 sm:grid-cols-4');
+ expect(container.innerHTML).not.toContain('lg:grid-cols-[1fr_360px]');
+ });
+
+ it('omits the header entirely for header="none" (page already rendered its own)', () => {
+ const { container } = render(<PageSkeleton header="none" cards={1} sidebar={false} />);
+ // Only the single card block remains — no title/action placeholders.
+ expect(container.querySelectorAll('.animate-pulse')).toHaveLength(1);
+ });
+
+ it('reserves a bordered PageHeader bar for header="bar"', () => {
+ const { container } = render(<PageSkeleton header="bar" showSubtitle />);
+ // PageHeader's own compact padding, mirrored so the bar height matches.
+ expect(container.innerHTML).toContain('px-3 py-2 sm:px-4 sm:py-3');
+ expect(container.innerHTML).toContain('border-b border-port-border');
+ });
+
+ it('reserves one strip row per tab, matching TabPills touch-target height', () => {
+ const { container } = render(<PageSkeleton header="bar" tabs={5} />);
+ const tabRows = container.querySelectorAll('.h-\\[44px\\]');
+ expect(tabRows).toHaveLength(5);
+ });
+
+ it('renders no tab strip when tabs is 0', () => {
+ const { container } = render(<PageSkeleton tabs={0} />);
+ expect(container.querySelectorAll('.h-\\[44px\\]')).toHaveLength(0);
+ });
+
+ it('hides the action placeholder when showAction is false', () => {
+ const { container } = render(<PageSkeleton showAction={false} cards={0} sidebar={false} />);
+ // Title only — no action block.
+ expect(container.querySelectorAll('.animate-pulse')).toHaveLength(1);
+ });
+
+ it('treats a negative card count as zero rather than throwing', () => {
+ const { container } = render(<PageSkeleton cards={-3} sidebar={false} />);
+ expect(cardCount(container)).toBe(0);
+ });
+});
diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsx
index d3e1124dce..e881b9e71b 100644
--- a/client/src/pages/Apps.jsx
+++ b/client/src/pages/Apps.jsx
@@ -5,6 +5,7 @@ import toast from '../components/ui/Toast';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
import AppIcon from '../components/AppIcon';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import KanbanBoard from '../components/KanbanBoard';
import StatusBadge from '../components/StatusBadge';
import ActivityLog from '../components/apps/ActivityLog';
@@ -136,11 +137,7 @@ export default function Apps() {
.slice().sort((a, b) => a.name.localeCompare(b.name));
if (loading) {
- return (
- <div className="flex items-center justify-center h-64">
- <BrailleSpinner text="Loading apps" />
- </div>
- );
+ return <PageSkeleton titleWidthClass="w-24" showSubtitle cards={4} sidebar={false} />;
}
return (
diff --git a/client/src/pages/Brain.jsx b/client/src/pages/Brain.jsx
index 0214c8c9ca..10b460f7c7 100644
--- a/client/src/pages/Brain.jsx
+++ b/client/src/pages/Brain.jsx
@@ -3,6 +3,7 @@ import { useParams, useNavigate } from 'react-router-dom';
import * as api from '../services/api';
import {Brain as BrainIcon} from 'lucide-react';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import PageHeader from '../components/PageHeader';
import TabPills from '../components/ui/TabPills';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
@@ -86,9 +87,16 @@ export default function Brain() {
if (loading) {
return (
- <div className="flex items-center justify-center h-full">
- <BrailleSpinner text="Loading" />
- </div>
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-28"
+ showSubtitle
+ tabs={TABS.length}
+ cards={3}
+ sidebar={false}
+ />
);
}
diff --git a/client/src/pages/Calendar.jsx b/client/src/pages/Calendar.jsx
index b6e09a5667..a3e8668bdb 100644
--- a/client/src/pages/Calendar.jsx
+++ b/client/src/pages/Calendar.jsx
@@ -2,7 +2,7 @@ import { useNavigate } from 'react-router-dom';
import { CalendarDays, Calendar as CalendarIcon, ClipboardList, Clock, Columns, LayoutGrid, RefreshCw, Settings } from 'lucide-react';
import { useState, useEffect, useCallback } from 'react';
import * as api from '../services/api';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import PageHeader from '../components/PageHeader';
import TabPills from '../components/ui/TabPills';
import { useValidTab } from '../hooks/useValidTab';
@@ -74,9 +74,16 @@ export default function Calendar() {
if (loading) {
return (
- <div className="flex items-center justify-center h-full">
- <BrailleSpinner text="Loading" />
- </div>
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-32"
+ showSubtitle
+ tabs={TABS.length}
+ cards={3}
+ sidebar={false}
+ />
);
}
diff --git a/client/src/pages/CapabilityMap.jsx b/client/src/pages/CapabilityMap.jsx
index d10c02de69..0dee15f592 100644
--- a/client/src/pages/CapabilityMap.jsx
+++ b/client/src/pages/CapabilityMap.jsx
@@ -3,7 +3,7 @@ import {
CheckCircle, AlertTriangle, XCircle, Circle, ChevronRight, LayoutGrid,
} from 'lucide-react';
import * as api from '../services/api';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
// Status presentation. Mirrors the server's CAPABILITY_STATUS tiers.
@@ -51,11 +51,7 @@ export default function CapabilityMap() {
);
if (loading) {
- return (
- <div className="flex items-center justify-center h-64">
- <BrailleSpinner text="Loading capabilities" />
- </div>
- );
+ return <PageSkeleton titleWidthClass="w-40" showSubtitle cards={5} sidebar={false} />;
}
if (!data) {
diff --git a/client/src/pages/CharacterSheet.jsx b/client/src/pages/CharacterSheet.jsx
index 7f096e8530..054eca5807 100644
--- a/client/src/pages/CharacterSheet.jsx
+++ b/client/src/pages/CharacterSheet.jsx
@@ -6,6 +6,7 @@ import {
} from 'lucide-react';
import { birthDateCta } from '../utils/characterXp';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import GoalsCard from '../components/character/GoalsCard';
import toast from '../components/ui/Toast';
import { timeAgo, formatCompactCount } from '../utils/formatters';
@@ -384,9 +385,14 @@ export default function CharacterSheet() {
if (loading) {
return (
- <div className="h-full flex items-center justify-center text-gray-400">
- <BrailleSpinner text="Loading" />
- </div>
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-32"
+ cards={4}
+ sidebar={false}
+ />
);
}
diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsx
index 8a9ce33bfb..0f03cd98ae 100644
--- a/client/src/pages/Dashboard.jsx
+++ b/client/src/pages/Dashboard.jsx
@@ -1,6 +1,7 @@
import { useState, useEffect, useCallback, useMemo, useRef, Suspense } from 'react';
import { Link } from 'react-router-dom';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import LayoutPicker from '../components/dashboard/LayoutPicker';
import LayoutEditor from '../components/dashboard/LayoutEditor';
import WidgetSuggestions from '../components/dashboard/WidgetSuggestions';
@@ -325,9 +326,11 @@ export default function Dashboard() {
if (loading) {
return (
- <div className="flex flex-col items-center justify-center h-64 gap-3">
- <SchematicLabel module="DASH" status="BOOTING" glyph="orbit" state="active" />
- <BrailleSpinner text="Loading dashboard" />
+ <div>
+ <div className="mb-3">
+ <SchematicLabel module="DASH" status="BOOTING" glyph="orbit" state="active" />
+ </div>
+ <PageSkeleton titleWidthClass="w-40" layout="grid" cards={6} />
</div>
);
}
diff --git a/client/src/pages/DataManager.jsx b/client/src/pages/DataManager.jsx
index a7a7ab0ba9..ad7d576288 100644
--- a/client/src/pages/DataManager.jsx
+++ b/client/src/pages/DataManager.jsx
@@ -3,6 +3,7 @@ import { HardDrive, RefreshCw, Archive, Trash2, ChevronDown, ChevronRight, Folde
import * as api from '../services/api';
import { formatBytes } from '../utils/formatters';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import toast from '../components/ui/Toast';
import socket from '../services/socket';
import { useAsyncAction } from '../hooks/useAsyncAction';
@@ -350,9 +351,16 @@ export default function DataManager() {
if (loading) {
return (
- <div className="flex items-center justify-center h-full">
- <BrailleSpinner text="Loading" />
- </div>
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-40"
+ showSubtitle
+ layout="grid"
+ gridColsClass="grid-cols-2 sm:grid-cols-4"
+ cards={4}
+ />
);
}
diff --git a/client/src/pages/DigitalTwin.jsx b/client/src/pages/DigitalTwin.jsx
index 3c0bf52863..de35f5f7b6 100644
--- a/client/src/pages/DigitalTwin.jsx
+++ b/client/src/pages/DigitalTwin.jsx
@@ -3,6 +3,7 @@ import { useParams, useNavigate } from 'react-router-dom';
import * as api from '../services/api';
import { Heart } from 'lucide-react';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import TabPills from '../components/ui/TabPills';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
import { sameJsonShape } from '../lib/sameJsonShape';
@@ -104,8 +105,17 @@ export default function DigitalTwin() {
if (loading) {
return (
- <div className="absolute inset-0 flex items-center justify-center">
- <BrailleSpinner text="Loading" />
+ <div className="absolute inset-0">
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-40"
+ showSubtitle
+ tabs={TABS.length}
+ cards={3}
+ sidebar={false}
+ />
</div>
);
}
diff --git a/client/src/pages/FeatureAgentDetail.jsx b/client/src/pages/FeatureAgentDetail.jsx
index 42778a0570..278845d957 100644
--- a/client/src/pages/FeatureAgentDetail.jsx
+++ b/client/src/pages/FeatureAgentDetail.jsx
@@ -12,7 +12,7 @@ import ConfigTab from '../components/feature-agents/ConfigTab';
import RunsTab from '../components/feature-agents/RunsTab';
import OutputTab from '../components/feature-agents/OutputTab';
import GitTab from '../components/feature-agents/GitTab';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
export default function FeatureAgentDetail() {
const { id } = useParams();
@@ -87,9 +87,16 @@ export default function FeatureAgentDetail() {
if (loading) {
return (
- <div className="flex flex-col h-full items-center justify-center">
- <BrailleSpinner text="Loading agent" />
- </div>
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-56"
+ showSubtitle
+ showAction={false}
+ cards={3}
+ sidebar={false}
+ />
);
}
diff --git a/client/src/pages/FeatureAgentDetail.test.jsx b/client/src/pages/FeatureAgentDetail.test.jsx
index 7eeaeca12a..f6055667e0 100644
--- a/client/src/pages/FeatureAgentDetail.test.jsx
+++ b/client/src/pages/FeatureAgentDetail.test.jsx
@@ -63,9 +63,9 @@ describe('FeatureAgentDetail load race', () => {
</MemoryRouter>,
);
- // A's fetch is in flight; spinner shown.
+ // A's fetch is in flight; the loading skeleton is up.
expect(api.getFeatureAgent).toHaveBeenCalledWith('agent-a');
- expect(screen.getByText(/Loading agent/)).toBeInTheDocument();
+ expect(screen.getByRole('status', { name: 'Loading' })).toBeInTheDocument();
// Navigate A→B before A resolves.
await act(async () => {
@@ -101,9 +101,9 @@ describe('FeatureAgentDetail load race', () => {
await act(async () => {
screen.getByText('go-b').click();
});
- // B is still loading — the old agent name must be gone, spinner up.
+ // B is still loading — the old agent name must be gone, skeleton up.
expect(screen.queryByText('Agent Alpha')).not.toBeInTheDocument();
- expect(screen.getByText(/Loading agent/)).toBeInTheDocument();
+ expect(screen.getByRole('status', { name: 'Loading' })).toBeInTheDocument();
});
it('still renders the agent under StrictMode (mount→cleanup→remount must not strand the mounted guard)', async () => {
diff --git a/client/src/pages/FeatureAgents.jsx b/client/src/pages/FeatureAgents.jsx
index bc27cb6c2c..b2d0202fa8 100644
--- a/client/src/pages/FeatureAgents.jsx
+++ b/client/src/pages/FeatureAgents.jsx
@@ -5,7 +5,7 @@ import toast from '../components/ui/Toast';
import * as api from '../services/api';
import socket from '../services/socket';
import FeatureAgentCard from '../components/feature-agents/FeatureAgentCard';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import PageHeader from '../components/PageHeader';
export default function FeatureAgents() {
@@ -101,9 +101,12 @@ export default function FeatureAgents() {
<div className="flex-1 overflow-auto p-6">
{loading ? (
- <div className="flex items-center justify-center h-32">
- <BrailleSpinner text="Loading agents" />
- </div>
+ <PageSkeleton
+ header="none"
+ layout="grid"
+ gridColsClass="lg:grid-cols-2 xl:grid-cols-3"
+ cards={3}
+ />
) : agents.length === 0 ? (
<div className="text-center py-16">
<Wand2 size={48} className="mx-auto text-gray-600 mb-4" />
diff --git a/client/src/pages/Goals.jsx b/client/src/pages/Goals.jsx
index d80fc304e1..61d8eeb68e 100644
--- a/client/src/pages/Goals.jsx
+++ b/client/src/pages/Goals.jsx
@@ -7,6 +7,7 @@ import MortalLoomBanner from '../components/MortalLoomBanner';
import PageHeader from '../components/PageHeader';
import TabPills from '../components/ui/TabPills';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import { useValidTab } from '../hooks/useValidTab';
const GoalsTreeView = lazy(() => import('../components/goals/GoalsTreeView'));
@@ -73,9 +74,7 @@ export default function Goals() {
{/* Content */}
<div className="flex-1 overflow-hidden">
{loading ? (
- <div className="flex items-center justify-center h-full">
- <BrailleSpinner text="Loading" />
- </div>
+ <PageSkeleton header="none" fullHeight padded cards={4} sidebar={false} />
) : tab === 'list' ? (
<GoalsListView data={data} onRefresh={loadData} />
) : (
diff --git a/client/src/pages/HistoryPage.jsx b/client/src/pages/HistoryPage.jsx
index a6d9768396..ebb1ef7d7d 100644
--- a/client/src/pages/HistoryPage.jsx
+++ b/client/src/pages/HistoryPage.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
import { Trash2 } from 'lucide-react';
import * as api from '../services/api';
import { formatTime, formatRuntime, formatDateTime } from '../utils/formatters';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import Banner from '../components/ui/Banner';
import { clickableProps } from '../lib/a11yKeyboard.js';
@@ -68,7 +68,15 @@ export function HistoryPage() {
};
if (loading) {
- return <div className="text-center py-8"><BrailleSpinner text="Loading history" /></div>;
+ return (
+ <PageSkeleton
+ titleWidthClass="w-48"
+ showAction={false}
+ layout="grid"
+ gridColsClass="grid-cols-2 sm:grid-cols-4"
+ cards={4}
+ />
+ );
}
return (
diff --git a/client/src/pages/Messages.jsx b/client/src/pages/Messages.jsx
index 5eb2172555..aedc136c87 100644
--- a/client/src/pages/Messages.jsx
+++ b/client/src/pages/Messages.jsx
@@ -2,7 +2,7 @@ import { useNavigate, useParams } from 'react-router-dom';
import { Mail, RefreshCw, Settings, MessageSquare } from 'lucide-react';
import { useState, useEffect, useCallback } from 'react';
import * as api from '../services/api';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import PageHeader from '../components/PageHeader';
import TabPills from '../components/ui/TabPills';
import { useValidTab } from '../hooks/useValidTab';
@@ -74,9 +74,16 @@ export default function Messages() {
if (loading) {
return (
- <div className="flex items-center justify-center h-full">
- <BrailleSpinner text="Loading" />
- </div>
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-36"
+ showSubtitle
+ tabs={TABS.length}
+ cards={3}
+ sidebar={false}
+ />
);
}
diff --git a/client/src/pages/Review.jsx b/client/src/pages/Review.jsx
index a0300d36ef..5198ef162d 100644
--- a/client/src/pages/Review.jsx
+++ b/client/src/pages/Review.jsx
@@ -25,7 +25,7 @@ import {
Activity,
DatabaseBackup
} from 'lucide-react';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import MarkdownOutput from '../components/cos/MarkdownOutput';
import { timeAgo, formatDateTime } from '../utils/formatters';
import { coalesce } from '../utils/coalesce';
@@ -263,11 +263,7 @@ export default function Review() {
}), [pendingItems]);
if (loading) {
- return (
- <div className="flex items-center justify-center h-64">
- <BrailleSpinner text="Loading review hub" />
- </div>
- );
+ return <PageSkeleton padded fullHeight titleWidthClass="w-40" cards={4} sidebar={false} />;
}
// Cheap derivations off the memoized `pendingItems`/`actionableItems` — plain
diff --git a/client/src/pages/RunsHistoryPage.jsx b/client/src/pages/RunsHistoryPage.jsx
index 6fca033b8f..328ec67c41 100644
--- a/client/src/pages/RunsHistoryPage.jsx
+++ b/client/src/pages/RunsHistoryPage.jsx
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
import { Trash2, RotateCcw, MessageSquarePlus, ScrollText } from 'lucide-react';
import * as api from '../services/api';
import { formatTime, formatRuntime, formatBytes, formatDateTime } from '../utils/formatters';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import Banner from '../components/ui/Banner';
import ProcessLogModal from '../components/ui/ProcessLogModal';
import { writeClipboardSilently } from '../lib/clipboard';
@@ -145,7 +145,7 @@ export function RunsHistoryPage() {
};
if (loading) {
- return <div className="text-center py-8"><BrailleSpinner text="Loading runs history" /></div>;
+ return <PageSkeleton titleWidthClass="w-48" showAction={false} cards={4} sidebar={false} />;
}
const failedCount = runs.filter(r => r.success === false).length;
diff --git a/client/src/pages/Submodules.jsx b/client/src/pages/Submodules.jsx
index 42d9988a73..4c36e1fdd4 100644
--- a/client/src/pages/Submodules.jsx
+++ b/client/src/pages/Submodules.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from 'react';
import { RefreshCw, ArrowUpCircle, GitBranch, ExternalLink, Check } from 'lucide-react';
import toast from '../components/ui/Toast';
import * as api from '../services/api';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
export default function Submodules() {
const [submodules, setSubmodules] = useState([]);
@@ -53,7 +53,7 @@ export default function Submodules() {
};
if (loading) {
- return <div className="text-center py-8"><BrailleSpinner text="Loading submodules" /></div>;
+ return <PageSkeleton titleWidthClass="w-40" cards={3} sidebar={false} />;
}
const hasUpdates = submodules.some(s => s.behind > 0 || s.outOfSync || !s.initialized);
diff --git a/client/src/pages/SystemHealthPage.jsx b/client/src/pages/SystemHealthPage.jsx
index 80942a9f3f..b2d5f86f3f 100644
--- a/client/src/pages/SystemHealthPage.jsx
+++ b/client/src/pages/SystemHealthPage.jsx
@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';
import { Activity, AlertTriangle, CheckCircle, XCircle, HardDrive, Cpu, Database, ServerCog, Zap } from 'lucide-react';
import * as api from '../services/api';
import toast from '../components/ui/Toast';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import Banner from '../components/ui/Banner';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
@@ -66,8 +66,8 @@ export default function SystemHealthPage() {
if (loading) {
return (
- <div className="flex items-center justify-center h-64">
- <BrailleSpinner text="Loading system health" />
+ <div className="max-w-5xl mx-auto">
+ <PageSkeleton titleWidthClass="w-48" cards={4} sidebar={false} />
</div>
);
}
diff --git a/client/src/pages/Uploads.jsx b/client/src/pages/Uploads.jsx
index 2e747ae745..fb83d84b26 100644
--- a/client/src/pages/Uploads.jsx
+++ b/client/src/pages/Uploads.jsx
@@ -4,7 +4,7 @@ import { useConfirmDelete } from '../hooks/useConfirmDelete';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
import { formatDateTime } from '../utils/formatters';
import toast from '../components/ui/Toast';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import * as api from '../services/api';
// File type icons based on MIME type
@@ -142,11 +142,7 @@ export default function Uploads() {
};
if (loading) {
- return (
- <div className="flex items-center justify-center h-64">
- <BrailleSpinner text="Loading uploads" />
- </div>
- );
+ return <PageSkeleton titleWidthClass="w-44" showSubtitle cards={4} sidebar={false} />;
}
return (
diff --git a/client/src/pages/UsagePage.jsx b/client/src/pages/UsagePage.jsx
index 5b3daa27ed..bcda6f050c 100644
--- a/client/src/pages/UsagePage.jsx
+++ b/client/src/pages/UsagePage.jsx
@@ -3,6 +3,7 @@ import { useSearchParams } from 'react-router-dom';
import { RefreshCw, Clock, AlertTriangle } from 'lucide-react';
import * as api from '../services/api';
import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import Pill from '../components/ui/Pill';
import { formatCompactCount } from '../utils/formatters';
@@ -341,7 +342,15 @@ function InternalUsageMetrics() {
};
if (loading && !usage) {
- return <div className="text-center py-8"><BrailleSpinner text="Loading usage data" /></div>;
+ return (
+ <PageSkeleton
+ titleWidthClass="w-44"
+ showAction={false}
+ layout="grid"
+ gridColsClass="grid-cols-2 sm:grid-cols-4"
+ cards={4}
+ />
+ );
}
if (!usage) {
diff --git a/client/src/pages/Wiki.jsx b/client/src/pages/Wiki.jsx
index 52f9db6c52..b2a4e0b3e8 100644
--- a/client/src/pages/Wiki.jsx
+++ b/client/src/pages/Wiki.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo } from 'react';
import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
import * as api from '../services/api';
import { BookOpen, Search, Network, FileText, BarChart3, Activity } from 'lucide-react';
-import BrailleSpinner from '../components/BrailleSpinner';
+import PageSkeleton from '../components/ui/PageSkeleton';
import PageHeader from '../components/PageHeader';
import TabPills from '../components/ui/TabPills';
@@ -109,9 +109,16 @@ export default function Wiki() {
if (loading) {
return (
- <div className="flex items-center justify-center h-full">
- <BrailleSpinner text="Loading" />
- </div>
+ <PageSkeleton
+ header="bar"
+ fullHeight
+ padded
+ titleWidthClass="w-24"
+ showSubtitle
+ tabs={TABS.length}
+ cards={3}
+ sidebar={false}
+ />
);
}