Skip to content

feature: port the feed page and item row to React (Phase 2b) - #572

Open
vibhaseshadri-cognition wants to merge 1 commit into
devin/1785951605-react-phase1-scaffoldfrom
devin/1786020221-react-feed
Open

feature: port the feed page and item row to React (Phase 2b)#572
vibhaseshadri-cognition wants to merge 1 commit into
devin/1785951605-react-phase1-scaffoldfrom
devin/1786020221-react-feed

Conversation

@vibhaseshadri-cognition

@vibhaseshadri-cognition vibhaseshadri-cognition commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Phase 2b of the Angular → React migration: ports feeds/feed and feeds/item from src/app/ into web/, replacing the FeedPage placeholder and adding web/src/feeds/Item.tsx. DOM structure, class names, copy and SCSS are kept identical to the Angular templates so both apps render the same markup.

Behavioural notes worth calling out (all mirror the Angular components rather than "fixing" them):

  • FeedPage re-fetches on feedType/:page change and follows the RxJS semantics of the original: window.scrollTo(0, 0) runs only on the success path (the Angular complete callback never fires after an error), and the error path only sets Could not load ${feedType} stories.
  • The loading/error/loaded rendering keeps the original three-way condition — !items && errorMessage === ''<Loader />, !items && errorMessage !== ''<ErrorMessage /> — so a failed page shows the error, not an infinite loader.
  • The *ngIf="feedType !== 'new'" guard around the <ol> is preserved verbatim even though no route uses a new feed type (routes use newest).
  • listStart = (pageNum - 1) * 30 + 1 drives both the <ol start> rank numbering and the prev-link visibility (listStart !== 1); More › shows only for a full 30-item response.
  • Item maps hasUrl = item.url?.indexOf('http') === 0 to an external <a href> (plus (domain)), otherwise an internal /item/:id link. Angular's routerLinkActive="active" is reproduced with NavLink, which appends active for the current route. Job items drop user/points/comment links in both the palm and laptop subtexts.
  • Settings are read through useSettings(): titleFontSize → title font-size, listSpacing → wrapper margin-bottom, openLinkInNewTabtarget="_blank"/rel="noopener" (attributes omitted entirely when off, as [attr.x]="null" does).

feed.component.scss and item.component.scss are copied verbatim with only the @import paths rewritten to ../styles/*.

Tests

web/src/pages/FeedPage.test.tsx (11) and web/src/feeds/Item.test.tsx (11) cover loading, loaded list + rank numbering across pages, default page when :page is absent, error copy, pagination boundaries (page 1 hides prev, 30 items shows More ›, 29 hides it), navigating to page 2 refetching, jobs blurb + missing list-margin, url vs non-url vs missing-url items, job items, discuss vs n comments, and the new-tab/font-size/spacing settings. npm run lint, npm test (49 passing) and npm run build all pass in web/.

Link to Devin session: https://app.devin.ai/sessions/2725efbf76454adaa9c4123226acf5b3
Requested by: @vibhaseshadri-cognition


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 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.

1 participant