feat(web): dashboard, wizard, server detail, WS build stream, install snippets
This commit is contained in:
283
apps/web/app/(dashboard)/servers/[id]/page.tsx
Normal file
283
apps/web/app/(dashboard)/servers/[id]/page.tsx
Normal file
@@ -0,0 +1,283 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { apiFetch } from '@/lib/api';
|
||||
import { StatusPill } from '@/components/status-pill';
|
||||
import { CodeBlock } from '@/components/code-block';
|
||||
import { InstallSnippets } from '@/components/install-snippets';
|
||||
import { StreamingLogs } from '@/components/streaming-logs';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Textarea, Label } from '@/components/input';
|
||||
import { cn } from '@/lib/cn';
|
||||
import type { ToolSpec } from '@bmm/types';
|
||||
|
||||
interface ServerDetail {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
status: string;
|
||||
publicUrl: string | null;
|
||||
toolsSchema: ToolSpec[] | null;
|
||||
currentVersion: number;
|
||||
oauthEnabled: boolean;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
interface BuildSummary {
|
||||
id: string;
|
||||
version: number;
|
||||
status: string;
|
||||
startedAt: string | null;
|
||||
finishedAt: string | null;
|
||||
errorMessage: string | null;
|
||||
}
|
||||
|
||||
type Tab = 'overview' | 'tools' | 'logs' | 'metrics' | 'secrets' | 'iterate';
|
||||
|
||||
export default function ServerDetailPage() {
|
||||
const params = useParams<{ id: string }>();
|
||||
const [server, setServer] = useState<ServerDetail | null>(null);
|
||||
const [builds, setBuilds] = useState<BuildSummary[]>([]);
|
||||
const [tab, setTab] = useState<Tab>('overview');
|
||||
const [iteratePrompt, setIteratePrompt] = useState('');
|
||||
const [latestBuildId, setLatestBuildId] = useState<string | null>(null);
|
||||
|
||||
async function refresh() {
|
||||
const r = await apiFetch<{ server: ServerDetail; builds: BuildSummary[] }>(
|
||||
`/v1/servers/${params.id}`,
|
||||
);
|
||||
setServer(r.server);
|
||||
setBuilds(r.builds);
|
||||
if (r.builds.length > 0 && !latestBuildId) {
|
||||
setLatestBuildId(r.builds[0]!.id);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
refresh();
|
||||
const t = setInterval(refresh, 4000);
|
||||
return () => clearInterval(t);
|
||||
}, [params.id]);
|
||||
|
||||
async function onIterate() {
|
||||
if (!server) return;
|
||||
const res = await apiFetch<{ build: { id: string } }>(
|
||||
`/v1/servers/${server.id}/iterate`,
|
||||
{ method: 'POST', body: JSON.stringify({ prompt: iteratePrompt, secrets: {} }) },
|
||||
);
|
||||
setLatestBuildId(res.build.id);
|
||||
setIteratePrompt('');
|
||||
setTab('logs');
|
||||
}
|
||||
|
||||
if (!server) {
|
||||
return (
|
||||
<div className="mx-auto max-w-7xl px-6 py-8 text-[12.5px] text-[--color-fg-muted]">Loading…</div>
|
||||
);
|
||||
}
|
||||
|
||||
const tabs: { id: Tab; label: string }[] = [
|
||||
{ id: 'overview', label: 'Overview' },
|
||||
{ id: 'tools', label: 'Tools' },
|
||||
{ id: 'logs', label: 'Logs' },
|
||||
{ id: 'metrics', label: 'Metrics' },
|
||||
{ id: 'secrets', label: 'Secrets' },
|
||||
{ id: 'iterate', label: 'Iterate' },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-7xl px-6 py-8">
|
||||
<div className="flex items-baseline justify-between gap-4">
|
||||
<div>
|
||||
<div className="flex items-center gap-2.5">
|
||||
<h1 className="text-[22px] font-semibold tracking-tight">{server.name}</h1>
|
||||
<StatusPill status={server.status as never} />
|
||||
</div>
|
||||
<div className="mt-1 flex items-center gap-3 text-[12.5px] text-[--color-fg-muted]">
|
||||
<span className="mono">{server.slug}</span>
|
||||
<span>·</span>
|
||||
<span>v{server.currentVersion}</span>
|
||||
{server.publicUrl && (
|
||||
<>
|
||||
<span>·</span>
|
||||
<a
|
||||
href={`${server.publicUrl}/mcp`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="mono hover:text-[--color-fg]"
|
||||
>
|
||||
{server.publicUrl}/mcp
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 flex gap-1 border-b border-[--color-border]">
|
||||
{tabs.map((t) => (
|
||||
<button
|
||||
key={t.id}
|
||||
type="button"
|
||||
onClick={() => setTab(t.id)}
|
||||
className={cn(
|
||||
'relative px-3 py-2 text-[12.5px] transition-colors duration-200 ease-out',
|
||||
tab === t.id
|
||||
? 'text-[--color-fg]'
|
||||
: 'text-[--color-fg-muted] hover:text-[--color-fg]',
|
||||
)}
|
||||
>
|
||||
{t.label}
|
||||
{tab === t.id && (
|
||||
<span className="absolute inset-x-0 -bottom-px h-px bg-[--color-fg]" />
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-6">
|
||||
{tab === 'overview' && (
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<div className="panel p-4">
|
||||
<div className="text-[11px] uppercase tracking-wider text-[--color-fg-subtle]">
|
||||
Endpoint
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
{server.publicUrl ? (
|
||||
<CodeBlock code={`${server.publicUrl}/mcp`} />
|
||||
) : (
|
||||
<div className="text-[12.5px] text-[--color-fg-muted]">Not deployed yet.</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-4 flex items-center gap-2 text-[12px] text-[--color-fg-muted]">
|
||||
<span className="size-1.5 rounded-full bg-emerald-400" />
|
||||
OAuth 2.1 enforced · Streamable HTTP
|
||||
</div>
|
||||
</div>
|
||||
<div className="panel p-4">
|
||||
<div className="text-[11px] uppercase tracking-wider text-[--color-fg-subtle]">
|
||||
Builds
|
||||
</div>
|
||||
<div className="mt-3 space-y-2">
|
||||
{builds.slice(0, 5).map((b) => (
|
||||
<div key={b.id} className="flex items-center justify-between text-[12.5px]">
|
||||
<span className="mono text-[--color-fg-muted]">v{b.version}</span>
|
||||
<StatusPill status={b.status as never} />
|
||||
<span className="mono text-[11px] text-[--color-fg-subtle]">
|
||||
{b.startedAt ? new Date(b.startedAt).toLocaleString() : '—'}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{server.publicUrl && (
|
||||
<div className="panel p-4 md:col-span-2">
|
||||
<div className="text-[11px] uppercase tracking-wider text-[--color-fg-subtle]">
|
||||
Install
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
<InstallSnippets
|
||||
input={{ name: server.name, slug: server.slug, publicUrl: server.publicUrl }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === 'tools' && (
|
||||
<div className="panel p-4">
|
||||
{!server.toolsSchema || server.toolsSchema.length === 0 ? (
|
||||
<div className="text-[12.5px] text-[--color-fg-muted]">No tools yet.</div>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{server.toolsSchema.map((tool) => (
|
||||
<div key={tool.name} className="rounded-md border border-[--color-border] p-3">
|
||||
<div className="flex items-baseline gap-2">
|
||||
<span className="mono text-[13px] font-semibold">{tool.name}</span>
|
||||
</div>
|
||||
<p className="mt-1 text-[12.5px] text-[--color-fg-muted]">{tool.description}</p>
|
||||
{Object.keys(tool.inputSchema ?? {}).length > 0 && (
|
||||
<div className="mt-2">
|
||||
<CodeBlock
|
||||
label="input schema"
|
||||
code={JSON.stringify(tool.inputSchema, null, 2)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === 'logs' && (
|
||||
latestBuildId ? (
|
||||
<StreamingLogs buildId={latestBuildId} />
|
||||
) : (
|
||||
<div className="panel p-4 text-[12.5px] text-[--color-fg-muted]">
|
||||
No builds to stream yet.
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
|
||||
{tab === 'metrics' && (
|
||||
<div className="panel p-4">
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
<Metric label="Calls (24h)" value="0" />
|
||||
<Metric label="P95 latency" value="—" />
|
||||
<Metric label="Error rate" value="0%" />
|
||||
</div>
|
||||
<p className="mt-4 text-[12px] text-[--color-fg-subtle]">
|
||||
Live metrics begin streaming after the first tool call.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === 'secrets' && (
|
||||
<div className="panel p-4 text-[12.5px] text-[--color-fg-muted]">
|
||||
Secrets are AES-256-GCM encrypted at rest. They are injected as environment variables
|
||||
into your container and are never echoed back. Use the wizard or CLI to rotate them.
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === 'iterate' && (
|
||||
<div className="panel p-4">
|
||||
<Label hint="A new build will be queued; rolling deploy keeps current version live until ready.">
|
||||
Extend the server
|
||||
</Label>
|
||||
<Textarea
|
||||
rows={4}
|
||||
className="mt-2"
|
||||
value={iteratePrompt}
|
||||
onChange={(e) => setIteratePrompt(e.target.value)}
|
||||
placeholder="Add a tool: create_page that POSTs to /v1/pages with title and body."
|
||||
/>
|
||||
<div className="mt-3 flex justify-end">
|
||||
<Button
|
||||
variant="primary"
|
||||
size="md"
|
||||
disabled={iteratePrompt.length < 10}
|
||||
onClick={onIterate}
|
||||
>
|
||||
Queue rebuild →
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Metric({ label, value }: { label: string; value: string }) {
|
||||
return (
|
||||
<div>
|
||||
<div className="text-[11px] uppercase tracking-wider text-[--color-fg-subtle]">{label}</div>
|
||||
<div className="mt-1 text-[22px] font-semibold tracking-tight">{value}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
243
apps/web/app/(dashboard)/servers/new/page.tsx
Normal file
243
apps/web/app/(dashboard)/servers/new/page.tsx
Normal file
@@ -0,0 +1,243 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { apiFetch } from '@/lib/api';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input, Label, Textarea } from '@/components/input';
|
||||
import { StreamingLogs } from '@/components/streaming-logs';
|
||||
import { InstallSnippets } from '@/components/install-snippets';
|
||||
import { CodeBlock } from '@/components/code-block';
|
||||
|
||||
const EXAMPLE_PROMPTS = [
|
||||
'Read-only Postgres reader for the users and orders tables at db.example.com',
|
||||
'Search and read pages from our Notion workspace via the Notion API',
|
||||
'Wrap our internal HTTP API at api.acme.com — endpoints /search and /lookup',
|
||||
'Stripe charges and customers (read-only)',
|
||||
];
|
||||
|
||||
type Step = 'prompt' | 'building' | 'done';
|
||||
|
||||
interface BuildResult {
|
||||
serverId: string;
|
||||
publicUrl: string | null;
|
||||
}
|
||||
|
||||
export default function NewServerPage() {
|
||||
const router = useRouter();
|
||||
const [step, setStep] = useState<Step>('prompt');
|
||||
const [name, setName] = useState('');
|
||||
const [slug, setSlug] = useState('');
|
||||
const [prompt, setPrompt] = useState('');
|
||||
const [secretRows, setSecretRows] = useState<{ key: string; value: string }[]>([{ key: '', value: '' }]);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [buildId, setBuildId] = useState<string | null>(null);
|
||||
const [serverId, setServerId] = useState<string | null>(null);
|
||||
const [result, setResult] = useState<BuildResult | null>(null);
|
||||
|
||||
const trySlug = (n: string) =>
|
||||
n.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 32);
|
||||
|
||||
async function submit() {
|
||||
setError(null);
|
||||
if (!name || !slug || prompt.length < 10) {
|
||||
setError('Name, slug and a prompt of at least 10 characters are required.');
|
||||
return;
|
||||
}
|
||||
const secrets: Record<string, string> = {};
|
||||
for (const row of secretRows) {
|
||||
if (row.key && row.value) secrets[row.key.trim()] = row.value;
|
||||
}
|
||||
try {
|
||||
const res = await apiFetch<{ server: { id: string }; build: { id: string } }>(
|
||||
'/v1/servers',
|
||||
{ method: 'POST', body: JSON.stringify({ name, slug, prompt, secrets }) },
|
||||
);
|
||||
setBuildId(res.build.id);
|
||||
setServerId(res.server.id);
|
||||
setStep('building');
|
||||
} catch (e) {
|
||||
const detail = (e as { detail?: { error?: string } }).detail;
|
||||
setError(detail?.error ?? (e as Error).message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-3xl px-6 py-8">
|
||||
<div className="flex items-baseline justify-between">
|
||||
<h1 className="text-[22px] font-semibold tracking-tight">New MCP server</h1>
|
||||
<div className="mono text-[11px] tracking-wider text-[--color-fg-subtle]">
|
||||
STEP {step === 'prompt' ? '1' : step === 'building' ? '2' : '3'} / 3
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{step === 'prompt' && (
|
||||
<div className="mt-7 space-y-5">
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="prompt">Describe your tool</Label>
|
||||
<Textarea
|
||||
id="prompt"
|
||||
rows={5}
|
||||
value={prompt}
|
||||
onChange={(e) => setPrompt(e.target.value)}
|
||||
placeholder="A sentence is enough. Mention APIs, secrets, scopes, expected tool names."
|
||||
/>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{EXAMPLE_PROMPTS.map((p) => (
|
||||
<button
|
||||
type="button"
|
||||
key={p}
|
||||
onClick={() => setPrompt(p)}
|
||||
className="rounded-full border border-[--color-border] bg-[--color-bg-subtle] px-2.5 py-1 text-[11.5px] text-[--color-fg-muted] transition-colors hover:border-[--color-border-strong] hover:text-[--color-fg]"
|
||||
>
|
||||
{p}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
<Input
|
||||
id="name"
|
||||
value={name}
|
||||
onChange={(e) => {
|
||||
setName(e.target.value);
|
||||
if (!slug || slug === trySlug(name)) setSlug(trySlug(e.target.value));
|
||||
}}
|
||||
placeholder="Notion Reader"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="slug" hint="subdomain / id">Slug</Label>
|
||||
<Input
|
||||
id="slug"
|
||||
value={slug}
|
||||
onChange={(e) => setSlug(trySlug(e.target.value))}
|
||||
placeholder="notion-reader"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label hint="environment variables, encrypted at rest">Secrets</Label>
|
||||
<div className="space-y-2">
|
||||
{secretRows.map((row, i) => (
|
||||
<div key={i} className="grid grid-cols-[1fr_1fr_auto] gap-2">
|
||||
<Input
|
||||
placeholder="NOTION_API_KEY"
|
||||
value={row.key}
|
||||
onChange={(e) => {
|
||||
const next = [...secretRows];
|
||||
next[i] = { key: e.target.value.toUpperCase(), value: row.value };
|
||||
setSecretRows(next);
|
||||
}}
|
||||
/>
|
||||
<Input
|
||||
placeholder="secret_xxx"
|
||||
type="password"
|
||||
value={row.value}
|
||||
onChange={(e) => {
|
||||
const next = [...secretRows];
|
||||
next[i] = { key: row.key, value: e.target.value };
|
||||
setSecretRows(next);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="md"
|
||||
onClick={() =>
|
||||
setSecretRows((rs) => (rs.length > 1 ? rs.filter((_, j) => j !== i) : rs))
|
||||
}
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setSecretRows((rs) => [...rs, { key: '', value: '' }])}
|
||||
>
|
||||
+ Add secret
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error && <p className="text-[12.5px] text-[--color-danger]">{error}</p>}
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="ghost" size="md" onClick={() => router.push('/servers')}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button variant="primary" size="md" onClick={submit}>
|
||||
Build server →
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{step === 'building' && buildId && (
|
||||
<div className="mt-7 space-y-4">
|
||||
<p className="text-[13px] text-[--color-fg-muted]">
|
||||
Building your server. Logs stream live over WebSocket from the generator.
|
||||
</p>
|
||||
<StreamingLogs
|
||||
buildId={buildId}
|
||||
onDone={(status, publicUrl) => {
|
||||
if (status === 'success') {
|
||||
setResult({ serverId: serverId!, publicUrl });
|
||||
setStep('done');
|
||||
} else {
|
||||
setError(`Build ${status}`);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{error && <p className="text-[12.5px] text-[--color-danger]">{error}</p>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{step === 'done' && result && (
|
||||
<div className="mt-7 space-y-6">
|
||||
<div className="panel p-4">
|
||||
<div className="flex items-baseline justify-between">
|
||||
<h2 className="text-[14px] font-semibold tracking-tight">Your server is live</h2>
|
||||
<span className="mono text-[11px] text-emerald-300">200 OK</span>
|
||||
</div>
|
||||
<p className="mt-1 text-[12.5px] text-[--color-fg-muted]">
|
||||
OAuth-protected Streamable HTTP endpoint:
|
||||
</p>
|
||||
<div className="mt-3">
|
||||
<CodeBlock code={`${result.publicUrl}/mcp`} label="endpoint" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{result.publicUrl && (
|
||||
<div>
|
||||
<h2 className="text-[14px] font-semibold tracking-tight">Install</h2>
|
||||
<p className="mt-1 text-[12.5px] text-[--color-fg-muted]">
|
||||
Drop this into your client. OAuth handshake runs automatically on first use.
|
||||
</p>
|
||||
<div className="mt-3">
|
||||
<InstallSnippets
|
||||
input={{ name, slug, publicUrl: result.publicUrl }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="md"
|
||||
onClick={() => router.push(`/servers/${result.serverId}`)}
|
||||
>
|
||||
Open server →
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
88
apps/web/app/(dashboard)/servers/page.tsx
Normal file
88
apps/web/app/(dashboard)/servers/page.tsx
Normal file
@@ -0,0 +1,88 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { apiFetch } from '@/lib/api';
|
||||
import { StatusPill } from '@/components/status-pill';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
interface ServerRow {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
status: string;
|
||||
publicUrl: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export default function ServersPage() {
|
||||
const [servers, setServers] = useState<ServerRow[] | null>(null);
|
||||
const [q, setQ] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
apiFetch<{ servers: ServerRow[] }>('/v1/servers').then((r) => setServers(r.servers));
|
||||
}, []);
|
||||
|
||||
const filtered = servers?.filter((s) =>
|
||||
q ? s.name.toLowerCase().includes(q.toLowerCase()) || s.slug.includes(q.toLowerCase()) : true,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-7xl px-6 py-8">
|
||||
<div className="flex items-baseline justify-between">
|
||||
<div>
|
||||
<h1 className="text-[22px] font-semibold tracking-tight">Servers</h1>
|
||||
<p className="mt-1 text-[13px] text-[--color-fg-muted]">All your hosted MCP servers.</p>
|
||||
</div>
|
||||
<Link href="/servers/new">
|
||||
<Button variant="primary" size="md">+ New server</Button>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
<input
|
||||
value={q}
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
placeholder="Search by name or slug…"
|
||||
className="h-8 w-72 rounded-md border border-[--color-border] bg-[--color-bg-subtle] px-2.5 text-[13px] placeholder:text-[--color-fg-subtle] focus:border-[--color-accent] focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
<div className="panel mt-4">
|
||||
{!filtered && <div className="px-4 py-4 text-[12.5px] text-[--color-fg-muted]">Loading…</div>}
|
||||
{filtered && filtered.length === 0 && (
|
||||
<div className="px-4 py-12 text-center text-[13px] text-[--color-fg-muted]">No servers match.</div>
|
||||
)}
|
||||
{filtered && filtered.length > 0 && (
|
||||
<table className="w-full text-[12.5px]">
|
||||
<thead className="border-b border-[--color-border] text-[--color-fg-subtle]">
|
||||
<tr>
|
||||
<th className="px-4 py-2 text-left font-medium">Name</th>
|
||||
<th className="px-4 py-2 text-left font-medium">Slug</th>
|
||||
<th className="px-4 py-2 text-left font-medium">Status</th>
|
||||
<th className="px-4 py-2 text-left font-medium">URL</th>
|
||||
<th className="px-4 py-2 text-left font-medium">Updated</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filtered.map((s) => (
|
||||
<tr key={s.id} className="border-b border-[--color-border] last:border-0 hover:bg-[--color-bg-subtle]">
|
||||
<td className="px-4 py-2.5">
|
||||
<Link href={`/servers/${s.id}`} className="font-medium hover:text-[--color-accent]">
|
||||
{s.name}
|
||||
</Link>
|
||||
</td>
|
||||
<td className="mono px-4 py-2.5 text-[--color-fg-muted]">{s.slug}</td>
|
||||
<td className="px-4 py-2.5"><StatusPill status={s.status as never} /></td>
|
||||
<td className="mono px-4 py-2.5 text-[--color-fg-muted]">{s.publicUrl ?? '—'}</td>
|
||||
<td className="px-4 py-2.5 text-[--color-fg-muted]">
|
||||
{new Date(s.updatedAt).toLocaleString()}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user