Category: Feature / Routing
Difficulty: High
Description
src/PostDetail.tsx exists as a file but has no route registered in App.tsx. The forum currently has no way to view a single post with its full comment thread. All posts in ForumFeed.tsx are clickable but navigate nowhere meaningful.
Problem Statement
App.tsx has 25+ routes but is missing /forum/:postId. PostDetail.tsx is an orphaned file. ForumContext already has addComment implemented but it's never triggered from a post detail view.
Technical Requirements
- Register
/forum/:postId in App.tsx
PostDetail.tsx must: fetch the post from ForumContext by id param via useParams, display full post content, render all comments in chronological order with author avatar, timestamp, and content
- Add nested reply support: each comment can have one level of replies (replies stored as
replies: Comment[] on the parent Comment interface)
- Implement an inline comment form that calls
addComment from context
- Handle the 404 case: if
postId doesn't match any post, show an error state with a "Back to Forum" CTA
- Use
useNavigate(-1) for the back button — do not hardcode /forum
Acceptance Criteria
Deliverables
- Updated
App.tsx (new route)
- Completed
PostDetail.tsx
- Updated
Comment interface in ForumContext.tsx
Category: Feature / Routing
Difficulty: High
Description
src/PostDetail.tsxexists as a file but has no route registered inApp.tsx. The forum currently has no way to view a single post with its full comment thread. All posts inForumFeed.tsxare clickable but navigate nowhere meaningful.Problem Statement
App.tsxhas 25+ routes but is missing/forum/:postId.PostDetail.tsxis an orphaned file.ForumContextalready hasaddCommentimplemented but it's never triggered from a post detail view.Technical Requirements
/forum/:postIdinApp.tsxPostDetail.tsxmust: fetch the post fromForumContextbyidparam viauseParams, display full post content, render allcommentsin chronological order with author avatar, timestamp, and contentreplies: Comment[]on the parentCommentinterface)addCommentfrom contextpostIddoesn't match any post, show an error state with a "Back to Forum" CTAuseNavigate(-1)for the back button — do not hardcode/forumAcceptance Criteria
/forum/:postIdrenders the correct postaddCommentand the new comment appears without page reloadDeliverables
App.tsx(new route)PostDetail.tsxCommentinterface inForumContext.tsx