import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { api, type CurrentUser, type RobotAccount } from "../api/client"; import ReadNowButton from "../components/ReadNowButton"; import EmptyState from "../components/EmptyState"; import TimeAgo from "../components/TimeAgo"; import { BlockSkeleton } from "../components/Skeleton"; import { ErrorNotice } from "../components/Notice"; import { readableError } from "../utils/errors"; import PageIntro from "../components/PageIntro"; function Badge({ a }: { a: RobotAccount }) { if (!a.enabled) return Off; if (!a.state) return Not read yet; if (!a.fresh) return Can’t be read; if (a.problems.some((x) => x.severity === "critical")) return Needs a look; if (a.problems.length > 0) return Needs a look; return In order; } function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: string | null; warn?: boolean }) { return (
| Server | Product | Address | Traffic | Status | Rescue | Paid |
|---|---|---|---|---|---|---|
|
{v.name}
#{v.number}
|
{v.product ?? "—"}
{v.dc && {v.dc} }
|
{v.ip ? {v.ip} : "—"}
{v.ipv6 && (
{v.ipv6}
|
{v.traffic ?? "—"} | {v.status === "ready" ? ready : {v.status}} |
{v.rescue === null ? (
—
) : v.rescue ? (
<>
on
{v.rescueSince && (
since
)}
>
) : (
off
)}
|
|
| Storage box | Product | Location | Linked to | State | Paid |
|---|---|---|---|---|---|
|
{b.name}
{b.login ?? `#${b.id}`}
|
{b.product ?? "—"} | {b.location ?? "—"} | {b.linkedServer !== null ? (s.servers.find((v) => v.number === b.linkedServer)?.name ?? `server ${b.linkedServer}`) : "—"} | {b.locked ? locked : open} |
|