import { useState } from "react"; import { compactInputClass } from "~/ui/Field"; import { adminResumeHosting, adminSuspendHosting } from "~/fns/admin"; import type { getAdminOverview } from "~/fns/admin"; import { useAction } from "~/hooks/use-action"; import { Button } from "~/ui/Button"; import { Callout, ErrorBanner } from "~/ui/Callout"; import { EmptyState } from "~/ui/EmptyState"; import { Panel } from "~/ui/Panel"; import { RelativeTime } from "~/ui/RelativeTime"; import { TextLink } from "~/ui/TextLink"; type Hosting = Awaited>["hosting"]; /** Suspend or resume every Site of an account, and see whether the daily ceiling tripped. */ export function HostingControls({ hosting }: { hosting: Hosting }) { const [name, setName] = useState(""); const suspend = useAction(adminSuspendHosting); const resume = useAction(adminResumeHosting); return (
{hosting.ceilingHit && ( Dynamic sites hit today's platform ceiling and answer 503 until midnight UTC. )}
{ event.preventDefault(); if (!name.trim() || !window.confirm(`Stop every site of ${name}?`)) return; await suspend.run({ data: { name: name.trim() } }); setName(""); }} > setName(event.target.value)} />
{hosting.suspensions.length === 0 ? ( ) : (
    {hosting.suspensions.map((row) => (
  • {row.name} suspended
  • ))}
)}
); }