import { createEffect, createSignal, on, onCleanup, Show } from "solid-js" import { Button } from "@opencode/ui/button" import { ErrorDetails } from "./error-details" type Phase = "failed" | "retrying" | "connected" type Args = { message: string; lines: number; phase: Phase } function Preview(props: Args) { const [phase, setPhase] = createSignal(props.phase) createEffect(on([() => props.message, () => props.lines, () => props.phase], () => setPhase(props.phase))) createEffect(() => { if (phase() !== "retrying") return const timer = setTimeout(() => setPhase("connected"), 1500) onCleanup(() => clearTimeout(timer)) }) const details = () => [ props.message, ...Array.from( { length: props.lines }, (_, i) => `Attempt ${i + 1}: workspace index did not acknowledge the handshake.`, ), ].join("\n") return (
Connected to the workspace index.