Skip to main content

Topic stories, screen by screen

#1224. Added 2026-11-26. Owner: "All the stories should have horizontal scroll drill down with swipe like data center."

Decision​

Topic stories (TopicStory.tsx) use the Data Center Story's screen machine instead of a long page. The machine was moved out of DataStory.tsx unchanged into components/stance/useStoryScreens.ts (landing on ?screen=, writing the screen in view back to the URL, the cover hold, keyboard paging, focus on the settled screen's heading), and one screen's markup into components/stance/StoryScreenFrame.tsx, which StoryScreenView now renders. A copy would have drifted; both pages now move, announce and focus alike, and e2e/story-nav.check.mjs checks both.

Which screens​

utils/topicStoryScreens.ts holds the list (Overview, Over time, Who spoke, Companies, What was said, Decisions, Recap) and planTopicScreens, which drops a screen whose data loaded empty and records why for the cover's note. Overview and Recap always stay. Nothing on a screen is invented to fill it: an empty screen goes, a loading one says it is loading.

What was left out, and why​

  • County drill-down and box transition (#1195): the topic endpoints count meetings by state only. Adding a county grain needs a jurisdiction-to-county count for topic_transcript_link; until then the Overview says there is no county view.
  • Unit matrix "By who spoke": needs one record per meeting with its AI reading; /api/topics/{id}/state-map and caption-facts serve counts. The Who spoke screen draws the counts as bars in the topic's words.
  • A closing vote: only the data center pack has a question; the Recap ends on Next story.
  • City grain: #1186.

Layout: one Next, one Close (owner, 2026-11-27)​

The owner found the cover's two stacked buttons ("Start the … story →" and "Next story: … →") confusing and asked for one green Next at the bottom right, always visible, and a Close (×) at the top right. So the topic stories draw their own bar (the title sentence, the screen's word, Close and the segments) instead of ScopeBar, and one fixed StoryNextButton replaces the inline Next, the floating Next, the phone bar's Next, the cover's pair and the next-story card. The last screen's Next is a quiet Done that goes home: readers choose the next story there. The #1234 branch is building the same pieces for the Data Center Story; when both are in, the two should share one Close and one Next component.

Swipe​

hooks/useSwipeNav.ts turns a quick sideways flick (at least 50px, 1.5 times its vertical travel, under 800ms) into Next/Back with passive listeners (the same file the #1234 branch adds), so the browser's own vertical scroll and snap keep working. It is used by the topic stories; the Data Center Story can take the same hook.