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

fix: guard zero division in charts, hoist maxHour, fix workspace override on resume

Adam Eivy9c44ff2ec232
diff --git a/client/src/pages/RunnerPage.jsx b/client/src/pages/RunnerPage.jsx
index 43880cffd1..049e9a1c86 100644
--- a/client/src/pages/RunnerPage.jsx
+++ b/client/src/pages/RunnerPage.jsx
@@ -65,13 +65,18 @@ export function RunnerPage() {
// Filter out PortOS Autofixer (it's part of PortOS project)
const filteredApps = appsData.filter(a => a.id !== 'portos-autofixer');
setApps(filteredApps);
- // Set PortOS as default workspace (exact name match)
- const portosApp = filteredApps.find(a => a.name === 'PortOS');
- if (portosApp) {
- setSelectedAppId(portosApp.id);
- } else if (filteredApps.length > 0) {
- setSelectedAppId(filteredApps[0].id);
- }
+ // Set workspace: prefer continuation context, then PortOS, then first app
+ setSelectedAppId(prev => {
+ if (prev) return prev;
+ const continueWorkspacePath = location.state?.continueFrom?.workspacePath;
+ if (continueWorkspacePath) {
+ const continueApp = filteredApps.find(a => a.repoPath === continueWorkspacePath);
+ if (continueApp) return continueApp.id;
+ }
+ const portosApp = filteredApps.find(a => a.name === 'PortOS');
+ if (portosApp) return portosApp.id;
+ return filteredApps.length > 0 ? filteredApps[0].id : prev;
+ });
const allProviders = providersRes.providers || [];
const enabledProviders = allProviders.filter(p => p.enabled);
setProviders(enabledProviders);
diff --git a/client/src/pages/UsagePage.jsx b/client/src/pages/UsagePage.jsx
index 992e09eed0..3132b4f4a3 100644
--- a/client/src/pages/UsagePage.jsx
+++ b/client/src/pages/UsagePage.jsx
@@ -33,7 +33,7 @@ export function UsagePage() {
return <div className="text-center py-8 text-gray-500">No usage data available</div>;
}
- const maxActivity = Math.max(...(usage.last7Days?.map(d => d.sessions) || [1]));
+ const maxActivity = Math.max(1, ...(usage.last7Days?.map(d => d.sessions) || []));
return (
<div className="space-y-6">
@@ -85,18 +85,18 @@ export function UsagePage() {
<div className="bg-port-card border border-port-border rounded-xl p-3 sm:p-4">
<h3 className="text-sm font-medium text-gray-400 mb-3 sm:mb-4">Hourly Distribution</h3>
<div className="flex items-end gap-0.5 h-24 sm:h-32">
- {usage.hourlyActivity?.map((count, hour) => {
- const maxHour = Math.max(...usage.hourlyActivity);
- return (
+ {(() => {
+ const maxHour = Math.max(1, ...(usage.hourlyActivity || []));
+ return usage.hourlyActivity?.map((count, hour) => (
<div key={hour} className="flex-1 flex flex-col items-center">
<div
className="w-full bg-port-accent/40 rounded-t"
- style={{ height: `${(count / (maxHour || 1)) * 100}%`, minHeight: count > 0 ? 2 : 0 }}
+ style={{ height: `${(count / maxHour) * 100}%`, minHeight: count > 0 ? 2 : 0 }}
title={`${hour}:00 - ${count} sessions`}
/>
</div>
- );
- })}
+ ));
+ })()}
</div>
<div className="flex justify-between text-[10px] sm:text-xs text-gray-500 mt-1 sm:mt-2">
<span>12am</span>