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

1.4 KB
Raw Blame
export default function QuickStatsWidget({ dashboardState }) {
  const { appStats } = dashboardState;
  return (
    <div className="@container bg-port-card border border-port-border rounded-xl p-4 h-full">
      <h3 className="text-sm font-semibold text-white mb-3">Quick Stats</h3>
      <div className="grid grid-cols-2 @lg:grid-cols-4 gap-2">
        <StatCard label="Total Apps" value={appStats.total} icon="📦" />
        <StatCard label="Online" value={appStats.online} icon="🟢" />
        <StatCard label="Stopped" value={appStats.stopped} icon="🟡" />
        <StatCard label="Offline" value={appStats.notStarted} icon="⚪" />
        {/* Only when a PM2 read failed — status unavailable, not confidently offline. */}
        {appStats.unknown > 0 && (
          <StatCard label="Status N/A" value={appStats.unknown} icon="⚠️" />
        )}
      </div>
    </div>
  );
}

function StatCard({ label, value, icon }) {
  return (
    <div className="bg-port-bg border border-port-border rounded-lg p-3" role="group" aria-label={`${label}: ${value}`}>
      <div className="flex min-w-0 items-start gap-2 mb-1">
        <span aria-hidden="true" className="shrink-0 text-base leading-tight">{icon}</span>
        <span className="min-w-0 text-xs leading-tight text-gray-500">{label}</span>
      </div>
      <div className="text-xl font-bold text-white">{value}</div>
    </div>
  );
}