Skip to content

December launch: new News page, Features cleanup, Opinion and Sports fixes - #182

Draft
anthonysantiago-eng wants to merge 66 commits into
mainfrom
december
Draft

anthonysantiago-eng wants to merge 66 commits into
mainfrom
december

Conversation

@anthonysantiago-eng

Copy link
Copy Markdown
Collaborator

Summary

Everything planned for the December launch, in one branch, so it ships as one deploy: the new News page, the Features cleanup, and the Opinion (#181) and Sports (#180) cleanups. Site-wide fixes will land here before it's ready.

This stays a draft until early December. Please merge it with a merge commit, not a squash, so each part's commits stay readable.

What's in it

News (news-page, 20 commits)

  • Curated News page with its own layout editor
  • Student Senate / Executive Board timelines and terms
  • The masthead marks the current section; the News title row is gone
  • "Missed something?" search at the foot of the page
  • Review fixes: News-only layout permissions, atomic layout saves, unsaved-changes guard, full-archive pagination, no story shown twice

Features (features-cleanup, 5 commits, plus 1 on this branch)

  • Removes Upcoming Events and the public event form; /features/submit-event now redirects to /features
  • Removes the Collar City Column
  • One layout for phone, tablet and desktop instead of a hidden mobile copy; a type scale; Photo Spotlight as a swipeable carousel with proper captions
  • On Campus and The Arts only auto-fill stories with a matching kicker
  • No header row, matching News. News's search footer becomes a shared SectionSearchPrompt that both pages use

Opinion: everything from #181 (security, layout persistence, archives, accessibility).

Sports: everything from #180 (scoreboard, editor pins, kicker and caching; sports code reorganised).

Site-wide fixes (still to come on this branch):

  • top bar collides at 1024–1080px
  • accessible names on icon buttons, plus a skip link
  • dark mode follows the system setting
  • the article drop cap
  • the article byline reads like a photo credit
  • the sign-off misses write-in authors

Database and deploy

  • Migrations: three for News (news_page_layout, student_gov_updates, student_gov_terms) and one for Opinion (opinion_layout_singleton). All are in both migrations/ and scripts/run_deploy_sql_migrations.sh.
  • Deploy batches: Opinion is 34; News is 35, 35 and 36. Both branches originally claimed 34.
  • Opinion migration test: run on a copy of a dev database with two duplicate "Opinion Layout" rows added. The newest stays "Opinion Layout", the others become "Archived Opinion Layout #id", the unique index is created, and running the whole script again changes nothing.
  • Event submissions: the collection stays as a read-only archive. create is closed, so Payload's REST endpoint no longer accepts anonymous posts. The two Features SEO fields for the event page are hidden, not dropped. No schema change.

Before merging

  • Site-wide fixes are in
  • Latest main is merged in; CI is green
  • Migrations pass on a fresh database (CI)
  • The deploy SQL is run against a copy of the production database
  • The production build has enough Postgres connections. On a 16-core machine, next build runs about 15 workers, each with Payload's default pool of 10, which can exceed Postgres's default limit of 100 ("too many clients"). If the deploy server has many cores, set a pool max in payload.config.ts first

Testing so far

  • pnpm typecheck and pnpm lint (0 errors); next build --experimental-build-mode=compile
  • Local dev server: home, News, Features, Opinion, Sports, the feed, sitemap, search and archives all load. All four section layout editors open without errors.
  • Features was checked in screenshots at 1440, 1024, 768 and 390px, light and dark.

#181 and #180 are closed in favour of this PR. Their diffs are still there if they're easier to review on their own.

No change to what /sports renders.

- lib/sportsPage.ts loads everything the page needs, replacing 190 lines
  in the shared [section] route. The three schools queries are now one.
- lib/sportsLayout.ts defines the layout JSON once (it was copied in the
  editor, the route, /sports/all and a collection comment) and reads it
  through parseSportsLayout, so a malformed value falls back to its
  default instead of throwing. HEADLINE_COUNT was defined twice.
- lib/troyTime.ts and lib/sidearm.ts replace repeated date formatters and
  fetch options.
- SportsByline, SportsHeading and useScrollEdges replace copies in the
  page, the carousel, the standings card and the score strip.
- Comments: phone scoreboards always use logos; field hockey's Sidearm
  code differs between RPI Athletics and the Liberty League.
- Scoreboard shows only when the lead's game has both scores, so a
  preview story no longer reads "Final". The second below-lead slot
  follows the same rule on the page and in the editor.
- Layout editor loads every pinned story, including ones older than the
  pool or unpublished, marks them, and lets editors remove a pin whose
  story is gone.
- Kicker follows the sport until an editor writes their own, so changing
  the sport no longer leaves the old name. "General" adds no label.
- Scores must be whole numbers.
- /sports/all caches its sport tab counts for a minute instead of loading
  every sports story on each request.
- The schedule looks back only for sports the standings card will show.
- Feed links must be http(s); a blank points cell shows a dash, not NaN.
- section-layout route: drop the unused section argument.
- A story moved to another section drops its sport and game result, so
  it never keeps a hidden sport or scoreboard.
- docs/sports-section.md: /sports/all rendering and tab caching, the
  kicker and scoreboard rules, whole-number scores, unpublished and
  missing pins in the editor, the new lib files, and the Show-override
  gap.
- New `news-page-layout` collection with a custom admin editor
  (NewsLayoutEditor) driving the /news lead and section composition
- New `student-gov-updates` collection for short Senate / Executive Board
  updates; editable by admin, EIC and news-section editors
- /news/senate and /news/executive-board timeline pages (merged with
  articles carrying the matching kicker), plus a Student Government box
  on /news
- Admin sidebar dropdown under "News Layout" for the timeline page
  editors (TimelinePageEditor)
- Footer: optional flush spacing; rule matches the header's line weight
- formatArticle exposes imageAspect from the upload's width/height
- Migrations for both collections in migrations/ and the deploy SQL script
- scripts/seed-news.ts for local placeholder data
…ctions

- StudentGovTerms collection (GM Week to GM Week) with migration in both
  migrations/ and the deploy SQL script
- /news/student-government replaces /news/senate and /news/executive-board
- NewsFeatured, NewsSecondary and topic tabs on the News page; StudentGovShelf
- FitGroup and BalanceColumns for closing blank space on any page
- Seed scripts for terms, topics and the Student Government archive
- docs/news-section.md and docs/fit-text.md
- NewsSearchPrompt: a News-only search (/search?q=…&section=news) and a
  link to past News stories, added below the topic tabs
- The underline turns into the header search's travelling rainbow wave
  while typing and after submitting; stays red without scripts or with
  reduced motion
… title row

The masthead's section link for the page you're on is red with a bar on
the rule. Between sections the bar slides over, and a red copy of the
links cut to the bar's span turns each letter red as the bar passes
under it. From a page outside the sections the bar grows in; reloads and
reduced motion just draw it in place.

With the section marked up top, the News page drops its NEWS | ARCHIVE |
CONTACT row on desktop so the lead headline is above the fold. The title
stays for screen readers, and shows small on mobile (no section links in
the mobile header). Archive and Contact move to the foot, under "Missed
something?".
… strip arrows

- HeaderClient: the active section's bar hangs below the header into the
  sports score strip, which painted over its lower half; it now sits above
  (z-20)
- SportsScoreStrip: the arrow tabs hang 1px past the strip's ends so a
  sliver of the next cell doesn't show at fractional zoom (125%, 175%);
  drops the fade beside the tabs
… first screen

- NewsSecondary: each strip shows its story's photo, cropped square, on the
  right. A News Layout editor switch (secondaryPhotos in the layout JSON,
  missing = on) runs them text only; no schema change
- BalanceColumns: data-balance-fold keeps a photo box short enough that its
  data-balance-fold-end is on the first screen (as wide as the given ratio);
  "reach" options may overshoot when the other column can grow to meet them;
  several flexible boxes in a column share each change
- NewsLead: stacked and overlay photos are held to the fold (down to 2:1,
  flex now 16:9 to 5:4); with the text above or below the photo the column
  scales to 1.25 and the headline and subdeck stop at 48px and 18px
- StudentGovColumn: pinned stories' photos can crop from 3:2 to 2:1 so that
  column can reach the lead's
- Editor's lead crop preview uses 2:1 for stacked layouts
- docs/fit-text.md and docs/news-section.md
…ides and swipes

Terms list (StudentGovTermList), at the foot of both timelines:
- Every covered term, newest first: name, chair, stories and updates on
  the timeline. The four newest show, plus the term on the page if older;
  "Show N earlier terms" opens the rest and moves focus to the first new row
- A table with one header row from 600px (container query), stacked rows
  below. Each row is one link; the term on the page has a red rule and
  "Viewing". Missing chairs show a dash. The foot links the print archive
- Removes the bookshelf (StudentGovShelf, shelfDetails, spine colours and
  sizes, spineFoot) and the frame's sideways-wheel handling for it
- "Shelf" wording out of the 404 and admin copy; the terms collection's
  "On the shelf" checkbox is labelled "Listed" (label only, no migration)

Senate / Executive Board switch (StudentGovBodySwitch), in the photo panel
and the Terms list header:
- Marks the body you're on with a bar, as the masthead marks its section.
  Choosing the other slides the bar over, turning each label as it passes,
  using the masthead's own code, now shared in components/slidingBar.ts
- The page swipes towards the body you're moving to: every on-screen piece
  marked data-swipe slides out, staggered, and the new page's pieces slide
  in (pageSwipe.ts, Web Animations; no frozen page while the next loads).
  The other timeline is fetched in full as soon as the switch is pointed at.
  Reduced motion: nothing moves

docs/news-section.md covers both.
… pass

pnpm applies pnpm-workspace.yaml's esbuild: ^0.25.0 override to direct
dependencies too, so the pinned "0.25.12" in package.json didn't match the
lockfile and pnpm install --frozen-lockfile (CI, deploy) failed. Still
resolves to 0.25.12.
…a carousel

- pageSwipe.ts: nothing moves on the click; once the new page has rendered,
  before it's painted, the photo panel and the stream (data-swipe-chunk)
  each slide across as one block: a copy of the old one goes out one side
  while the new one follows right behind, clipped to the block, on the
  switch bars' timing. data-swipe-keep parts (breadcrumb and switch in the
  panel, the Terms list's switch and rule) stay put. Replaces the
  per-piece data-swipe stagger
- Switching with the Terms list on screen (data-swipe-anchor) opens the new
  page with its Terms list at the same spot, so Next doesn't scroll to the
  top; the panel's month observer counts its first reading at once, and
  picks the last month scrolled past when opened below the months
- Terms list: the "Terms" heading is for screen readers only; the switch
  sits on the right over the rule

docs/news-section.md updated.
The "back to the term in session" link at the top of a past term's stream
was a white book with a hanging Poly P charm, left over from the shelf.
It's now a red text link, "‹ TO 57TH SENATE", set like the Terms list's
"Show N earlier terms" button with its chevron pointing back. The text
underlines and the chevron nudges left on hover (still for reduced
motion). Removes polyP.ts, which only the charm used.
…efore the type

- Strips under the lead: the photo is as tall as the text beside it,
  16:10 at the shortest and square at the tallest, so a short subdeck
  no longer leaves a gap under a tall photo
- BalanceColumns: new `data-balance-art-first` column attribute; when
  that column is the short one, its flexible boxes grow before its type
- News lead column is marked art-first, so the strips' type only grows
  when the lead photo can't (e.g. held to the first screen)
- docs: fit-text.md and news-section.md updated to match
Rewrites scripts/seed-features.ts in the style of the news seed:

- 26 published features articles over the last six weeks, enough to
  fill every slot on /features plus the "More in Features" row
- reuses the four fixture photos from `pnpm db:seed` (the same ones the
  news seed uses) instead of generating flat grey placeholders
- idempotent: articles are matched by slug, so re-running adds nothing
- legacyImport context keeps the backdated dates and skips PostHog
  events and breaking-news pushes
- creates a Features layout when none exists (Arts and Collar City
  pinned, upcoming events, Photo Spotlight); an existing layout is left
  alone

Adds `pnpm db:seed:features` and removes update-features-images.ts,
which only replaced the old grey placeholders with photos downloaded
from picsum.photos.
The events box needed editor upkeep the section can't commit to, and
the Collar City Column has no columnist and too few stories. The
section header now matches News: Features | Archive | Contact.

- page: drop the events box, the "Have something you want to be
  featured?" box (it linked to the event form and split the On-Campus
  list) and the Collar City column; Photo Spotlight spans the middle
  and right columns of the lower row
- layout editor: drop the Events panel and the Collar City column;
  the spotlight spans two columns to match the page
- remove the /features/submit-event page, its API route and form;
  the old URL redirects to /features
- event-submissions stays as a read-only archive (no schema change);
  create is closed so Payload's REST endpoint stops accepting
  anonymous posts
- seo: hide the two submit-event fields (columns kept)
- seed: no events; the Collar City stories get a "Troy" kicker

Saved layouts may still carry events / collarCity keys; they're
ignored, and the next editor save drops them. No migration needed.
- lead column widens (the events box no longer needs 320px) and the
  lead headline goes to 42px on desktop
- right column is labelled Latest, styled like On-Campus; the editor
  calls it Latest too
- On-Campus and Latest get headline-only extras after every editor
  slot is filled, so the side columns end level instead of stopping
  ~560px short of the lead column
- Photo Spotlight spans the lower row in a 16:9 frame with a proper
  caption ("Photo by ... · From <story>"); its heading lines up with
  The Arts, and the two stories under it sit beside their images
- a story the spotlight links to isn't auto-filled into the lists, so
  it isn't shown twice
- the carousel no longer carries its own heading, which removes the
  doubled "Photo Spotlight" on phones
Rebuilds the Features page as a single layout instead of a desktop
grid plus a hidden phone copy. The two had drifted apart, every
heading existed twice, and hidden images still downloaded.

Layout
- the DOM is in phone reading order (lead, Latest, Photo Spotlight,
  On Campus, The Arts); CSS grid areas place the same sections on
  tablet (two columns) and desktop (the existing three)
- tablet gets a real layout: lead across the top, On Campus beside
  Latest, spotlight full width, The Arts and More in Features three
  across. The 768px page goes from ~11,900px to ~4,750px
- phones lead with the lead story, not On Campus. Each section's
  first flagged story gets the big photo; the rest are compact rows
  (headline, 88px thumbnail, hairline dividers). ~8,800px -> ~5,700px
- cards change shape per breakpoint with classes on one element, so
  each image is in the DOM once

Type and labels
- one headline scale: lead 42/36/32, wide story 24, cards 20,
  headline-only and phone rows 18; kickers 13px everywhere; More in
  Features headlines drop from 28px to 20px
- every section uses the same red-rule label (The Arts and Photo
  Spotlight no longer have their own centred style); "On Campus"
  without the hyphen, here and in the editor
- a kicker that repeats its section, or just says "Features", is
  hidden
- summary lines on the lead, the first story of each section and the
  wide story
- dates only in Latest, as short absolute dates ("Nov 14", Eastern
  time so server and browser agree, never split across lines)
- More in Features picks its column count from the number of stories

Photo Spotlight
- a swipeable scroll-snap rail; on phones the next photo peeks in
- prev/next and dots are 44px targets; caption links get a 24px hit
  area; smooth scrolling respects reduced motion

Accessibility and dark mode
- one heading outline: an h2 per section, story headlines h3
- sections are labelled landmarks; the carousel announces its slides
- dark mode: section rules and labels use the accent colour and
  white consistently
Auto-fill took the next story in the pool for every slot, so the On
Campus column listed stories kicked "Collar City Column", "Photo" or
"Events" under an ON CAMPUS label, and The Arts did the same when
unpinned.

- On Campus and The Arts auto-fill only stories whose kicker matches
  (on campus / campus; the arts / arts / music / theatre / film /
  dance) and fill before the lead and Latest, so their stories aren't
  used up elsewhere; editor-pinned slots are untouched
- a topic section with no matching story shows general stories under
  "More Stories" rather than leaving a hole in the grid
- when On Campus has fewer than six stories, the left column carries
  on with a separately labelled "More Stories" run, keeping the
  columns level without mislabelling anything
- a kicker that opens its own headline ("Photo" over "Photo: ...") is
  hidden
The floated drop cap is taller than one line, so when the first paragraph
was a single line the next paragraph wrapped around the letter and its
first line was pushed in ("B  y midnight"). The paragraph is now a
flow-root, so it grows to the letter's height instead.
With no caption, the authors' names sat just under the photo in red with
no "By" (only the 4+ author sentence had one), so they read as the photo
credit.

- Every byline format now starts with "By", including the desktop layout
  that shows job titles under each name.
- When a photo has no caption or credit under it, the byline sits further
  below it (48px rather than 32px), on Standard and Opinion articles.

Colour and case are unchanged; that rework is still deferred.
The sign-off listed staff authors only, so an outside co-author named in
the byline was missing at the end, and a piece by write-ins alone had no
sign-off at all. Write-ins now follow the staff, in byline order: their
photo if one was given, and their name (not linked; they have no profile
page or bio).
Comment thread lib/themePreference.ts Fixed
Comment thread lib/themePreference.ts Fixed
CodeQL (js/bad-code-sanitization, alerts 23 and 24) flagged the two
JSON.stringify calls that put constants into the inline theme script:
JSON escaping doesn't make a value safe inside a <script>. Only fixed
constants ever went in, so nothing was exploitable, but they're now
written in directly. The script is byte-for-byte the same.
The site now follows the device's setting, so the once-only home page
prompt reaches only readers whose device is set to light. It now offers
dark mode ("Prefer dark mode? Switch here.") instead of telling them it's
better than light mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants