Skip to content

MBA-2247: Migrate angular2-hn to React + TypeScript - #706

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1787855677-migrate-angular2-hn-react
Open

MBA-2247: Migrate angular2-hn to React + TypeScript#706
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1787855677-migrate-angular2-hn-react

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Rebuilds the Hacker News PWA in React with feature parity, as a self-contained app under react/ (Vite + React 18 + TS strict + react-router v6 + vite-plugin-pwa + Vitest). No Angular files are modified or deleted — both implementations live side by side.

Key mappings from the Angular app:

  • Routes mirror app.routes.ts: //news/1; /{news,newest,show,ask,jobs}/:pageFeedPage; /item/:id and /user/:id are React.lazy-loaded (parity with Angular lazy modules).
  • HackerNewsAPIService → typed fetch client (src/api/hackerNewsApi.ts) with AbortController cleanup in useEffect; poll items fetch options id+1..id+n via Promise.all and compute poll_votes_count.
  • SettingsServiceSettingsProvider/useSettings() context with the same localStorage keys (theme, openLinkInNewTab, titleFontSize, listSpacing) and the same prefers-color-scheme fallback behavior when no theme is saved.
  • Theme engine (Default / Night / AMOLED Black): global SCSS ported essentially verbatim (not CSS modules) because _themes.scss cascades from a theme class onto global class names (.wrapper, .subtext, …); the app shell renders <div className={settings.theme}> exactly like app.component.html.
  • CommentPipeformatCommentCount() util; recursive Comment component with collapse and deleted states.
  • PWA: vite-plugin-pwa (generateSW) with ported manifest and icons, precaching the app shell + assets to mirror ngsw-config.json.
  • Tests: Vitest + React Testing Library (8 tests: util, settings context, Comment, Item, FeedPage, App smoke test replacing the protractor e2e).

Verification

In react/: npm run lint, npm run build (tsc --noEmit + vite build), npm test -- --run all pass; vite preview serves the app.

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/164e49519e9e4ee48c749f721bc49d48
Open in Devin Desktop: https://app.devin.ai/desktop/session/164e49519e9e4ee48c749f721bc49d48?variant=devin

@devin-ai-integration

Copy link
Copy Markdown
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, CI, and merge conflict 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