Reply button

merged…
osebo51d ago

Reply Composer isn’t open by default, hit a reply button to get it

2 repliesoldestnewest
Osebotfable-5-151d ago

Plan: the docked composer on the thread page (components/composer.tsx, rendered in .compose-dock on app/threads/[id]/page.tsx) currently always shows the full textarea + controls. I'll make it collapsed by default: the dock shows a single Reply button; clicking it expands the form and focuses the textarea. A small "cancel" link collapses it again (draft kept in state), and a successful post collapses it back. The "Claude is working" activity strip in the dock stays visible either way. No API or DB changes.

Osebotfable-5-151d agothreadide@4fb108d

Done — pushed to thread/13940fe6 (commit 4fb108d), no PR opened yet.

What changed

  • components/composer.tsx: new local open state, default false. Closed state renders .compose-collapsed with a single Reply button (plus a muted "Draft kept" note if there's unsent text). Opening focuses the textarea. A cancel link in the control row, or Escape in the textarea, folds it back up; body/attachments stay in state so nothing is lost. A successful post collapses it again; a failed post leaves it open.
  • app/globals.css: .compose-collapsed (flex row; Reply button goes full-width ≤560px to match the Post button) and form.compose .row > button.link.compose-cancel { flex: none } so the cancel link doesn't inherit the phone full-width rule for buttons.

Unchanged on purpose

  • The sticky .compose-dock on app/threads/[id]/page.tsx and the "Claude is working" AgentActivity strip inside it render exactly as before in both states.
  • No per-post reply buttons; the one dock button is the entry point.
  • No API/DB changes. tsc --noEmit and next lint are clean.

The screenshot is a static mockup of the real globals.css at 390px (the app can't run in the sandbox — needs Postgres + GitHub OAuth).

Thread page dock at 390px: composer collapsed to a Reply button (static mockup using the real globals.css)
Thread page dock at 390px: composer collapsed to a Reply button (static mockup using the real globals.css)
Diff · 2 files
--- a/threadide/app/globals.css
+++ b/threadide/app/globals.css
@@ -283,6 +283,13 @@
 .compose-dock { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--border); padding: 10px 0 12px; margin-top: 16px; }
 .compose-dock textarea { min-height: 64px; }
+/* Composer is collapsed by default; the dock shows just a Reply button (full-width on phones, like Post). */
+.compose-collapsed { display: flex; align-items: center; gap: 12px; font-size: 13px; }
+@media (max-width: 560px) {
+  .compose-collapsed > button { flex: 1 1 auto; }
+}
+/* Escape in the textarea or this link folds the form back up; the draft stays in memory. */
+form.compose .row > button.link.compose-cancel { flex: none; }
--- a/threadide/components/composer.tsx
+++ b/threadide/components/composer.tsx
@@ -1,12 +1,18 @@
 "use client";
 import { useRouter } from "next/navigation";
-import { useEffect, useState, useTransition } from "react";
+import { useEffect, useRef, useState, useTransition } from "react";
@@ -8,6 +8,12 @@
 export function Composer({ threadId, disabled, canAskClaude = true }: { threadId: string; disabled?: boolean; canAskClaude?: boolean }) {
   const router = useRouter();
+  // Collapsed by default: the dock shows a Reply button until the user asks for the form.
+  const [open, setOpen] = useState(false);
+  const textareaRef = useRef<HTMLTextAreaElement>(null);
+  useEffect(() => {
+    if (open) textareaRef.current?.focus();
+  }, [open]);
   const [body, setBody] = useState("");
@@ -65,17 +71,36 @@
     if (res.ok) {
       setBody("");
       setAttachments([]);
+      setOpen(false);
       startTransition(() => router.refresh());
     } else {
       setPendingRun(false);
     }
   }
 
+  if (!open) {
+    return (
+      <>
+        {pendingRun && !disabled && <AgentActivity threadId={threadId} />}
+        <div className="compose-collapsed">
+          <button type="button" onClick={() => setOpen(true)}>
+            Reply
+          </button>
+          {body.trim() && <span className="muted">Draft kept</span>}
+        </div>
+      </>
+    );
+  }
+
   return (
     <>
       {pendingRun && !disabled && <AgentActivity threadId={threadId} />}
       <form className="compose" onSubmit={submit}>
         <textarea
+          ref={textareaRef}
+          onKeyDown={(e) => {
+            if (e.key === "Escape") setOpen(false);
+          }}
           placeholder={
@@ -116,6 +141,9 @@
           <button disabled={busy || !body.trim()}>{busy ? "Posting…" : canAskClaude && askClaude ? "Post & run" : "Post"}</button>
+          <button type="button" className="link compose-cancel" onClick={() => setOpen(false)} disabled={busy}>
+            cancel
+          </button>
         </div>
       </form>