Skip to content

Phase 5: Item Details & Recursive Comments#313

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

Phase 5: Item Details & Recursive Comments#313
vibhaseshadri-cognition wants to merge 5 commits into
masterfrom
devin-06.09.2026-vibha/react-migration-phase5

Conversation

@vibhaseshadri-cognition

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

Copy link
Copy Markdown

Summary

Implements the item details page and recursive comment component.

ItemDetailsPage (src/pages/ItemDetailsPage.tsx):

  • Fetches item by ID via fetchItemContent, shows Loader/ErrorMessage
  • Back button via useNavigate(-1) (mobile)
  • Title with external/internal link logic + domain display
  • Subtext: points, user link, time_ago, comment count
  • Poll results rendering: width: points/poll_votes_count*100% bar per option
  • Item content via dangerouslySetInnerHTML
  • Mobile (fixed header with back arrow) vs laptop (inline) layouts

Comment (src/components/comments/Comment.tsx):

  • Recursive: renders comment.comments children
  • Collapse/expand toggle [+]/[-]
  • Deleted comment display: [deleted] | Comment Deleted
  • User link, time_ago, content via dangerouslySetInnerHTML

Depends on Phase 4 (#312).

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 5 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>
@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