One elapsed-time notation: ago() reads dur's units app-wide, health runs cell widened

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
2026-10-15 17:10:36 +02:00
co-authored by Claude Opus 5.5
parent 59f069022f
commit 70af80f6f6
10 changed files with 22 additions and 41 deletions
+2 -8
View File
@@ -23,6 +23,7 @@ import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import useAuth from "@/hooks/useAuth"
import useCustomToast from "@/hooks/useCustomToast"
import { ago } from "@/lib/utils"
import { handleError } from "@/utils"
export const Route = createFileRoute("/_layout/workers")({
@@ -40,13 +41,6 @@ const emptyFlavor = { name: "", cpus: 1, gpus: 0, ram: 2048, description: "" }
/** Fresh enough to watch a node take a machine, slow enough to be free. */
const REFETCH_MS = 5000
function ago(seconds: number): string {
const since = Date.now() / 1000 - seconds
if (since < 60) return `${Math.max(0, Math.round(since))}s ago`
if (since < 3600) return `${Math.round(since / 60)}m ago`
return `${Math.round(since / 3600)}h ago`
}
type Level = { total: number; free: number }
/** "cpu 2/18" — what is in use, out of what there is. */
@@ -203,7 +197,7 @@ function Attached() {
{worker.protocol}
</span>
<span>
{worker.behind ? "refused" : "seen"} {ago(worker.last_seen ?? 0)}
{worker.behind ? "refused" : "seen"} {ago(worker.last_seen)}
</span>
</span>
</div>