Skip to content

Add a route and full page for PostDetail.tsx with nested comment threading #4

Description

@Benalex8797

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

  • /forum/:postId renders the correct post
  • Comments display in order with correct author info
  • Submitting the comment form calls addComment and the new comment appears without page reload
  • 404 state is handled gracefully
  • Page is fully mobile-responsive using existing Tailwind patterns

Deliverables

  • Updated App.tsx (new route)
  • Completed PostDetail.tsx
  • Updated Comment interface in ForumContext.tsx

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions