feat: harden runtime readiness and session workflow
This commit is contained in:
@@ -3,6 +3,9 @@ import type { WidgetProps } from "./types";
|
||||
|
||||
export function FreetextWidget({ descriptor, onRespond }: WidgetProps) {
|
||||
const [text, setText] = useState("");
|
||||
function submit() {
|
||||
if (text.trim()) onRespond({ id: descriptor.id, kind: "freetext", text });
|
||||
}
|
||||
return (
|
||||
<div className="space-y-3 rounded-xl border border-border/70 bg-card p-4 shadow-sm">
|
||||
{descriptor.title && (
|
||||
@@ -11,14 +14,16 @@ export function FreetextWidget({ descriptor, onRespond }: WidgetProps) {
|
||||
</p>
|
||||
)}
|
||||
<textarea
|
||||
className="min-h-24 w-full resize-y rounded-lg border border-input bg-card p-3 text-sm shadow-xs outline-none transition-[border-color,box-shadow] focus:border-primary/50 focus:ring-2 focus:ring-ring/20"
|
||||
data-awaiting-input="true"
|
||||
className="thot-awaiting-input min-h-24 w-full resize-y rounded-lg border p-3 text-sm shadow-xs outline-none transition-[border-color,box-shadow]"
|
||||
value={text}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
onKeyDown={(e) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); submit(); } }}
|
||||
placeholder="Type your answer…"
|
||||
/>
|
||||
<button
|
||||
className="rounded-md bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground shadow-xs transition-colors hover:bg-[oklch(var(--primary-hover))]"
|
||||
onClick={() => onRespond({ id: descriptor.id, kind: "freetext", text })}
|
||||
onClick={submit}
|
||||
>
|
||||
Send
|
||||
</button>
|
||||
|
||||
@@ -28,9 +28,11 @@ export function ReservedControls({
|
||||
{otherOpen && (
|
||||
<div className="flex flex-col gap-2">
|
||||
<textarea
|
||||
className="min-h-20 w-full resize-y rounded-lg border border-input bg-card p-3 text-sm shadow-xs outline-none transition-[border-color,box-shadow] focus:border-primary/50 focus:ring-2 focus:ring-ring/20"
|
||||
data-awaiting-input="true"
|
||||
className="thot-awaiting-input min-h-20 w-full resize-y rounded-lg border p-3 text-sm shadow-xs outline-none transition-[border-color,box-shadow]"
|
||||
value={text}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
onKeyDown={(e) => { if (e.key === "Enter" && !e.shiftKey && text.trim()) { e.preventDefault(); onControl("freetext", text); } }}
|
||||
placeholder="Describe your alternative…"
|
||||
/>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user