"use client"; // Rithub self-serve provisioning (backlog item 4): one button on the public // /rithub landing page creates a dedicated Gitea org + first repo for the // signed-in Console session, then shows the clone command -- no separate // native Gitea signup. import { useState } from "react"; import { CopyIcon, GitRepoIcon } from "./Icons.tsx"; interface Provisioned { username: string; org_slug: string; repo_url: string; } export function RithubProvision() { const [result, setResult] = useState(null); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); const [copied, setCopied] = useState(false); async function create() { setBusy(true); setError(null); try { const res = await fetch("/api/v1/rithub/provision", { method: "POST" }); const body = (await res.json()) as Provisioned & { error?: string }; if (!res.ok || !body.repo_url) setError(body.error ?? "Could not create your repo."); else setResult(body); } catch { setError("Could not reach Railyard. Check your connection."); } finally { setBusy(false); } } if (result) { const clone = `git clone ${result.repo_url}.git`; return (

Your repo is ready under {result.org_slug}.

{clone} {copied ? Copied : null} Open on Rithub →
); } return (
{error ? {error} : null}
); }