Skip to content

feat: scaffold React foundation for Angular-to-React migration#260

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1778876483-react-foundation
Open

feat: scaffold React foundation for Angular-to-React migration#260
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1778876483-react-foundation

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented May 15, 2026

Summary

Sets up the React foundation in react-app/ that other parallel migration sessions will build upon. This PR includes:

  1. Vite scaffoldreact-ts template with react-router-dom, sass, and vite-plugin-pwa installed
  2. TypeScript models — Converted Angular classes to interfaces: Story, Comment, User, Settings, PollResult, plus FeedType type alias
  3. API servicehackerNewsApi.ts replacing RxJS Observables with async/await fetch calls (fetchFeed, fetchItemContent, fetchPollContent, fetchUser)
  4. Utility functionformatCommentCount (ported from Angular pipe)
  5. Placeholder stubs — Pages (FeedPage, ItemDetailsPage, UserPage) and components (Header, Footer, Settings, FeedItem, Comment, Loader, ErrorMessage) so parallel sessions can merge without import errors

Additionally fixed a bug caught by Devin Review: FeedType was incorrectly defined as feed endpoint categories ('news' | 'newest' | ...) instead of API item types ('poll' | 'story' | 'job'), which would have made the story.type === 'poll' check in fetchItemContent unreachable from TypeScript's perspective.

Review & Testing Checklist for Human

  • Verify cd react-app && npm install && npx tsc --noEmit compiles without errors
  • Confirm model interfaces match the original Angular models in src/app/shared/models/
  • Run cd react-app && npm run dev to confirm the Vite dev server starts

Notes

  • FeedType was corrected to 'poll' | 'story' | 'job' to match the original Angular source at src/app/shared/models/feed-type.type.ts and ensure fetchItemContent's poll-handling logic works correctly
  • User.crated_time and Story.time_ago: number preserve pre-existing bugs from the original Angular models for migration parity — can be corrected in a follow-up PR

Link to Devin session: https://app.devin.ai/sessions/3202893d19f64915a522e06cc821ca1a
Requested by: @matthewguerra-cog


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)
Open in Devin Review

…laceholder components

- Scaffold react-app/ with Vite react-ts template
- Install react-router-dom, sass, vite-plugin-pwa
- Port TypeScript models: Story, Comment, User, Settings, PollResult
- Create hackerNewsApi service with async/await (replaces RxJS)
- Create formatCommentCount utility (replaces Angular pipe)
- Add placeholder stubs for pages and components so parallel sessions can merge without import errors

Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
@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 and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread react-app/src/models/story.ts Outdated
points: number;
user: string;
time: number;
time_ago: number;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Story.time_ago typed as number but the API returns a string

The HN API returns time_ago as a human-readable string (e.g. "3 hours ago"). The Comment model at react-app/src/models/comment.ts:6 correctly types it as string, but Story.time_ago is typed as number. Any component that renders story.time_ago with number-specific formatting, or any code that performs arithmetic on it, will behave incorrectly. This is a pre-existing bug copied from the Angular model (src/app/shared/models/story.ts:11).

Suggested change
time_ago: number;
time_ago: string;
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged — the original Angular model at src/app/shared/models/story.ts:12 also has time_ago: number. This is a pre-existing bug from the Angular source that was intentionally preserved for parity during the migration. A follow-up PR can correct it to string to match the API response.

@@ -0,0 +1,8 @@
export interface User {
id: string;
crated_time: number;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 User.crated_time is a typo for created_time, causing field to be undefined at runtime

The field crated_time at react-app/src/models/user.ts:3 is a typo for created_time, which is the actual field name returned by the node-hnapi. When an API response is cast to User, the real created_time value exists on the runtime object but TypeScript only exposes crated_time (which is undefined). Any code accessing user.crated_time will get undefined. This is a pre-existing bug copied from src/app/shared/models/user.ts:3.

Suggested change
crated_time: number;
created_time: number;
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged — crated_time matches the original Angular model at src/app/shared/models/user.ts:3. This typo was intentionally preserved for migration parity. A follow-up PR can correct it to created_time.

Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
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