Skip to content

Upgrade the frontend: Vite, TypeScript, React 19, Bootstrap 5 - #15

Merged
pancakereport merged 2 commits into
mainfrom
frontend-upgrade
Oct 9, 2026
Merged

pancakereport merged 2 commits into
mainfrom
frontend-upgrade

Conversation

@pancakereport

Copy link
Copy Markdown

Summary

Brings the frontend up to date. The pages should look and behave the same.

Before After
Build tool Create React App (react-scripts, unmaintained) Vite 8
Types Flow 0.131 TypeScript 6.0 (strict)
React 16 19
Router React Router 5 React Router 7
UI react-bootstrap 1 / Bootstrap 4 react-bootstrap 2 / Bootstrap 5
Other react-markdown 5, styled-components 5 react-markdown 10, styled-components 6
Lint ESLint (Airbnb, Flow plugin; not run in CI) ESLint 10 + typescript-eslint, run in CI
Node 20 (end of life) 24 LTS

Code changes beyond the version bumps

  • All 43 files converted from Flow to TypeScript. tsc --noEmit passes, and runs in CI and in the Docker build.
  • ReactDOM.render → createRoot; Switch/Redirect → Routes/Navigate.
  • Replaced components Bootstrap 5 removed: Jumbotron → a small Hero matching the old fluid jumbotron; CardDeck → a plain wrapper; block buttons → w-100; InputGroup.Append → none; float-left/right → float-start/end.
  • The time-zone and admin toggles used bootstrap4-toggle, a jQuery plugin loaded with jQuery from a CDN. They're now a Bootstrap 5 switch (ToggleSwitch). jQuery, bootstrap4-toggle and the unused levenary are removed.
  • LabPage, DiscPage and TutoringPage were 180-line copies of each other. They now share SectionTypePage.
  • Kept Bootstrap 4's teal navbar and hover-only link underlines, so nothing looks different (Bootstrap 5 changes both).
  • Fixed a few spots React 19 warns about: block elements inside <p>, a missing list key, a button inside <table>, and setting state in an effect.

Build and deploy: Vite writes bundles to build/static/, the same URLs as before, because /assets/ already serves the server-rendered pages' CSS. The Dockerfile runs yarn typecheck && yarn build on node:24-slim. In development, the Vite server on :3000 forwards the API, login routes and /offerings to Flask on :8000.

TypeScript is 6.0 rather than 7.0 because typescript-eslint supports up to 6.0 so far.

Test plan

  • yarn typecheck, yarn lint and yarn build pass, as do the backend tests
  • Served the build from Flask with seeded data and compared screenshots against the old build, as a student (course home, lab, history) and as staff (lab, admin, section page with attendance). They match, apart from the toggle now being a switch.
  • On the preview: log in, join or switch a section, take attendance, flip admin toggles, import from a sheet

The JavaScript bundle is about 232 KB gzipped, up from about 184 KB, mostly because newer react-markdown pulls in more. Vite warns about the chunk size; code-splitting can come later if it matters.

🤖 Generated with Claude Code

- Build with Vite instead of Create React App, which is no longer
  maintained. Bundles go under /static/ as before, since /assets/ serves
  the server-rendered pages' stylesheets.
- Convert all components from Flow to TypeScript (strict); CI and the Docker
  build run the type check, and CI runs ESLint 10 with typescript-eslint.
  TypeScript stays on 6.0 until typescript-eslint supports 7.0.
- React 16 -> 19 (createRoot), React Router 5 -> 7 (Routes, Navigate),
  react-bootstrap 1 -> 2 with Bootstrap 4 -> 5, react-markdown 5 -> 10,
  styled-components 5 -> 6.
- Replace the jQuery bootstrap4-toggle plugin with a Bootstrap 5 switch;
  remove jQuery, bootstrap4-toggle and levenary.
- Replace the removed Jumbotron and CardDeck, and keep Bootstrap 4's navbar
  color and hover-only link underlines so pages look the same.
- Share one SectionTypePage between the Lab, Discussion and Tutoring pages,
  which were copies of each other.
- Node 24 (Node 20 is end of life) in mise, CI and the Dockerfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

🚀 Staging Preview Deployed!

URL: https://preview-sections-pr-15-137456085712.us-west1.run.app

@pancakereport
pancakereport merged commit 1932e8d into main Oct 9, 2026
10 checks passed
@pancakereport
pancakereport deleted the frontend-upgrade branch October 9, 2026 00:45
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.

1 participant