feature: port the React app shell, router, header, footer and settings modal (Phase 2a) - #573
Open
vibhaseshadri-cognition wants to merge 1 commit into
Conversation
…l to React 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 2a of the Angular → React migration: ports
AppComponent,app.routes.tsandsrc/app/core/*(header, footer, settings) intoweb/. The Angular app insrc/is untouched; the ported DOM structure, class names and copy are identical to the Angular templates.Appis now the router layout element (no morechildrenprop) and reproduces the Angular GA pageview subscription with auseLocation()effect:Routes live in
web/src/routes.tsxas aRouteObject[](plus anAppRouteswrapper overuseRoutes) so tests can mount the real table;main.tsxrenders<SettingsProvider><BrowserRouter><AppRoutes /></BrowserRouter></SettingsProvider>. The Angular per-feed child route withdata: {feedType}becomes one route per feed passing the prop:{ path: `${feedType}/:page`, element: <FeedPage feedType={feedType} /> }, and''→/news/1becomes an index route rendering<Navigate to="/news/1" replace />.Behavioural notes worth flagging:
NavLinksupplies theactiveclass thatrouterLinkActive="active"used to, so the header SCSS applies unchanged.(keyup); React usesonChange, which is equivalent here (fires per keystroke) and keeps the inputs controlled. Theme radios likewise move from(click)toonChange./assets/images/logo.svg); the Angular templates relied on<base href="/">, which Vite'sindex.htmldoes not have, so a relative path would break on/news/1-style URLs.Component SCSS is copied verbatim from the Angular components (only the
@importpaths retargeted toweb/src/styles/, then prettier-formatted).Tests
New Vitest + RTL suites (55 tests pass overall): route table per feed +
/redirect +/item/:id+/user/:id+ navigation via each header link (pages arevi.mocked since the real ones are placeholders until 2b–2d), GA firing on initial render and on navigation and staying silent whenwindow.gais undefined, header links/active state/scrollTop, settings modal open/close from the cog and×, and theme/font-size/list-spacing/new-tab controls updating both the context and localStorage.npm run lint,npm testandnpm run buildall pass inweb/.Screenshots
vite devon/news/1— the feed area is empty becauseFeedPageis still the Phase 2b placeholder:Link to Devin session: https://app.devin.ai/sessions/eca3fd83ff8741bf9f9367a1e437f89a
Requested by: @vibhaseshadri-cognition
Devin Review