Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(frontend): consolidate skeletons + overlay SkeletonBoundary (plan 50 phase 1)

Juan Denisc687ea4dc4ea
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 066175d2..e75eeff2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -204,6 +204,22 @@ awaiting a stable release:
### Changed
+- **Skeleton loading overhaul — one primitive, overlay-on-content, no layout
+ shift.** Loading placeholders no longer swap in a disconnected tree that jumps
+ when data arrives. A new `SkeletonBoundary` keeps the real content in flow and,
+ while loading, hides it and paints the skeleton *over* its exact box — so the
+ placeholder inherits the real dimensions at every breakpoint (zero guessed
+ widths, zero cumulative layout shift on refresh). The two competing skeleton
+ primitives were consolidated to the single SCSS-based `Skeleton` (the Tailwind
+ `ui/skeleton` shim and its raw sizing classes are gone), and the worst
+ hand-guessed loaders — SSL certificates, the WordPress list and detail tabs,
+ and the WordPress activity feed — now render through the boundary. All skeleton
+ shimmer honors `prefers-reduced-motion`, and loading regions expose `aria-busy`
+ for assistive tech. A dev-only tool (`npm run capture:skeletons`) can measure a
+ logged-in page's real layout into baked bone assets for pixel-accurate
+ placeholders, replayed via the boundary's optional `bones` prop — no browser or
+ extra dependency ships in the product.
+
- **`update.sh` now defaults to pre-built releases (Node-free updates).** The
frontend is compiled once in CI and shipped, so a normal `update.sh` no longer
rebuilds the SPA on the server — it fetches the pre-built release tarball,
diff --git a/frontend/src/components/SkeletonBoundary.jsx b/frontend/src/components/SkeletonBoundary.jsx
new file mode 100644
index 00000000..f5ed853d
--- /dev/null
+++ b/frontend/src/components/SkeletonBoundary.jsx
@@ -0,0 +1,89 @@
+import { Children, useEffect, useState } from 'react';
+import { cn } from '@/lib/utils';
+
+/**
+ * SkeletonBoundary — paints a loading skeleton over the real content box.
+ *
+ * Instead of swapping the content tree for a disconnected placeholder (which
+ * shifts layout when data arrives), the boundary keeps the real children in
+ * flow and, while `loading`, hides them (`visibility: hidden`) and overlays the
+ * `skeleton` absolutely (`position: absolute; inset: 0`). The overlay inherits
+ * the real content's dimensions, so the skeleton is correct by construction at
+ * every breakpoint — zero guessed geometry, zero layout shift.
+ *
+ * <SkeletonBoundary loading={isLoading} skeleton={<CertListSkeleton />}>
+ * {status && <CertList data={status} />}
+ * </SkeletonBoundary>
+ *
+ * When `loading` with no in-flow children yet (first load, data-gated), the
+ * boundary renders the skeleton in normal flow at its intrinsic size — the same
+ * footprint as a plain skeleton swap, so there's no regression on first paint.
+ * Overlay mode kicks in automatically once real children are present (e.g. a
+ * refresh over already-loaded data).
+ *
+ * Accessibility: the boundary is `aria-busy` while loading and the skeleton is
+ * `aria-hidden`. Shimmer and the optional fade honour `prefers-reduced-motion`
+ * via `styles/components/_skeleton.scss`.
+ *
+ * @param {boolean} loading Whether content is still loading.
+ * @param {React.ReactNode} skeleton Placeholder rendered while loading.
+ * @param {React.ReactNode} children Real content (may be data-gated/absent).
+ * @param {boolean} [transition] Fade the skeleton out on load (~200ms, opacity only).
+ * @param {string} [as] Container tag name (default 'div').
+ * @param {string} [className] Extra classes on the boundary container.
+ */
+export function SkeletonBoundary({
+ loading,
+ skeleton,
+ children,
+ transition = false,
+ as: Tag = 'div',
+ className = '',
+ ...rest
+}) {
+ // Keep the skeleton mounted through a short fade-out when `transition` is on.
+ const [showSkeleton, setShowSkeleton] = useState(loading);
+ const leaving = !loading && showSkeleton;
+
+ useEffect(() => {
+ if (loading) {
+ setShowSkeleton(true);
+ return undefined;
+ }
+ if (!transition) {
+ setShowSkeleton(false);
+ return undefined;
+ }
+ const timer = setTimeout(() => setShowSkeleton(false), 200);
+ return () => clearTimeout(timer);
+ }, [loading, transition]);
+
+ // Overlay mode needs a real box to cover — only when in-flow children exist.
+ const hasContent = Children.toArray(children).length > 0;
+
+ return (
+ <Tag
+ className={cn('skeleton-boundary', className)}
+ data-loading={loading ? 'true' : undefined}
+ aria-busy={loading ? 'true' : undefined}
+ {...rest}
+ >
+ {children}
+ {showSkeleton && (
+ <div
+ className={cn(
+ 'skeleton-boundary__skeleton',
+ hasContent && 'skeleton-boundary__skeleton--overlay',
+ transition && 'skeleton-boundary__skeleton--fade',
+ leaving && 'skeleton-boundary__skeleton--leaving',
+ )}
+ aria-hidden="true"
+ >
+ {skeleton}
+ </div>
+ )}
+ </Tag>
+ );
+}
+
+export default SkeletonBoundary;
diff --git a/frontend/src/components/ui/skeleton.jsx b/frontend/src/components/ui/skeleton.jsx
deleted file mode 100644
index 3e7693d5..00000000
--- a/frontend/src/components/ui/skeleton.jsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import { cn } from '@/lib/utils';
-
-function Skeleton({ className, ...props }) {
- return <div className={cn('ui-skeleton', className)} {...props} />;
-}
-
-export { Skeleton };
diff --git a/frontend/src/components/wordpress/ActivityFeed.jsx b/frontend/src/components/wordpress/ActivityFeed.jsx
index c368c92b..1b6ea718 100644
--- a/frontend/src/components/wordpress/ActivityFeed.jsx
+++ b/frontend/src/components/wordpress/ActivityFeed.jsx
@@ -4,7 +4,8 @@ import wordpressApi from '../../services/wordpress';
import { formatRelativeTime } from '@/utils/time';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
-import { Skeleton } from '@/components/ui/skeleton';
+import { Skeleton } from '@/components/Skeleton';
+import SkeletonBoundary from '@/components/SkeletonBoundary';
const ACTION_ICONS = {
create: Play,
@@ -60,23 +61,21 @@ const ActivityFeed = ({ projectId, envId, limit = 20, compact = false }) => {
}
}
- if (loading) {
- return (
- <div className="activity-feed">
- {[1, 2, 3].map(i => (
- <div key={i} className="activity-item-skeleton">
- <Skeleton className="h-8 w-8 rounded-full" />
- <div style={{ flex: 1 }}>
- <Skeleton className="h-3.5 w-3/5 mb-1.5" />
- <Skeleton className="h-3 w-2/5" />
- </div>
+ const feedSkeleton = (
+ <>
+ {[1, 2, 3].map(i => (
+ <div key={i} className="activity-item-skeleton">
+ <Skeleton variant="circle" width={32} height={32} />
+ <div className="skeleton-stack">
+ <Skeleton variant="line" width="60%" />
+ <Skeleton variant="line" width="40%" />
</div>
- ))}
- </div>
- );
- }
+ </div>
+ ))}
+ </>
+ );
- if (activities.length === 0) {
+ if (!loading && activities.length === 0) {
return (
<div className="activity-feed-empty">
<p>No activity recorded yet.</p>
@@ -85,8 +84,12 @@ const ActivityFeed = ({ projectId, envId, limit = 20, compact = false }) => {
}
return (
- <div className={`activity-feed ${compact ? 'compact' : ''}`}>
- {activities.map(activity => {
+ <SkeletonBoundary
+ className={`activity-feed ${compact ? 'compact' : ''}`.trim()}
+ loading={loading}
+ skeleton={feedSkeleton}
+ >
+ {activities.length > 0 && activities.map(activity => {
const Icon = ACTION_ICONS[activity.action] || AlertCircle;
const colorClass = ACTION_BADGE_VARIANTS[activity.action] || 'secondary';
@@ -120,7 +123,7 @@ const ActivityFeed = ({ projectId, envId, limit = 20, compact = false }) => {
Load more
</Button>
)}
- </div>
+ </SkeletonBoundary>
);
};
diff --git a/frontend/src/components/wordpress/detail/AnalyticsTab.jsx b/frontend/src/components/wordpress/detail/AnalyticsTab.jsx
index c1d32eaf..c1f930f6 100644
--- a/frontend/src/components/wordpress/detail/AnalyticsTab.jsx
+++ b/frontend/src/components/wordpress/detail/AnalyticsTab.jsx
@@ -6,6 +6,7 @@ import wordpressApi from '../../../services/wordpress';
import api from '../../../services/api';
import { useToast } from '../../../contexts/ToastContext';
import { MetricCard, SegControl } from '../../ds';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { OverviewGridSkeleton, ANALYTICS_PERIODS } from './wpDetailShared';
// Analytics Tab — per-site traffic + error analytics (#25), parsed on-demand from
@@ -48,7 +49,7 @@ const AnalyticsTab = ({ siteId }) => {
useEffect(() => { load(); }, [load]);
- if (loading) return <OverviewGridSkeleton panels={3} />;
+ if (loading) return <SkeletonBoundary loading skeleton={<OverviewGridSkeleton panels={3} />} />;
const fmtHour = (iso) => {
const d = new Date(iso);
diff --git a/frontend/src/components/wordpress/detail/EnvironmentsTab.jsx b/frontend/src/components/wordpress/detail/EnvironmentsTab.jsx
index 34e692b4..4450fe92 100644
--- a/frontend/src/components/wordpress/detail/EnvironmentsTab.jsx
+++ b/frontend/src/components/wordpress/detail/EnvironmentsTab.jsx
@@ -8,6 +8,7 @@ import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { EnvironmentCardSkeleton } from './wpDetailShared';
// Environments Tab
@@ -72,16 +73,18 @@ const EnvironmentsTab = ({ siteId, site, onUpdate }) => {
if (loading) {
return (
- <div className="environments-tab">
- <div className="section-header">
- <div className="skeleton" style={{ width: 120, height: 24 }} />
- <div className="skeleton" style={{ width: 160, height: 36, borderRadius: 6 }} />
- </div>
- <div className="environments-grid">
- <EnvironmentCardSkeleton />
- <EnvironmentCardSkeleton />
+ <SkeletonBoundary loading skeleton={(
+ <div className="environments-tab">
+ <div className="section-header">
+ <div className="skeleton" style={{ width: 120, height: 24 }} />
+ <div className="skeleton" style={{ width: 160, height: 36, borderRadius: 6 }} />
+ </div>
+ <div className="environments-grid">
+ <EnvironmentCardSkeleton />
+ <EnvironmentCardSkeleton />
+ </div>
</div>
- </div>
+ )} />
);
}
diff --git a/frontend/src/components/wordpress/detail/GitTab.jsx b/frontend/src/components/wordpress/detail/GitTab.jsx
index 9c335988..0675fd83 100644
--- a/frontend/src/components/wordpress/detail/GitTab.jsx
+++ b/frontend/src/components/wordpress/detail/GitTab.jsx
@@ -5,6 +5,7 @@ import { useToast } from '../../../contexts/ToastContext';
import { GitConnectForm, CommitList } from '../index';
import { ErrorState } from '../../ErrorBoundary';
import { Button } from '@/components/ui/button';
+import SkeletonBoundary from '../../SkeletonBoundary';
// Git Tab
const GitTab = ({ siteId, site, onUpdate }) => {
@@ -73,14 +74,16 @@ const GitTab = ({ siteId, site, onUpdate }) => {
if (loading) {
return (
- <div className="git-tab">
- <div className="git-connect git-connect--card">
- <div className="skeleton" style={{ width: 200, height: 24, marginBottom: 16 }} />
- <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 12 }} />
- <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 12 }} />
- <div className="skeleton" style={{ width: 140, height: 36, borderRadius: 6 }} />
+ <SkeletonBoundary loading skeleton={(
+ <div className="git-tab">
+ <div className="git-connect git-connect--card">
+ <div className="skeleton" style={{ width: 200, height: 24, marginBottom: 16 }} />
+ <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 12 }} />
+ <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 12 }} />
+ <div className="skeleton" style={{ width: 140, height: 36, borderRadius: 6 }} />
+ </div>
</div>
- </div>
+ )} />
);
}
diff --git a/frontend/src/components/wordpress/detail/PhpTab.jsx b/frontend/src/components/wordpress/detail/PhpTab.jsx
index 2bbbce06..8cfcfee9 100644
--- a/frontend/src/components/wordpress/detail/PhpTab.jsx
+++ b/frontend/src/components/wordpress/detail/PhpTab.jsx
@@ -4,6 +4,7 @@ import { useToast } from '../../../contexts/ToastContext';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { OverviewGridSkeleton, PHP_LIMIT_LABELS } from './wpDetailShared';
// PHP Tab — live PHP version + ini limits for the Docker (apache/mod_php) site.
@@ -76,7 +77,7 @@ const PhpTab = ({ siteId }) => {
}
}
- if (loading) return <OverviewGridSkeleton panels={2} />;
+ if (loading) return <SkeletonBoundary loading skeleton={<OverviewGridSkeleton panels={2} />} />;
const limits = php?.limits || {};
const current = php?.php_version || 'Unknown';
diff --git a/frontend/src/components/wordpress/detail/PluginsTab.jsx b/frontend/src/components/wordpress/detail/PluginsTab.jsx
index 9db483e8..c529eeef 100644
--- a/frontend/src/components/wordpress/detail/PluginsTab.jsx
+++ b/frontend/src/components/wordpress/detail/PluginsTab.jsx
@@ -8,6 +8,7 @@ import { ServiceTile } from '../../ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { ListItemSkeleton } from './wpDetailShared';
// Plugins Tab
@@ -131,17 +132,19 @@ const PluginsTab = ({ siteId }) => {
if (loading) {
return (
- <div className="plugins-tab">
- <div className="section-header">
- <div className="skeleton" style={{ width: 80, height: 24 }} />
+ <SkeletonBoundary loading skeleton={(
+ <div className="plugins-tab">
+ <div className="section-header">
+ <div className="skeleton" style={{ width: 80, height: 24 }} />
+ </div>
+ <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 16 }} />
+ <div className="plugins-list">
+ <ListItemSkeleton />
+ <ListItemSkeleton />
+ <ListItemSkeleton />
+ </div>
</div>
- <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 16 }} />
- <div className="plugins-list">
- <ListItemSkeleton />
- <ListItemSkeleton />
- <ListItemSkeleton />
- </div>
- </div>
+ )} />
);
}
diff --git a/frontend/src/components/wordpress/detail/ReportsTab.jsx b/frontend/src/components/wordpress/detail/ReportsTab.jsx
index df1eee7a..c7e08c49 100644
--- a/frontend/src/components/wordpress/detail/ReportsTab.jsx
+++ b/frontend/src/components/wordpress/detail/ReportsTab.jsx
@@ -6,6 +6,7 @@ import { useToast } from '../../../contexts/ToastContext';
import { useConfirm } from '../../../hooks/useConfirm';
import { Pill } from '../../ds';
import { Button } from '@/components/ui/button';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { OverviewGridSkeleton } from './wpDetailShared';
// Reports Tab — monthly client reports (#33 agency slice). Aggregates the
@@ -118,7 +119,7 @@ const ReportsTab = ({ siteId }) => {
window.print();
}
- if (loading) return <OverviewGridSkeleton panels={2} />;
+ if (loading) return <SkeletonBoundary loading skeleton={<OverviewGridSkeleton panels={2} />} />;
const selected = reports.find(r => r.id === selectedId) || null;
diff --git a/frontend/src/components/wordpress/detail/SecurityTab.jsx b/frontend/src/components/wordpress/detail/SecurityTab.jsx
index 5ac6956a..f12a28b3 100644
--- a/frontend/src/components/wordpress/detail/SecurityTab.jsx
+++ b/frontend/src/components/wordpress/detail/SecurityTab.jsx
@@ -3,6 +3,7 @@ import wordpressApi from '../../../services/wordpress';
import { useToast } from '../../../contexts/ToastContext';
import { Pill, ScoreGauge } from '../../ds';
import { Button } from '@/components/ui/button';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { OverviewGridSkeleton } from './wpDetailShared';
// Security Tab — per-site security depth (#30): file-integrity verification,
@@ -93,7 +94,7 @@ const SecurityTab = ({ siteId }) => {
finally { setBusy(false); }
}
- if (loading) return <OverviewGridSkeleton panels={2} />;
+ if (loading) return <SkeletonBoundary loading skeleton={<OverviewGridSkeleton panels={2} />} />;
const intRunning = integrity?.status === 'running';
const issues = integrity?.issues || [];
diff --git a/frontend/src/components/wordpress/detail/ThemesTab.jsx b/frontend/src/components/wordpress/detail/ThemesTab.jsx
index ec285cec..441f0952 100644
--- a/frontend/src/components/wordpress/detail/ThemesTab.jsx
+++ b/frontend/src/components/wordpress/detail/ThemesTab.jsx
@@ -7,6 +7,7 @@ import EmptyState from '../../EmptyState';
import { Pill } from '../../ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { ListItemSkeleton } from './wpDetailShared';
// Themes Tab
@@ -92,17 +93,19 @@ const ThemesTab = ({ siteId }) => {
if (loading) {
return (
- <div className="themes-tab">
- <div className="section-header">
- <div className="skeleton" style={{ width: 80, height: 24 }} />
+ <SkeletonBoundary loading skeleton={(
+ <div className="themes-tab">
+ <div className="section-header">
+ <div className="skeleton" style={{ width: 80, height: 24 }} />
+ </div>
+ <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 16 }} />
+ <div className="themes-list">
+ <ListItemSkeleton />
+ <ListItemSkeleton />
+ <ListItemSkeleton />
+ </div>
</div>
- <div className="skeleton" style={{ height: 44, borderRadius: 6, marginBottom: 16 }} />
- <div className="themes-list">
- <ListItemSkeleton />
- <ListItemSkeleton />
- <ListItemSkeleton />
- </div>
- </div>
+ )} />
);
}
diff --git a/frontend/src/components/wordpress/detail/UpdatesTab.jsx b/frontend/src/components/wordpress/detail/UpdatesTab.jsx
index 190e49b2..be50996f 100644
--- a/frontend/src/components/wordpress/detail/UpdatesTab.jsx
+++ b/frontend/src/components/wordpress/detail/UpdatesTab.jsx
@@ -5,6 +5,7 @@ import { Pill } from '../../ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { OverviewGridSkeleton, UPDATE_SCHEDULES } from './wpDetailShared';
// Updates Tab — safe update manager (#29): snapshot -> update -> health-check ->
@@ -59,7 +60,7 @@ const UpdatesTab = ({ siteId }) => {
finally { setBusy(false); }
}
- if (loading) return <OverviewGridSkeleton panels={2} />;
+ if (loading) return <SkeletonBoundary loading skeleton={<OverviewGridSkeleton panels={2} />} />;
const runs = data?.runs || [];
const running = data?.running;
diff --git a/frontend/src/components/wordpress/detail/UptimeTab.jsx b/frontend/src/components/wordpress/detail/UptimeTab.jsx
index f4c4b193..19342c2d 100644
--- a/frontend/src/components/wordpress/detail/UptimeTab.jsx
+++ b/frontend/src/components/wordpress/detail/UptimeTab.jsx
@@ -6,6 +6,7 @@ import { HealthDot } from '../HealthStatusPanel';
import { MetricCard } from '../../ds';
import { Button } from '@/components/ui/button';
import { Label } from '@/components/ui/label';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { OverviewGridSkeleton } from './wpDetailShared';
// Uptime Tab — per-site health + uptime % via a bound status-page component (#26).
@@ -59,7 +60,7 @@ const UptimeTab = ({ siteId }) => {
} finally { setBusy(false); }
}
- if (loading) return <OverviewGridSkeleton panels={2} />;
+ if (loading) return <SkeletonBoundary loading skeleton={<OverviewGridSkeleton panels={2} />} />;
const comp = data?.component;
const pages = data?.pages || [];
diff --git a/frontend/src/components/wordpress/detail/VulnerabilitiesTab.jsx b/frontend/src/components/wordpress/detail/VulnerabilitiesTab.jsx
index 5155d749..49e9a985 100644
--- a/frontend/src/components/wordpress/detail/VulnerabilitiesTab.jsx
+++ b/frontend/src/components/wordpress/detail/VulnerabilitiesTab.jsx
@@ -4,6 +4,7 @@ import wordpressApi from '../../../services/wordpress';
import { useToast } from '../../../contexts/ToastContext';
import { KpiBand, MetricCard } from '../../ds';
import { Button } from '@/components/ui/button';
+import SkeletonBoundary from '../../SkeletonBoundary';
import { OverviewGridSkeleton } from './wpDetailShared';
// Vulnerabilities Tab — cross-references plugin/theme/core versions against the
@@ -45,7 +46,7 @@ const VulnerabilitiesTab = ({ siteId }) => {
}
}
- if (loading) return <OverviewGridSkeleton panels={2} />;
+ if (loading) return <SkeletonBoundary loading skeleton={<OverviewGridSkeleton panels={2} />} />;
const running = data?.scan_status === 'running';
const summary = data?.summary || {};
diff --git a/frontend/src/pages/SSLCertificates.jsx b/frontend/src/pages/SSLCertificates.jsx
index 2c0efe24..4b30f80f 100644
--- a/frontend/src/pages/SSLCertificates.jsx
+++ b/frontend/src/pages/SSLCertificates.jsx
@@ -15,7 +15,8 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Checkbox } from '@/components/ui/checkbox';
-import { Skeleton } from '@/components/ui/skeleton';
+import { Skeleton } from '@/components/Skeleton';
+import SkeletonBoundary from '@/components/SkeletonBoundary';
const SSLCertificates = () => {
const toast = useToast();
@@ -253,37 +254,43 @@ const SSLCertificates = () => {
[actionLoading, certbotInstalled, certificates.length],
);
- if (loading) {
- return (
- <div className="sk-tabgroup__inner ssl-page">
- <div className="ssl-status-bar">
- {[1, 2, 3].map(i => (
- <div key={i} className="ssl-status-item">
- <Skeleton className="w-12 h-12 rounded-xl" />
- <div>
- <Skeleton className="w-20 h-3.5 mb-1.5" />
- <Skeleton className="w-12 h-3" />
- </div>
+ const sslSkeleton = (
+ <>
+ <div className="ssl-status-bar">
+ {[1, 2, 3].map(i => (
+ <div key={i} className="ssl-status-item">
+ <Skeleton variant="avatar" />
+ <div className="skeleton-stack">
+ <Skeleton variant="title" width="55%" />
+ <Skeleton variant="line" width="35%" />
</div>
- ))}
- </div>
- <div className="ssl-cert-list">
- {[1, 2].map(i => (
- <div key={i} className="ssl-cert-item">
- <Skeleton className="w-10 h-10 rounded-xl" />
- <div className="flex-1">
- <Skeleton className="w-48 h-3.5 mb-2" />
- <Skeleton className="w-72 h-3" />
+ </div>
+ ))}
+ </div>
+ <div className="ssl-cert-list">
+ {[1, 2].map(i => (
+ <div key={i} className="ssl-cert-item">
+ <div className="ssl-cert-item-info">
+ <Skeleton variant="avatar" />
+ <div className="skeleton-stack">
+ <Skeleton variant="title" width={200} />
+ <Skeleton variant="line" width={280} />
</div>
</div>
- ))}
- </div>
+ </div>
+ ))}
</div>
- );
- }
+ </>
+ );
return (
- <div className="sk-tabgroup__inner ssl-page">
+ <>
+ <SkeletonBoundary
+ className="sk-tabgroup__inner ssl-page"
+ loading={loading}
+ skeleton={sslSkeleton}
+ >
+ {(!loading || status) && (<>
{/* Status Cards */}
<div className="ssl-status-bar">
<div className="ssl-status-item">
@@ -422,6 +429,8 @@ const SSLCertificates = () => {
</Button>
</div>
)}
+ </>)}
+ </SkeletonBoundary>
{/* Obtain Certificate Modal */}
<Modal open={showObtainModal} onClose={() => setShowObtainModal(false)} title="Obtain SSL Certificate">
@@ -619,7 +628,7 @@ const SSLCertificates = () => {
</div>
</form>
</Modal>
- </div>
+ </>
);
};
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index c2cd15b2..f1572ef8 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -14,6 +14,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Checkbox } from '@/components/ui/checkbox';
+import SkeletonBoundary from '@/components/SkeletonBoundary';
// Mirror the backend slug rule (a-z, 0-9, single dashes) so the create modal can
// preview the exact <slug>.<base> host the site will be published at.
@@ -194,34 +195,40 @@ function WordPress() {
[]
);
- if (loading) {
- return (
- <div className="sk-tabgroup__inner wordpress-page">
- <div className="wp-sites-grid">
- {[1, 2, 3].map(i => (
- <div key={i} className="wp-site-card-skeleton">
- <div className="wp-site-card-skeleton-header">
- <div className="wp-site-card-skeleton-icon" />
- <div className="wp-site-card-skeleton-info">
- <div className="wp-site-card-skeleton-name" />
- <div className="wp-site-card-skeleton-url" />
- </div>
- <div className="wp-site-card-skeleton-status" />
- </div>
- <div className="wp-site-card-skeleton-body">
- <div className="wp-site-card-skeleton-meta">
- <div className="wp-site-card-skeleton-label" />
- <div className="wp-site-card-skeleton-value" />
- </div>
- <div className="wp-site-card-skeleton-meta">
- <div className="wp-site-card-skeleton-label" />
- <div className="wp-site-card-skeleton-value" />
- </div>
- </div>
+ const wpListSkeleton = (
+ <div className="wp-sites-grid">
+ {[1, 2, 3].map(i => (
+ <div key={i} className="wp-site-card-skeleton">
+ <div className="wp-site-card-skeleton-header">
+ <div className="wp-site-card-skeleton-icon" />
+ <div className="wp-site-card-skeleton-info">
+ <div className="wp-site-card-skeleton-name" />
+ <div className="wp-site-card-skeleton-url" />
</div>
- ))}
+ <div className="wp-site-card-skeleton-status" />
+ </div>
+ <div className="wp-site-card-skeleton-body">
+ <div className="wp-site-card-skeleton-meta">
+ <div className="wp-site-card-skeleton-label" />
+ <div className="wp-site-card-skeleton-value" />
+ </div>
+ <div className="wp-site-card-skeleton-meta">
+ <div className="wp-site-card-skeleton-label" />
+ <div className="wp-site-card-skeleton-value" />
+ </div>
+ </div>
</div>
- </div>
+ ))}
+ </div>
+ );
+
+ if (loading) {
+ return (
+ <SkeletonBoundary
+ className="sk-tabgroup__inner wordpress-page"
+ loading
+ skeleton={wpListSkeleton}
+ />
);
}
diff --git a/frontend/src/pages/WordPressDetail.jsx b/frontend/src/pages/WordPressDetail.jsx
index 5ee4dab9..f5141a4b 100644
--- a/frontend/src/pages/WordPressDetail.jsx
+++ b/frontend/src/pages/WordPressDetail.jsx
@@ -11,6 +11,7 @@ import { Pill, EnvTag, PageTopbar } from '../components/ds';
import { ErrorBoundary } from '../components/ErrorBoundary';
import EmptyState from '../components/EmptyState';
import PluginSlot from '../components/PluginSlot';
+import SkeletonBoundary from '../components/SkeletonBoundary';
import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -130,7 +131,7 @@ const WordPressDetail = () => {
}
if (loading) {
- return <DetailPageSkeleton />;
+ return <SkeletonBoundary loading skeleton={<DetailPageSkeleton />} />;
}
if (!site) {
diff --git a/frontend/src/styles/components/_skeleton.scss b/frontend/src/styles/components/_skeleton.scss
index 5413296b..aafd37ae 100644
--- a/frontend/src/styles/components/_skeleton.scss
+++ b/frontend/src/styles/components/_skeleton.scss
@@ -67,6 +67,17 @@
}
}
+// Vertical stack for composed skeleton lines (e.g. a title over a subline) that
+// sit next to an avatar/icon in a flex row. Fills the remaining row width so
+// percentage widths on the child <Skeleton>s read against the real column.
+.skeleton-stack {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ gap: $space-2;
+}
+
// Generic panel skeleton used by EmptyState's loading branch: a header row
// (avatar + two lines), a row of stat cards, and a few content lines.
.skeleton-panel {
@@ -118,8 +129,56 @@
margin-inline: auto;
}
+// ============================================
+// SKELETON BOUNDARY
+// Overlays the loading skeleton on the real content box instead of swapping the
+// tree — the overlay inherits the content's dimensions, so nothing jumps when
+// data arrives. See components/SkeletonBoundary.jsx.
+// ============================================
+.skeleton-boundary {
+ position: relative;
+
+ // While loading, hide the real (in-flow) children so the overlay reads
+ // through — but never the skeleton overlay itself.
+ &[data-loading='true'] > :not(.skeleton-boundary__skeleton) {
+ visibility: hidden;
+ }
+
+ &__skeleton {
+ // Flow mode (no in-flow children yet): the skeleton occupies its
+ // intrinsic space — same footprint as a plain skeleton swap.
+
+ // Overlay mode: cover the hidden real content exactly.
+ &--overlay {
+ position: absolute;
+ inset: 0;
+ }
+
+ &--fade {
+ transition: opacity 200ms ease-out;
+ }
+
+ &--leaving {
+ opacity: 0;
+ }
+ }
+}
+
@media (prefers-reduced-motion: reduce) {
.skeleton::after {
animation: none;
}
+
+ .skeleton-boundary__skeleton--fade {
+ transition: none;
+ }
+
+ // The legacy `@mixin skeleton()` (pages/_wordpress) and the wp-*-skeleton
+ // families animate the element itself (not a ::after), so disable those too.
+ // The trailing [class] bumps specificity above the plain `.skeleton` /
+ // `.wp-*-skeleton` rules so this wins regardless of import order.
+ .skeleton[class],
+ [class*='-skeleton'][class] {
+ animation: none;
+ }
}
diff --git a/frontend/src/styles/components/_ui.scss b/frontend/src/styles/components/_ui.scss
index f0892064..57221624 100644
--- a/frontend/src/styles/components/_ui.scss
+++ b/frontend/src/styles/components/_ui.scss
@@ -855,15 +855,6 @@
overflow: hidden;
}
-// --------------------------------------------
-// SKELETON
-// --------------------------------------------
-.ui-skeleton {
- border-radius: $radius-md;
- background: $bg-secondary;
- animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
-}
-
// --------------------------------------------
// MODAL (components/Modal.jsx — built on the Dialog primitive)
// --------------------------------------------