Can we introduce pinned threads?
Can we introduce pinned threads?
Plan for pinned threads:
- Data:
threads.pinned_at timestamptz(null = not pinned), migrationdrizzle/0015_thread_pinned.sql. A timestamp instead of a boolean so several pins keep a stable order (latest pin on top). - Ordering:
listThreadssorts pinned threads first (pinned_at desc nulls last, thenupdated_at desc), so pins float to the top of the workspace home, the manage page's list and the live search/status filters alike. - Who can pin: the workspace owner only. Pinning is curation of the workspace's front page, so I'm not giving it to thread creators (who can otherwise delete / share their own threads).
canPinThreadin lib/session.ts. - API:
PATCH /api/threads/[id]learns{ pinned: boolean }next to the existing{ public };GET /api/threadsreturnspinnedAt. - UI: a "Pin thread" / "Unpin thread" item in the thread page's Manage menu (components/thread-menu.tsx, single tap, no arming since it's reversible and harmless), a small framed "pinned" chip with a pin glyph in the thread status row and in the thread list's meta line, and pinned rows get a quiet marker in the list.
I'll mock the list + menu up with a static page against globals.css and attach screenshots.
Implemented and typechecked (commit 54b1cc3, not pushed yet):
threads.pinned_at+drizzle/0015_thread_pinned.sql;listThreadsorders bypinned_at desc nulls last, updated_at desc(verified the generated SQL withtoSQL()).PATCH /api/threads/[id]now takes{ public?, pinned? }(at least one);pinnedrequires a workspace owner (canPinThreadin lib/session.ts),publickeeps the creator-or-owner rule.GET /api/threadsreturnspinnedAt.- Manage menu: "Pin thread" / "Unpin thread" item (owners only, single tap) above Delete.
PinnedBadge(components/bits.tsx): framed chip with a new own "pin" glyph, shown in the thread list meta and the thread page status row.
Setting up Chromium for a mockup screenshot of the list + menu next.
threadide@54b1cc3Pinned threads are in, pushed on thread/814ce095 (54b1cc3).
What it does
- A workspace owner opens a thread's Manage menu and taps Pin thread (or Unpin). The thread then sits at the top of the workspace's list; several pins order latest-pin-first, everything else keeps the usual most-recently-active order. Pins still obey search, the status filter and who-may-read.
- A framed "pinned" chip (new own pin glyph) shows in the list's meta line and in the thread page's status row, so a 3-day-old thread above a 12-minute-old one isn't confusing.
Decisions worth knowing
- Owner-only on purpose: pinning curates the workspace's front page, so thread creators don't get it (they keep share/delete on their own threads). One-line change in
canPinThreadif you'd rather let creators pin too. pinned_atis a timestamp, not a boolean, to give pins a stable order.- No separate "Pinned" section, no tinted rows: just ordering plus the chip, keeping the list quiet.
Changes: db/schema.ts + drizzle/0015_thread_pinned.sql (nullable pinned_at), lib/data.ts (ordering, setThreadPinned), lib/session.ts (canPinThread), PATCH /api/threads/[id] takes { pinned } next to { public }, GET /api/threads returns pinnedAt, components/thread-menu.tsx (Pin/Unpin item), components/bits.tsx (PinnedBadge), components/pulp-icons.tsx ("pin" glyph), components/thread-list.tsx, app/threads/[id]/page.tsx, app/globals.css.
Verified: typecheck clean; generated SQL checked via toSQL(); screenshots below are the real components rendered against globals.css (the app can't run in the sandbox). Not exercised live: the PATCH round trip and the page refresh after pinning. The migration applies on the production deploy of the merge.
You could just show the pinned icon in the thread list and on the thread itself
Dropping the framed "pinned" chip for a bare pin glyph: PinnedBadge → PinnedIcon (just the own "pin" glyph in muted ink, with the tooltip kept), in the same two places (thread list meta line, thread page status row). The .badge.pinned CSS goes; a small .pin-mark rule aligns the glyph with the text. Screenshot after.
threadide@2f10a8eDone: the framed "pinned" chip is gone, it's just the pin glyph now (pushed as 2f10a8e on thread/814ce095).
PinnedBadge→PinnedIconincomponents/bits.tsx: the own pin glyph in muted ink insidespan.pin-mark, with the tooltip ("Pinned by a workspace owner: stays at the top of the list") and an aria-label, no word and no frame.- Thread list meta line: 14px glyph before the status badge. Thread page status row: 16px glyph after the status badge.
.badge.pinnedCSS replaced by a two-line.pin-markrule inapp/globals.css.
Everything else from the first pass (owner-only Pin/Unpin in the Manage menu, pinned_at ordering, migration 0015) is unchanged. Typecheck clean; screenshots below are the real components against globals.css.
Merged threadide #165 by @osebo (merge, cdca073).





