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

refactor(micrographics): simplify per /simplify review

Adam Eivy29d8bc6234f2
diff --git a/client/src/components/StatusBadge.jsx b/client/src/components/StatusBadge.jsx
index e23c22a528..1f57c96dee 100644
--- a/client/src/components/StatusBadge.jsx
+++ b/client/src/components/StatusBadge.jsx
@@ -45,10 +45,8 @@ const statusConfig = {
},
};
-// `glyph` is opt-in. Pass `glyph` (boolean true) for the state-appropriate
-// micrographic, or pass a variant string ('orbit', 'signal', etc.) to override.
-// Default behavior (no prop) is unchanged: existing callers keep their
-// pulsing dot.
+// `glyph`: false (default) keeps the legacy dot; true uses the per-status
+// micrographic; a string overrides the variant; an object overrides any field.
export default function StatusBadge({ status, size = 'md', glyph = false }) {
const config = statusConfig[status] || statusConfig.unknown;
@@ -60,9 +58,6 @@ export default function StatusBadge({ status, size = 'md', glyph = false }) {
const glyphSize = size === 'lg' ? 14 : size === 'sm' ? 10 : 12;
- // Resolve glyph spec — boolean true uses the per-status default; a
- // string lets the caller pick a specific variant; an object takes
- // precedence over everything for fine control.
let glyphSpec = null;
if (glyph === true) {
glyphSpec = config.glyph;
diff --git a/client/src/components/SystemHealthWidget.jsx b/client/src/components/SystemHealthWidget.jsx
index cd934577cf..50cf923134 100644
--- a/client/src/components/SystemHealthWidget.jsx
+++ b/client/src/components/SystemHealthWidget.jsx
@@ -63,31 +63,24 @@ const SystemHealthWidget = memo(function SystemHealthWidget() {
const healthStyle = getHealthStyle();
const HealthIcon = healthStyle.icon;
- // Map per-service load values into a 5×5 matrix of dot intensities. The
- // first row carries the four load metrics (memory, CPU, processes, apps)
- // and the optional disk reading; subsequent rows fade outward to give
- // the eye an at-a-glance "core hot, edges cool" reading. The numbers
- // are deliberately small — this is decorative chrome that *reflects*
- // real state, not a chart in its own right.
+ // Decorative chrome that reflects real state — top row reads as a HUD
+ // readout (memory/cpu/proc/apps/disk), rows below fade so the eye
+ // doesn't read it as a chart.
+ const memPct = system?.memory?.usagePercent;
+ const cpuPct = system?.cpu?.usagePercent;
+ const diskPct = system?.disk?.usagePercent;
+ const procOnline = processes?.online;
+ const procTotal = processes?.total;
+ const appOnline = apps?.online;
+ const appTotal = apps?.total;
const matrixIntensity = useMemo(() => {
const cells = new Array(25).fill(0.18);
const norm = (pct) => Math.max(0.18, Math.min(1, (pct ?? 0) / 100));
- const memBoost = norm(system?.memory?.usagePercent);
- const cpuBoost = norm(system?.cpu?.usagePercent);
- const procBoost = processes?.total
- ? Math.max(0.25, processes.online / processes.total)
- : 0.25;
- const appBoost = apps?.total
- ? Math.max(0.25, apps.online / apps.total)
- : 0.25;
- const diskBoost = norm(system?.disk?.usagePercent);
- // Top row = the five live channels at full brightness.
- cells[0] = memBoost;
- cells[1] = cpuBoost;
- cells[2] = procBoost;
- cells[3] = appBoost;
- cells[4] = diskBoost;
- // Subsequent rows fall off so the eye sees a top-row "readout".
+ cells[0] = norm(memPct);
+ cells[1] = norm(cpuPct);
+ cells[2] = procTotal ? Math.max(0.25, procOnline / procTotal) : 0.25;
+ cells[3] = appTotal ? Math.max(0.25, appOnline / appTotal) : 0.25;
+ cells[4] = norm(diskPct);
for (let row = 1; row < 5; row++) {
const decay = 1 - row * 0.18;
for (let col = 0; col < 5; col++) {
@@ -95,7 +88,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget() {
}
}
return cells;
- }, [system, processes, apps]);
+ }, [memPct, cpuPct, diskPct, procOnline, procTotal, appOnline, appTotal]);
// Get color for usage percentage
const getUsageColor = (percent) => {
diff --git a/client/src/components/cos/tabs/TasksTab.jsx b/client/src/components/cos/tabs/TasksTab.jsx
index 216529f16a..b5ebfcbc64 100644
--- a/client/src/components/cos/tabs/TasksTab.jsx
+++ b/client/src/components/cos/tabs/TasksTab.jsx
@@ -272,7 +272,8 @@ export default function TasksTab({ tasks, onRefresh, providers, apps }) {
{pendingSystemTasks.length > 0 && (
<div className="bg-port-card border border-port-border rounded-lg overflow-hidden">
<div className="px-3 py-2 bg-yellow-500/10 border-b border-port-border flex items-center justify-between">
- <span className="text-sm font-medium text-yellow-500">
+ <span className="text-sm font-medium text-yellow-500 flex items-center gap-2">
+ <SectionGlyph status="pending" />
Pending ({pendingSystemTasks.length})
</span>
</div>
diff --git a/client/src/components/micrographics/MicroGlyph.jsx b/client/src/components/micrographics/MicroGlyph.jsx
index 4082b3e50d..01b056a069 100644
--- a/client/src/components/micrographics/MicroGlyph.jsx
+++ b/client/src/components/micrographics/MicroGlyph.jsx
@@ -1,4 +1,4 @@
-import { useId } from 'react';
+import { useId, memo } from 'react';
import './micrographics.css';
const polarDots = (count, radius) =>
@@ -15,6 +15,13 @@ const MATRIX_DOTS = Array.from({ length: 25 }, (_, i) => ({
index: i,
}));
+const SIGNAL_BARS = [
+ { x: 19, baseY: 25, baseH: 14, mod: 1 },
+ { x: 26, baseY: 17, baseH: 30, mod: 2 },
+ { x: 33, baseY: 11, baseH: 42, mod: 3 },
+ { x: 40, baseY: 20, baseH: 24, mod: 4 },
+];
+
function OrbitGlyph() {
return (
<>
@@ -33,21 +40,13 @@ function OrbitGlyph() {
);
}
-// `level` (0–1) drives bar heights when provided so the signal glyph can be
-// data-bound (e.g. live audio level) instead of always animating.
function SignalGlyph({ level }) {
- const bars = [
- { x: 19, baseY: 25, baseH: 14, mod: 1 },
- { x: 26, baseY: 17, baseH: 30, mod: 2 },
- { x: 33, baseY: 11, baseH: 42, mod: 3 },
- { x: 40, baseY: 20, baseH: 24, mod: 4 },
- ];
const driven = typeof level === 'number';
return (
<>
<path className="port-microglyph__line port-microglyph__muted" d="M9 32h8m30 0h8" />
<g>
- {bars.map((b, i) => {
+ {SIGNAL_BARS.map((b, i) => {
if (driven) {
const k = Math.max(0, Math.min(1, level)) * (0.5 + (i % 3) * 0.25);
const h = Math.max(4, b.baseH * (0.4 + k * 0.6));
@@ -108,8 +107,6 @@ function NodeGlyph() {
);
}
-// `intensity` is an array of per-cell opacities (0–1, length 25). Lets the
-// caller bind dot brightness to per-service health values.
function MatrixGlyph({ intensity }) {
return (
<>
@@ -261,9 +258,9 @@ const GLYPHS = {
'bracket-pair': BracketPairGlyph,
};
-const VALID_STATES = new Set(['idle', 'active', 'success', 'warn', 'warning', 'error', 'accent']);
+const VALID_STATES = new Set(['idle', 'active', 'success', 'warn', 'error', 'accent', 'muted']);
-export default function MicroGlyph({
+function MicroGlyph({
variant = 'orbit',
size = 16,
animated = false,
@@ -304,4 +301,6 @@ export default function MicroGlyph({
);
}
+export default memo(MicroGlyph);
+
export const GLYPH_VARIANTS = Object.keys(GLYPHS);
diff --git a/client/src/components/micrographics/MicroLoader.jsx b/client/src/components/micrographics/MicroLoader.jsx
deleted file mode 100644
index f861a99033..0000000000
--- a/client/src/components/micrographics/MicroLoader.jsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import MicroGlyph from './MicroGlyph';
-import './micrographics.css';
-
-// Context-aware micrographic loader. Used in a small set of empty states
-// (Dashboard / Apps grid / CoS empty list); BrailleSpinner remains the
-// default loader everywhere else.
-export default function MicroLoader({
- label,
- module = 'LOAD',
- status = 'WAITING',
- glyph = 'orbit',
- block = false,
- size = 18,
- className = '',
-}) {
- const classes = [
- 'port-microloader',
- block ? 'port-microloader--block' : '',
- className,
- ].filter(Boolean).join(' ');
-
- return (
- <div className={classes} role="status" aria-live="polite">
- <MicroGlyph variant={glyph} size={size} animated state="accent" title={label || `${module} ${status}`} />
- <span className="port-microloader__label">
- <span style={{ opacity: 0.85 }}>{module}</span>
- <span style={{ opacity: 0.45, margin: '0 0.35em' }}>//</span>
- <span style={{ fontWeight: 600 }}>{status}</span>
- </span>
- {label && (
- <span className="port-microloader__label" style={{ opacity: 0.75, fontFamily: 'var(--port-font-mono)', textTransform: 'none', letterSpacing: 0 }}>
- {label}
- </span>
- )}
- </div>
- );
-}
diff --git a/client/src/components/micrographics/SchematicLabel.jsx b/client/src/components/micrographics/SchematicLabel.jsx
index 0f1179bc49..ea1abe59a6 100644
--- a/client/src/components/micrographics/SchematicLabel.jsx
+++ b/client/src/components/micrographics/SchematicLabel.jsx
@@ -31,6 +31,7 @@ export default function SchematicLabel({
const toneClass = tone ? `port-schematic-label--${tone}` : '';
const classes = [
'port-schematic-label',
+ 'font-pixel',
variant === 'tab' ? 'port-schematic-label--tab' : '',
toneClass,
className,
@@ -54,7 +55,7 @@ export default function SchematicLabel({
variant={glyph}
size={11}
animated={shouldAnimate}
- state={tone === 'muted' ? undefined : tone}
+ state={tone}
/>
)}
</span>
diff --git a/client/src/components/micrographics/index.js b/client/src/components/micrographics/index.js
index e49797baee..db02c35678 100644
--- a/client/src/components/micrographics/index.js
+++ b/client/src/components/micrographics/index.js
@@ -1,3 +1,2 @@
export { default as MicroGlyph, GLYPH_VARIANTS } from './MicroGlyph';
export { default as SchematicLabel } from './SchematicLabel';
-export { default as MicroLoader } from './MicroLoader';
diff --git a/client/src/components/micrographics/micrographics.css b/client/src/components/micrographics/micrographics.css
index 879a7ce1e1..431b608b84 100644
--- a/client/src/components/micrographics/micrographics.css
+++ b/client/src/components/micrographics/micrographics.css
@@ -1,6 +1,9 @@
/* PortOS micrographics — small SVG glyphs + schematic HUD labels.
All keyframes live inside the prefers-reduced-motion guard so users who
- request reduced motion get a fully static set of glyphs. */
+ request reduced motion get a fully static set of glyphs.
+ `content-visibility: auto` lets the browser skip rendering + animating
+ off-screen instances, so a dashboard full of widgets doesn't burn CPU
+ on glyphs the user can't see. */
.port-microglyph {
display: inline-block;
@@ -8,13 +11,15 @@
overflow: visible;
color: currentColor;
vertical-align: -0.15em;
+ content-visibility: auto;
+ contain-intrinsic-size: 16px 16px;
}
.port-microglyph--success { color: rgb(var(--port-success)); }
-.port-microglyph--warn,
-.port-microglyph--warning { color: rgb(var(--port-warning)); }
+.port-microglyph--warn { color: rgb(var(--port-warning)); }
.port-microglyph--error { color: rgb(var(--port-error)); }
.port-microglyph--accent { color: rgb(var(--port-accent)); }
+.port-microglyph--muted { color: rgb(var(--port-border)); opacity: 0.85; }
.port-microglyph__line {
fill: none;
@@ -37,12 +42,12 @@
transform-origin: 32px 32px;
}
-/* Schematic label — type-paired chrome, "MODULE.04 // ACTIVE ●". */
+/* SchematicLabel uses .font-pixel for typography (defined in index.css);
+ only layout + sizing live here. */
.port-schematic-label {
display: inline-flex;
align-items: center;
gap: 0.45rem;
- font-family: 'GeistPixelSquare', 'Courier New', monospace;
font-size: 0.68rem;
letter-spacing: 0.08em;
text-transform: uppercase;
@@ -51,11 +56,6 @@
white-space: nowrap;
}
-.port-schematic-label__bracket {
- opacity: 0.55;
- font-weight: normal;
-}
-
.port-schematic-label__module {
color: currentColor;
opacity: 0.85;
@@ -89,43 +89,14 @@
pointer-events: none;
}
-/* Microloader — context-aware loading shell. */
-.port-microloader {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- gap: 0.5rem;
- line-height: 1;
- white-space: nowrap;
- color: rgb(var(--port-accent));
-}
-
-.port-microloader__label {
- font-family: 'GeistPixelSquare', 'Courier New', monospace;
- font-size: 0.72rem;
- letter-spacing: 0.08em;
- text-transform: uppercase;
- opacity: 0.85;
-}
-
-.port-microloader--block {
- flex-direction: column;
- gap: 0.55rem;
- padding: 1.1rem 1.4rem;
- border: 1px dashed rgb(var(--port-border));
- border-radius: 0.75rem;
- background: rgb(var(--port-card) / 0.5);
-}
-
-/* Animations — only run when motion is allowed. */
@media (prefers-reduced-motion: no-preference) {
.port-microglyph--animated .port-microglyph__orbit {
- animation: port-micro-spin 4.8s linear infinite;
+ animation: spin 4.8s linear infinite;
transform-origin: 32px 32px;
}
.port-microglyph--animated .port-microglyph__counter-orbit {
- animation: port-micro-spin 7s linear infinite reverse;
+ animation: spin 7s linear infinite reverse;
transform-origin: 32px 32px;
}
@@ -172,10 +143,6 @@
}
}
-@keyframes port-micro-spin {
- to { transform: rotate(360deg); }
-}
-
@keyframes port-micro-breathe {
0%, 100% { opacity: 0.72; transform: scale(0.96); }
50% { opacity: 1; transform: scale(1.04); }