Skip to content

Version 5.0: Major change from CRA to Vite and TypeScript with Google Civic Info API Representatives replacement#162

Open
jungshadow wants to merge 9 commits into
mainfrom
feature/major-upgrade
Open

Version 5.0: Major change from CRA to Vite and TypeScript with Google Civic Info API Representatives replacement#162
jungshadow wants to merge 9 commits into
mainfrom
feature/major-upgrade

Conversation

@jungshadow
Copy link
Copy Markdown
Owner

@jungshadow jungshadow commented May 13, 2026

Version 5.0

  • CRA -> Vite 8 with @vitejs/plugin-react
  • React 16 -> 19 with react-dom/client (createRoot)
  • react-router-dom v7NavLink className function API, no activeClassName
  • pnpm as sole package manager (packageManager field enforced)
  • Replace lodash with native JS, moment.js with date-fns
  • Replace node-sass with sass (Dart Sass)
  • framer-motion upgraded — removed deprecated layoutTransition prop
  • Every .js/.jsx file converted to .ts/.tsx
  • Strict mode enabled (tsconfig.json with strict: true)
  • Full type definitions for API responses, app state, and actions (src/types/)
  • PropTypes removed entirely — replaced by TypeScript interfaces
  • Path aliases configured in both tsconfig.json and vite.config.js
  • ESLint 9 flat config with typescript-eslint, react-hooks, prettier
  • Prettier 3 with project-wide formatting
  • Fixed all lint errors: hooks ordering, refs-during-render, cascading setState, unescaped entities
  • Replaced Google Civic representatives endpoint with Open States /people.geo
  • Flow: address -> Mapbox geocode -> lat/lng -> Open States -> transform to existing RepresentativesApiResponse shape
  • Fixed ElectionTitle crash on missing election data (new Date('') → Invalid Date)
  • GitHub Actions deploy workflow (workflow_dispatch) — type check → lint → build → deploy to Pages
  • Secret management: dev uses 1Password CLI (op run), prod uses GitHub Secrets
  • Updated .env.example with setup instructions
  • Vitest 4 + jsdom + @testing-library/react + @testing-library/jest-dom
  • 27 unit/component tests: helpers (19), appReducer (5), ElectionTitle (3)
  • Playwright 1.60 with Chromium — simple E2E smoke test (homepage renders logo + search form)
  • MSW installed for future API mocking
  • Scripts: pnpm test:unit, pnpm test:e2e
  • Removed prop-types, @types/prop-types, @types/mapbox-gl, ajv, gh-pages
  • Removed dead privacy.html, predeploy/deploy scripts, browserslist
  • Removed 31 unnecessary import React from 'react' statements
  • Add ElectionPicker to switch between active elections in a state

- Migrate from Create React App to Vite 8
- Upgrade React 16 → 19 (createRoot API)
- Upgrade react-router-dom 5 → 7 (Routes/Navigate)
- Upgrade framer-motion 2 → 12
- Replace moment.js with date-fns
- Replace lodash with native implementations
- Replace require() with ESM imports (Autocomplete)
- Rename all .js → .jsx for Vite OXC parser
- Add defensive guards for API failure handling
- Switch to pnpm, add .npmrc and .node-version
- Begin TypeScript migration: tsconfig, type defs, helpers.ts, analytics.ts
- Replace CRA README with project-specific documentation
- Configure 1Password CLI for secret management
Replace ElectionSelect dropdown with ElectionPicker component that
shows all upcoming elections grouped by date. When multiple elections
match a voter's state (e.g. Texas Dem/Rep primary runoffs on the same
day), an interstitial picker appears before loading results instead of
silently auto-selecting one.

After choosing an election, the picker persists inline on all results
routes so voters can switch between elections without re-searching.

- Add pendingElections/SET_PENDING_ELECTIONS to state and reducer
- Intercept multi-election case in Search before calling getLocations
- Create ElectionPicker component with grouped date display
- Wire picker into Site (interstitial) and all Results routes (inline)
- Guard Navigate in App.tsx against undefined redirect destination
- Remove unused ElectionSelect component
- Add tests for ElectionPicker and new reducer actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant