Family Hub Insights — 500 Fix & Design Overhaul
Context
The/insights page at casa.devarno.cloud was returning a 500 Internal Server Error, completely blocking access to the cross-organisation intelligence dashboard. Simultaneously, the entire insights section suffered from a severe brand disconnect — using generic gray/white styling that bore no resemblance to the Devarno Cloud landing page aesthetic or the SO1 Mars/visor design system.
Root Cause: 500 Error
Diagnosis
The insights pages are Next.js server components that call database service functions viaPromise.all() without error handling. The page component at src/app/insights/page.tsx executed:
getDomainDashboard(), getSyncStatus()) — would throw an unhandled exception, causing Next.js to return a 500 with the generic error boundary.
Why the stats page worked
The/stats page wraps its data fetching in try/catch and gracefully degrades:
The fix
- Added try/catch to every insights page — each page now gracefully handles data fetch failures, rendering an error alert instead of crashing.
- Created
error.tsxfor the insights route segment — a dedicated error boundary that catches any uncaught errors within the insights layout and provides retry/home navigation. - Shared error UI components —
InsightsErrorAlertprovides consistent error presentation across all pages.
Design Overhaul
What was wrong
The insights section used a completely generic design:bg-gray-50 dark:bg-gray-900backgrounds (light-mode-first)- Plain white
Cardcomponents with no visual hierarchy - No gradient accents, no glassmorphism, no brand colors
- Generic sidebar with plain text links (no icons, no hover states)
- Top nav used basic white background with default border styling
- Landing page: Space/satellite theme with animated starfield canvas, gradient text (
from-sky-400 to-cyan-400), glassmorphic cards (backdrop-blur-md), cyan/blue accent colors - SO1 Console: Mars “Hab Visor” aesthetic with deep navy backgrounds (
#0A0E27), electric blue accents (#3B82F6), glassmorphism panels, CRT/terminal typography - Atlas docs: Mars red (
#CD5C5C) primary, forced dark mode, gradient code block headers
The redesign
Layout (layout.tsx):
- Deep space background (
#080c1a) with ambient gradient orbs (blue/cyan/indigo) - Top nav: Semi-transparent with
backdrop-blur-xl, gradient “Insights” badge - Sidebar: Icons from Lucide for each nav item, hover states with
bg-white/[0.04]and cyan icon color transitions - Monospace email display for system-like feel
InsightStat):
- Glassmorphic gradient backgrounds (
from-slate-900/80 via-slate-800/60 to-slate-900/80) - Color-coded accent borders (cyan, emerald, amber, red, blue, purple)
- Hover elevation (
-translate-y-0.5) with colored shadows - Uppercase tracking-wider labels matching SO1 console typography
- Dark tooltip styling (
#1e293bbackground, white/10 border) - Grid lines at
rgba(255,255,255,0.04)for minimal interference - Donut chart variant for CI status (inner radius for modern feel)
- Axis ticks in
#64748b/#94a3b8for readability on dark
- Shared
GlassPanelwrapper for all table/chart containers - Consistent
border-white/[0.06]with gradient background andbackdrop-blur-md
- Insights-specific
error.tsxwith styled retry/home buttons - Cyan-accent retry button, slate-accent home button
- Error ID and digest display in slate-800 code block
Shared UI Component Library
Createdsrc/modules/insights/components/insights-ui.tsx with:
| Component | Purpose |
|---|---|
InsightsPageHeader | Gradient title, description, optional export button |
InsightStat | Glassmorphic stat card with accent color system |
GlassPanel | Container wrapper for tables/charts/dashboards |
InsightsErrorAlert | Consistent error alert with icon |
AlertBanner | Severity-aware alert banner (critical/warn/info) |
InsightBadge | Inline status badge with color variants |
SectionHeading | Sub-section title with optional description |
DeptTag | Department tag chip for workforce page |
Files Changed
family-hub
src/app/insights/layout.tsx— Complete redesign with space aestheticsrc/app/insights/page.tsx— Error handling + shared UI componentssrc/app/insights/error.tsx— New error boundarysrc/app/insights/domains/page.tsx— Error handling + redesignsrc/app/insights/github/page.tsx— Error handling + redesignsrc/app/insights/contributors/page.tsx— Error handling + redesignsrc/app/insights/analytics/page.tsx— Error handling + redesignsrc/app/insights/security/page.tsx— Error handling + redesignsrc/app/insights/activity/page.tsx— Error handling + redesignsrc/app/insights/governance/page.tsx— Error handling + redesignsrc/app/insights/workforce/page.tsx— Error handling + redesignsrc/modules/insights/components/insights-ui.tsx— New shared UI librarysrc/modules/insights/components/overview-charts.tsx— Dark theme chartssrc/modules/insights/components/export-button.tsx— Dark theme button
Impact
- Availability: The 500 error is resolved — insights now degrades gracefully.
- Brand consistency: Insights now matches the Devarno/SO1 design language.
- Maintainability: Shared UI component library reduces duplication across 9 pages.
- User experience: Premium feel with glassmorphism, color-coded accents, and smooth hover interactions.
Campaign Trails
- Design system unification: The
insights-ui.tsxpattern could be promoted to a shared design library for all family-hub authenticated pages (stats, admin, settings). - Global error handling: Consider adding try/catch + graceful degradation to all server component pages in family-hub, not just insights.
- Dark mode first: Family-hub should default to dark mode to match the landing page and SO1 console — currently uses system preference.