Clearer database setup: what to copy where, a password box, and a fallback that opens itself

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
minimus7andClaude Opus 5.5 committed 2026-11-04 15:35:17 -06:00
1 parent febd77e105
commit c3276ab5c1
5 files changed
+49 -20

No files matched your search

+6 -2
View File
@@ -102,6 +102,7 @@ export function KeyForm({ fields, canWrite, writeNote, onSaved }: { fields: Fiel
</span>
)}
</span>
{f.help && !f.set && <span className="block text-xs text-muted">{f.help}</span>}
{f.options ? (
<Segmented
label={f.label}
@@ -170,7 +171,7 @@ export function MigrateButton({ onDone }: { onDone: () => void }) {
}
// One click: Supabase's own sign-in page, then back to /setup with the tables created.
export function ConnectSupabaseButton({ onDone }: { onDone: () => void }) {
export function ConnectSupabaseButton({ onDone, onFail }: { onDone: () => void; onFail?: () => void }) {
const [busy, setBusy] = useState(false);
const [msg, setMsg] = useState("");
return (
@@ -185,7 +186,10 @@ export function ConnectSupabaseButton({ onDone }: { onDone: () => void }) {
const body = await res.json().catch(() => ({}));
if (body.url) return void (window.location.href = body.url);
setBusy(false);
if (!res.ok) setMsg(body.error ?? "Couldn't start the Supabase sign-in.");
if (!res.ok) {
setMsg(body.error ?? "Couldn't start the Supabase sign-in.");
onFail?.();
}
onDone();
}}
>
+16 -5
View File
@@ -194,24 +194,35 @@ function Steps({ steps }: { steps?: Section["steps"] }) {
}
export function Body({ s, data, signedIn, reload }: { s: Section; data: SetupStatus; signedIn: boolean; reload: () => void }) {
const [fallback, setFallback] = useState(false);
const form = s.fields && <KeyForm fields={s.fields} canWrite={data.canWrite} writeNote={data.writeNote} onSaved={reload} />;
return (
<>
{s.note && s.status !== "done" && s.status !== "error" && <p className="text-sm">{s.note}</p>}
{s.note && s.status === "done" && s.kind === "more" && <p className="text-sm">{s.note}</p>}
{s.action === "connect" && <ConnectSupabaseButton onDone={reload} />}
{s.action === "connect" && <ConnectSupabaseButton onDone={reload} onFail={() => setFallback(true)} />}
{s.action === "connect" && (s.steps || s.fields) ? (
<details className="text-sm">
<summary className="cursor-pointer text-muted hover:text-ink">Or paste a connection string instead</summary>
<details className="text-sm" open={fallback} onToggle={(e) => setFallback(e.currentTarget.open)}>
<summary className="cursor-pointer text-muted hover:text-ink">Button didn&apos;t work? Paste a connection string instead</summary>
<div className="pt-3 space-y-4">
<Steps steps={s.steps} />
{s.fields && <KeyForm fields={s.fields} canWrite={data.canWrite} writeNote={data.writeNote} onSaved={reload} />}
{form}
</div>
</details>
) : s.status === "done" && s.kind !== "more" && s.fields ? (
// Connected: the steps and empty boxes are noise now. They stay one click away for changing a key.
<details className="text-sm">
<summary className="cursor-pointer text-muted hover:text-ink">Change these keys</summary>
<div className="pt-3 space-y-4">
<Steps steps={s.steps} />
{form}
</div>
</details>
) : (
<>
<Steps steps={s.steps} />
{s.command && <CopyCommand command={s.command} />}
{s.fields && <KeyForm fields={s.fields} canWrite={data.canWrite} writeNote={data.writeNote} onSaved={reload} />}
{form}
</>
)}
{s.action === "migrate" && <MigrateButton onDone={reload} />}