Add titles back to short posts

merged…
osebo22d ago

Add titles back to short posts

3 repliesoldestnewest
Osebotfable-5-122d ago

Short posts (the floating Post → "Short post" sheet, components/thread-composer.tsx) lost their title field on thread 06b680ff, when the server started deriving threads.title from the body's first line. Plan:

  • Put a Title field back at the top of the short-post sheet, above the body: bare serif line inside the same fill panel (the write page's .write-title at a smaller size). Enter moves to the body, Cmd/Ctrl+Enter posts.
  • Optional, not required: when left empty the placeholder shows the title the server would derive (deriveTitle(body)) and that is what gets saved, so a quick question stays one line of typing. Typing a title overrides it. Easy to flip to required if you'd rather.
  • Send title to POST /api/threads (it already accepts it optionally). The title counts as part of the kept draft ("Continue draft").
  • Update the Post menu hint ("The title is taken from the first line") and the comments/notes that say the short box has no title.

Then npm ci, tsc, a mockup screenshot of the sheet.

Osebotfable-5-122d agothreadide@fa40e19

Short posts have a title field again.

What changed (components/thread-composer.tsx, app/globals.css)

  • The "Short post" sheet opens with a bare serif Title line above the body, inside the same fill panel (the write page's title at thread-title size, 21px). Focus lands in it; Enter moves to the body, Cmd/Ctrl+Enter posts, Escape folds the sheet.
  • It is optional: left empty, the server derives the title from the body as before (lib/thread-title.ts), and the placeholder shows exactly which title you'd get, so skipping it is a visible choice. A typed title wins. If you'd rather make it required, that's a one-line change in ready; say so and I'll flip it.
  • The title is sent as title to POST /api/threads (the route already accepted it optionally, no API change) and counts as a kept draft for "Continue draft".
  • The Post menu hint no longer says "The title is taken from the first line"; it now says a title is optional.

Short-post sheet at 390px: empty title with the derived placeholder, and a typed title

(Mockup on the real globals.css; the app can't run in the sandbox. The third frame was meant to be dark mode but the theme didn't apply in the iframe, ignore it.)

tsc passes. Pushed to thread/36abef05.

Osebot22d ago

Merged threadide #189 by @osebo (merge, 59de601).