Skip to content

Conversation

@devin-ai-integration
Copy link

Phase 1: Initialize React Project Infrastructure for Angular to React Migration

Summary

This PR establishes the foundational infrastructure for migrating the Angular 9 Hacker News client to React. It creates a new React + TypeScript application using Vite, configures routing to match all existing Angular routes, and implements state management for application settings with theme support.

Key Changes:

  • ✅ New React + TypeScript project created in /react-app subdirectory using Vite
  • ✅ React Router configured with all 7 routes matching Angular routing structure
  • ✅ Settings Context API implemented with theme management, system preference detection, and localStorage persistence
  • ✅ Placeholder page components created (Feed, ItemDetails, User) ready for future implementation
  • ✅ Lint passing (fixed pre-installed use-toast.ts lint error)
  • ✅ Tested locally: routing works, theme switching functional, no console errors

What's NOT included (by design):

  • No Hacker News API service implementation yet
  • No actual data fetching or display logic
  • Page components are placeholders showing route parameters only

Review & Testing Checklist for Human

This is infrastructure setup with moderate risk. Please verify:

  • Test all 7 routes manually: Navigate to /news/1, /newest/1, /show/1, /ask/1, /jobs/1, /item/123, /user/testuser and verify each route renders correctly
  • Theme switching: Click Light/Dark buttons and verify UI changes. Refresh page and confirm theme persists (check localStorage in DevTools)
  • System dark mode: Toggle your OS dark mode preference and verify the app detects it on load (if no theme saved in localStorage)
  • Settings Context: Open browser DevTools → Application → Local Storage and verify theme, openLinkInNewTab, titleFontSize, listSpacing are being saved
  • Review dependencies: Check react-app/package.json - large dependency list from shadcn/ui scaffold. Consider if all components will be needed

Notes

  • Large diff warning: This PR includes 81 files (12,747 insertions) mostly from Vite + shadcn/ui scaffolding. Core custom files are: App.tsx, SettingsContext.tsx, settings.ts, and the 3 page components.
  • Lint warning exists: SettingsContext.tsx has a React Hooks exhaustive-deps warning (not an error). This is acceptable for Phase 1 but worth noting.
  • Modified scaffolded file: Fixed lint error in pre-installed src/hooks/use-toast.ts by converting const to type definition.

Link to Devin run: https://app.devin.ai/sessions/d83e0f9ca9c44669a5a976f8e0ce006e
Requested by: Gabe Smith (gabriel.smith@cognition.ai)

… migration

- Created new React + TypeScript project with Vite inside angular2-hn repo
- Installed and configured React Router with all Angular routes:
  * Feed routes: /news/:page, /newest/:page, /show/:page, /ask/:page, /jobs/:page
  * Item details: /item/:id
  * User profile: /user/:id
- Implemented Settings Context API for state management:
  * Theme management (default/night) with system preference detection
  * localStorage persistence for all settings (theme, openLinkInNewTab, titleFontSize, listSpacing)
  * System dark mode preference detection using window.matchMedia
- Created placeholder page components (Feed, ItemDetails, User)
- Fixed lint error in pre-installed use-toast.ts hook
- Tested locally: app runs, routing works, theme switching functional

This establishes the foundation for migrating the Angular Hacker News client to React.

Co-Authored-By: Gabe Smith <gabriel.smith@cognition.ai>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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