Skip to content

feat: Initialize React Setup for Angular to React Migration (Phase 1)#160

Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1770217260-react-migration-phase1
Open

feat: Initialize React Setup for Angular to React Migration (Phase 1)#160
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1770217260-react-migration-phase1

Conversation

@devin-ai-integration
Copy link

Summary

This PR sets up the initial React project structure for migrating the Angular 2 Hacker News client to React. A new react-app directory is created alongside the existing Angular code, containing a complete Vite + React + TypeScript setup with the core dependencies needed to replace Angular's functionality.

Key additions:

  • React application with Vite build tooling and TypeScript
  • React Router configured with routes matching the Angular app (/news/:page, /newest/:page, /show/:page, /ask/:page, /jobs/:page, /item/:id, /user/:id)
  • React Query hooks (useFeed, useItemContent, useUser) replacing RxJS observables
  • HackerNews API service with the same endpoints as the Angular service
  • PWA configuration with Workbox for service worker and API caching
  • TypeScript types for Story, Comment, User, and PollResult models

The build compiles successfully with npm run build.

Review & Testing Checklist for Human

  • Missing PWA assets: The vite.config.ts references icon files (pwa-192x192.png, pwa-512x512.png, apple-touch-icon.png, logo.svg) that are not included in the public/ folder. These need to be added or copied from the Angular app's assets before the PWA will work correctly.

  • Security review for dangerouslySetInnerHTML: Used in ItemDetails.tsx and User.tsx to render HTML content from the API. Verify the API sanitizes this content appropriately.

  • Verify API service logic: Review hackernews-api.ts poll handling logic matches the Angular implementation in src/app/shared/services/hackernews-api.service.ts.

  • Run the React app locally: Execute cd react-app && npm install && npm run dev and verify the app loads and fetches data correctly at http://localhost:4200.

  • ESLint not installed: The package.json has a lint script but ESLint is not in dependencies. Either add ESLint or remove the lint script.

Notes

This is Phase 1 of the migration - setting up the foundation. The route components are functional placeholders that will be fully styled and feature-complete in subsequent phases.

Link to Devin run: https://app.devin.ai/sessions/9c8a77cea6f34096a135137ba4d1abf8
Requested by: piyush@cognition.ai

- Set up new React application with Vite and TypeScript in react-app directory
- Install core dependencies: React Router, React Query, Workbox for PWA
- Create basic project structure with routes, services, hooks, and types
- Implement HackerNews API service to replace Angular's RxJS-based service
- Add React Query hooks for data fetching (useFeed, useItemContent, useUser)
- Configure Vite with PWA plugin and service worker support
- Set up routing structure matching Angular's app.routes.ts
- Add placeholder components for Feed, ItemDetails, and User routes
- Configure TypeScript with strict mode and path aliases

Co-Authored-By: piyush@cognition.ai <piyush@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.

0 participants