feature: port the feed page and item row to React (Phase 2b) - #572
Open
vibhaseshadri-cognition wants to merge 1 commit into
Open
feature: port the feed page and item row to React (Phase 2b)#572vibhaseshadri-cognition wants to merge 1 commit into
vibhaseshadri-cognition wants to merge 1 commit into
Conversation
Co-Authored-By: Vibha Seshadri <vibha.seshadri@cognition.ai>
🤖 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:
|
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.
Summary
Phase 2b of the Angular → React migration: ports
feeds/feedandfeeds/itemfromsrc/app/intoweb/, replacing theFeedPageplaceholder and addingweb/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):
FeedPagere-fetches onfeedType/:pagechange and follows the RxJS semantics of the original:window.scrollTo(0, 0)runs only on the success path (the Angularcompletecallback never fires after an error), and the error path only setsCould not load ${feedType} stories.!items && errorMessage === ''→<Loader />,!items && errorMessage !== ''→<ErrorMessage />— so a failed page shows the error, not an infinite loader.*ngIf="feedType !== 'new'"guard around the<ol>is preserved verbatim even though no route uses anewfeed type (routes usenewest).listStart = (pageNum - 1) * 30 + 1drives both the<ol start>rank numbering and the prev-link visibility (listStart !== 1);More ›shows only for a full 30-item response.ItemmapshasUrl = item.url?.indexOf('http') === 0to an external<a href>(plus(domain)), otherwise an internal/item/:idlink. Angular'srouterLinkActive="active"is reproduced withNavLink, which appendsactivefor the current route. Job items drop user/points/comment links in both the palm and laptop subtexts.useSettings():titleFontSize→ titlefont-size,listSpacing→ wrappermargin-bottom,openLinkInNewTab→target="_blank"/rel="noopener"(attributes omitted entirely when off, as[attr.x]="null"does).feed.component.scssanditem.component.scssare copied verbatim with only the@importpaths rewritten to../styles/*.Tests
web/src/pages/FeedPage.test.tsx(11) andweb/src/feeds/Item.test.tsx(11) cover loading, loaded list + rank numbering across pages, default page when:pageis absent, error copy, pagination boundaries (page 1 hides prev, 30 items showsMore ›, 29 hides it), navigating to page 2 refetching, jobs blurb + missinglist-margin, url vs non-url vs missing-url items, job items,discussvsn comments, and the new-tab/font-size/spacing settings.npm run lint,npm test(49 passing) andnpm run buildall pass inweb/.Link to Devin session: https://app.devin.ai/sessions/2725efbf76454adaa9c4123226acf5b3
Requested by: @vibhaseshadri-cognition
Devin Review