Skip to content

Conversation

@devin-ai-integration
Copy link

Migrate Angular 9 Hacker News client to React 18

Summary

This PR performs a complete framework migration from Angular 9 to React 18 for the Hacker News client application. The migration includes:

Phase 1 - Foundation Setup:

  • Replaced Angular bootstrap with React 18 entry point using Vite
  • Converted App Component to React functional component with React Router v6
  • Set up TypeScript configuration for React with strict mode
  • Configured ESLint for React

Phase 2 - Core Feature Migration:

  • Converted HackerNewsAPIService to React Query hooks (useHackerNews.ts)
  • Converted SettingsService to React Context + custom hook pattern (SettingsContext.tsx)
  • Migrated FeedComponent and ItemComponent to React functional components

Phase 3 - Advanced Features:

  • Migrated ItemDetailsComponent, CommentComponent (with recursive rendering), and UserComponent
  • Converted all CoreModule components (Header, Footer, Settings)
  • Migrated shared components (Loader, ErrorMessage)

Phase 4 - PWA & Optimization:

  • Replaced Angular Service Worker with Workbox via vite-plugin-pwa
  • Implemented lazy loading with React.lazy() and Suspense
  • Migrated all styles and themes (default, night, amoledblack)

Review & Testing Checklist for Human

This is a high-risk PR due to the complete framework rewrite. Please verify the following:

  • Run the app locally (npm install && npm run dev) and verify the home page loads with news feed items
  • Test all routes: /news/:page, /newest/:page, /show/:page, /ask/:page, /jobs/:page, /item/:id, /user/:id
  • Test pagination - navigate between pages on feed views
  • Test settings panel - verify theme switching (default/night/amoledblack), font size, and link behavior settings persist in localStorage
  • Test item details - click on a story and verify comments render correctly with collapsible nested threads
  • Verify PWA functionality - check that the app can be installed and works offline after initial load

Recommended test plan:

  1. Run npm install && npm run dev
  2. Open http://localhost:5173 in browser
  3. Navigate through different feed types and pages
  4. Click on a story to view details and comments
  5. Open settings and change theme, verify it persists after refresh
  6. Check browser DevTools Network tab for API calls to node-hnapi.herokuapp.com
  7. Run npm run build to verify production build succeeds

Notes

  • The build succeeds with SCSS deprecation warnings (expected for older Sass syntax)
  • Original Angular tests were removed; no new tests were added in this migration
  • The original E2E tests (Protractor) were removed; consider adding Cypress/Playwright tests as a follow-up

Link to Devin run: https://app.devin.ai/sessions/ce342de433804bf6a07c9cae9cc126a3
Requested by: Satwik Bebortha (satwik.bebortha@cognition.ai) / @satwik-cog

This is a complete framework migration from Angular 9 to React 18:

Phase 1 - Foundation Setup:
- Replace Angular bootstrap with React 18 entry point (main.tsx)
- Convert App Component to React functional component (App.tsx)
- Set up React Router v6 with all routes
- Configure Vite build system with TypeScript support
- Set up ESLint for React

Phase 2 - Core Feature Migration:
- Convert FeedComponent to React with useParams/useLocation hooks
- Convert ItemComponent to React functional component with props
- Convert HackerNewsAPIService to React Query hooks (useHackerNews.ts)
- Convert SettingsService to React Context + custom hook pattern
- Preserve localStorage persistence and system theme detection

Phase 3 - Advanced Features:
- Convert ItemDetailsComponent to React functional component
- Convert CommentComponent with recursive rendering capability
- Convert UserComponent to React functional component
- Migrate CoreModule components (Header, Footer, Settings)
- Migrate shared components (Loader, ErrorMessage)

Phase 4 - PWA & Optimization:
- Replace Angular Service Worker with Workbox (via vite-plugin-pwa)
- Implement offline caching strategies for HN API
- Implement lazy loading with React.lazy() and Suspense
- Migrate all styles and themes (default, night, amoledblack)

Technical Details:
- React 18 with React Router v6
- React Query for data fetching
- Vite for build system
- TypeScript with strict mode
- SCSS for styling
- PWA support with Workbox

Co-Authored-By: Satwik Bebortha <satwik.bebortha@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