feat: add ItemDetails, Comment, and UserProfile pages (Step 4)#248
feat: add ItemDetails, Comment, and UserProfile pages (Step 4)#248devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Port Angular item-details, comment, and user components to React: - ItemDetails: fetches item by id, renders title/points/user/time_ago/URL, supports poll vote bar charts, renders nested Comment components - Comment: recursive component with collapsible toggle, indentation by level, dangerouslySetInnerHTML for content, links to user profiles - UserProfile: fetches user by id, renders id/karma/created/about Also adds 'content' field to Story type (used by Ask HN posts). All components use Loader/ErrorMessage for loading/error states. Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Original prompt from Eashan
|
🤖 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:
|
Summary
Step 4 of the Angular-to-React migration. Ports the following Angular components to React + TypeScript:
src/pages/ItemDetails.tsx— Ported fromitem-details.component.ts/.html. UsesuseParams()for item id,fetchItem()for data. Renders title, points, user link, time_ago, URL. Supports polls with vote bar charts. Renders nested<Comment>components. Shows<Loader />/<ErrorMessage />for loading/error states.src/components/Comment.tsx— Ported fromcomment.component.ts/.html. Recursive component for nested comment threads. Collapsible toggle viauseState. Indents based oncomment.level. Renderstime_ago, user link, and content viadangerouslySetInnerHTML.src/pages/UserProfile.tsx— Ported fromuser.component.ts/.html. UsesuseParams()for user id,fetchUser()for data. Displays id, karma, created date, and about (HTML). Shows<Loader />/<ErrorMessage />.src/types/Story.ts— Addedcontentfield (used by Ask HN / text posts).Both page components are exported as
defaultforReact.lazyintegration (to be wired up by the integration session).Build passes:
npm run buildsucceeds with no errors.Review & Testing Checklist for Human
ItemDetailsrenders correctly for different post types (links, Ask HN, Show HN, jobs, polls)Commentcomponent handles deeply nested comments and collapsed stateUserProfilerenders user info and HTML "about" sections safelyNotes
@mediabreakpoints.Story.pollarray returned byfetchItem().React.lazy()— the routing integration session will set that up.Link to Devin session: https://app.devin.ai/sessions/577c217a6c0349ff99ddbe7389f2e01e
Requested by: @eashansinha
Devin Review