Skip to content

Phase 7: Router & App Shell Integration#315

Open
vibhaseshadri-cognition wants to merge 7 commits into
masterfrom
devin-06.09.2026-vibha/react-migration-phase7
Open

Phase 7: Router & App Shell Integration#315
vibhaseshadri-cognition wants to merge 7 commits into
masterfrom
devin-06.09.2026-vibha/react-migration-phase7

Conversation

@vibhaseshadri-cognition

@vibhaseshadri-cognition vibhaseshadri-cognition commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Wires up the full router and integrates all components into the app shell.

App.tsx rewrite:

/ → Navigate to /news/1
/news/:page, /newest/:page, /show/:page, /ask/:page, /jobs/:page → FeedPage(feedType)
/item/:id → ItemDetailsPage
/user/:id → UserPage
  • Root div className={settings.theme} — dynamic theme from SettingsContext (replaces Phase 1 hardcoded "default")
  • SettingsProvider wraps entire app
  • GATracker component tracks route changes via useLocation + ga('send', 'pageview')
  • Layout: HeaderRoutesFooter inside body-cover + wrapper structure

Depends on Phase 6 (#314).

Link to Devin session: https://app.devin.ai/sessions/0bb1dd94ecbc4422a76b7a458d0f4e7c
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)

devin-ai-integration Bot and others added 7 commits June 9, 2026 16:57
- Replace Angular build config with Vite + React 18 setup
- Create vite.config.ts, tsconfig.json, package.json with React deps
- Add entry points: src/main.tsx, src/App.tsx, index.html
- Port SCSS theming files (_themes.scss, _theme_variables.scss, _media.scss)
- Define TypeScript interfaces in src/types/ (Story, Comment, User, Settings, PollResult, FeedType)
- Move static assets to public/ directory for Vite serving
- Remove Angular-specific files: angular.json, tsconfig.app/spec.json, tslint.json, karma.conf.js, ngsw-config.json, browserslist, polyfills.ts, test.ts, all *.module.ts files
- Remove Angular dependencies, add react, react-dom, react-router-dom v6
- Verify npm run dev starts and app shell renders

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- Add src/services/hackernews-api.ts: fetchFeed, fetchItemContent (with poll sub-fetching via Promise.all), fetchPollContent, fetchUser using plain fetch
- Add src/contexts/SettingsContext.tsx: React Context + useReducer for Settings state, localStorage persistence, system dark mode detection with matchMedia listener
- Add src/components/shared/Loader.tsx + SCSS: CSS loading animation ported from Angular
- Add src/components/shared/ErrorMessage.tsx + SCSS: skull error display ported from Angular
- Add src/utils/formatComment.ts: replaces Angular CommentPipe (0→'discuss', 1→'1 comment', n→'n comments')
- Update tsconfig.json include paths for new directories

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- Add Header with NavLink navigation, logo, settings toggle, scrollTo(0,0) on nav clicks
- Add Footer with static content matching Angular template
- Add Settings panel with theme radios, open-in-new-tab checkbox, font size and list spacing inputs
- All components consume SettingsContext
- Port all SCSS styles from Angular components

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- FeedPage: paginated feed with loader/error states, 30 items/page, prev/more navigation
- ItemRow: story row with external/internal link logic, domain, points, user, time_ago, comment count
- Respects settings: titleFontSize, listSpacing, openLinkInNewTab
- Mobile/laptop responsive layouts via subtext-palm/subtext-laptop
- Jobs feed special header text
- SCSS ported from Angular feed and item components

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- ItemDetailsPage: fetches item by ID, back button via useNavigate(-1), poll results with percentage bars, dangerouslySetInnerHTML for content, mobile/laptop responsive layouts
- Comment: recursive rendering of nested comments, collapse/expand toggle, deleted comment display
- SCSS ported from Angular item-details and comment components

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- UserPage: fetches user by ID, back button via useNavigate(-1), profile display with username, karma, created date, about (dangerouslySetInnerHTML)
- Mobile/laptop responsive layout ported from Angular
- Loader/ErrorMessage for loading/error states

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- Wire up react-router-dom v6 Routes in App.tsx
- / redirects to /news/1
- /news/:page, /newest/:page, /show/:page, /ask/:page, /jobs/:page → FeedPage with feedType prop
- /item/:id → ItemDetailsPage, /user/:id → UserPage
- Theme class on root div from SettingsContext (dynamic: default/night/amoledblack)
- SettingsProvider wraps entire app
- GA tracking via useLocation hook on route changes
- Header + Routes (Outlet equivalent) + Footer layout

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