Skip to content

Conversation

@devin-ai-integration
Copy link

Migrate Angular 9 Hacker News PWA to React 18 with Vite

Summary

This PR completes a full migration of the Hacker News PWA from Angular 9 to React 18, replacing the entire build system and application architecture:

Build System: Replaced Angular CLI with Vite, including Vite PWA plugin for service worker generation.

Services → Hooks/Context:

  • HackerNewsAPIServiceuseHackerNewsAPI hook (async/await instead of RxJS Observables)
  • SettingsServiceSettingsContext with React Context API

Routing: Replaced Angular Router with React Router v6, including lazy loading for ItemDetails and User components.

Components: All Angular components converted to React functional components with hooks (Header, Footer, Feed, Item, ItemDetails, Comment, User, Settings, Loader, ErrorMessage).

Styling: Migrated all SCSS files with three theme support (default, night, amoledblack) and responsive design.

Review & Testing Checklist for Human

This is a complete framework rewrite with no automated tests, so thorough manual testing is essential:

  • Test all feed routes: Navigate to /news/1, /newest/1, /show/1, /ask/1, /jobs/1 and verify items load correctly with pagination
  • Test item details: Click on an item to view /item/:id - verify comments render with proper nesting and collapse/expand works
  • Test poll items: Find a poll item and verify poll results display with vote counts and progress bars
  • Test user profiles: Click on a username to view /user/:id - verify user info displays correctly
  • Test theme switching: Open settings and switch between default, night, and amoledblack themes - verify colors change and persist after refresh
  • Test settings persistence: Change font size, list spacing, and "open links in new tab" - verify they persist after page refresh
  • Test mobile responsiveness: Test on mobile viewport (768px breakpoint) - verify header navigation and back buttons work
  • Test PWA: Verify the app can be installed and service worker registers correctly

Recommended test plan: Run npm run dev locally, then systematically test each route and feature listed above. Pay special attention to edge cases like empty feeds, deleted comments, and items without URLs.

Notes

  • Build passes with Sass deprecation warnings (about @import rules and slash division) - these are warnings about future Sass versions, not errors
  • The API endpoint https://node-hnapi.herokuapp.com is unchanged from the original Angular app
  • No automated tests were added (original Angular tests were removed)

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

Phase 1: Project Setup & Build System
- Initialize React 18 project with Vite build system
- Configure ESLint for React with recommended rules
- Set up Vite PWA plugin for service worker support
- Update package.json with React dependencies

Phase 2: Core Services Migration
- Convert HackerNewsAPIService to useHackerNewsAPI hook
- Convert SettingsService to React Context (SettingsContext)
- Implement localStorage persistence for settings
- Add system dark mode detection

Phase 3: Simple Components Migration
- Convert Header, Footer, Item, Comment, Loader, ErrorMessage components
- Implement React functional components with hooks

Phase 4: Routing System Migration
- Replace Angular Router with React Router v6
- Implement lazy loading for ItemDetails and User components
- Configure all routes: news, newest, show, ask, jobs, item, user

Phase 5: Complex Components Migration
- Convert Feed, ItemDetails, User, Settings components
- Implement pagination, poll support, and comment threading

Styling:
- Migrate all SCSS files with theme support (default, night, amoledblack)
- Implement responsive design for mobile and desktop
- Move assets to public folder for Vite

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