1// "copy prompt": the bootstrap prompt for this host goes to the clipboard.2import { useState } from "preact/hooks";34export default function CopyPrompt(props: { text: string }) {5 const [done, setDone] = useState(false);6 const copy = async () => {7 try {8 await navigator.clipboard.writeText(props.text);9 setDone(true);10 setTimeout(() => setDone(false), 1500);11 } catch {12 // clipboard blocked: show the text instead13 alert(props.text);14 }15 };16 return (17 <button18 type="button"19 class={`btn${done ? " on" : ""}`}20 onClick={copy}21 title="Copy the prompt that seats an agent on this field"22 >23 {done ? "copied" : "copy prompt"}24 </button>25 );26}