feat: Set up React project and migrate ItemComponent from Angular#163
Open
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Open
feat: Set up React project and migrate ItemComponent from Angular#163devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Conversation
- Initialize React project with Vite + TypeScript in react-hn directory - Install react-router-dom v6 - Set up router mirroring Angular routes with lazy loading for item/user - Create SettingsContext with localStorage integration and useSettings hook - Create API service layer (fetchFeed, fetchItemContent, fetchUser) - Define Story and Settings TypeScript interfaces - Migrate ItemComponent with conditional rendering, dynamic styles, and responsive layouts - Port Item CSS with mobile/desktop breakpoints - Create Feed component using ItemComponent with data fetching - Add formatComment utility (Angular pipe equivalent) Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Comment on lines
+7
to
+9
| interface FeedProps { | ||
| feedType: string; | ||
| } |
There was a problem hiding this comment.
Add a comment explaining what this is
Author
There was a problem hiding this comment.
Added an explanatory comment at the top of Feed.tsx describing the component's purpose, accepted props, and its Angular origin. See commit ea17f9d.
Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Set up React project and migrate ItemComponent from Angular
Summary
Initializes a new React + TypeScript + Vite project in
react-hn/alongside the existing Angular app, as Phase 1 of the Angular-to-React migration. Key additions:react-router-domv6/news/:page,/newest/:page,/show/:page,/ask/:page,/jobs/:page,/item/:id,/user/:id) with lazy loading viaReact.lazy/Suspensefor item details and user routesuseSettingshook replacing Angular'sSettingsService, with localStorage persistence foropenLinkInNewTab,theme,titleFontSize,listSpacing, and system dark-mode detectionfetchFeed,fetchItemContent,fetchUserusingfetch/async-await(replacing RxJS Observables), pointed athttps://node-hnapi.herokuapp.comItemComponent— conditional external/internal links, dynamic font-size/spacing from settings,target="_blank"toggle, mobile (.subtext-palm) and desktop (.subtext-laptop) layouts,formatCommentutility replacing the Angular pipeuseReducerfor state, renderingItemcomponents with data from the APITypeScript (
tsc -b) and ESLint both pass. Vite production build succeeds.Local Testing
App verified locally at
http://localhost:5173/news/1. The feed loads and renders Item components with live data from the HN API.News feed (

/news/1):Item details placeholder (

/item/:id):Review & Testing Checklist for Human
https://node-hnapi.herokuapp.comwas carried over from the Angular app. Heroku discontinued free dynos — verify this endpoint is still reachable or replace it with a working HN API before testingItem.css: Bare selectors likepandawill apply globally, not scoped to the Item component. Consider whether CSS Modules or a scoping strategy is needed before more components are addedindex.css,App.css,public/vite.svg,src/assets/react.svg, and the defaultREADME.mdare all scaffold leftovers that may conflict with or clutter the actual appcd react-hn && npm run dev) and verify the news feed renders correctly in the browser athttp://localhost:5173/news/1ItemDetailsandUserplaceholder routes lazy-load without errorsNotes
StoryTypeScript interface is intentionally a subset of the Angular model (omitscomments,poll,poll_votes_count,deleted,dead) since those fields aren't needed by the Item component. They'll be added in future migration phases.SettingsContext.tsx(provider component) andsettingsContextDef.ts(context + types) to satisfy thereact-refresh/only-export-componentsESLint rule.fetchUserhas no explicit return type since theUserinterface hasn't been defined yet.Link to Devin run: https://app.devin.ai/sessions/89678be280b041c5afaff1f26985312d
Requested by: @matthewguerra-cog