Skip to content

[#189] Per-plot comment system with pagination#229

Merged
realproject7 merged 2 commits intomainfrom
task/189-comment-section
Mar 16, 2026
Merged

[#189] Per-plot comment system with pagination#229
realproject7 merged 2 commits intomainfrom
task/189-comment-section

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • CommentSection component: wallet signature auth, 20 per page with "Show more", relative timestamps, 1000 char limit
  • Integrated into story page (genesis comments) and plot detail pages (per-chapter comments)
  • Server-side rate limiting (1 comment per address per plot per minute) via API from PR [#185] DB schema: title column on plots + comments table + API #225
  • Hidden comments filtered by RLS policy

Test plan

  • Post comment on genesis — requires wallet signature (no tx)
  • Post comment on chapter page — same flow
  • Comments display with truncated address + relative time
  • "Show more" loads next page when 20+ comments
  • Rate limit: second comment within 1 min returns error
  • Unauthenticated users see "Connect wallet to comment"
  • Mobile responsive (375px)

Fixes #189

🤖 Generated with Claude Code

CommentSection component:
- Wallet signature auth for posting (not a transaction)
- 20 comments per page with "Show more" pagination
- Each comment: truncated address, content, relative timestamp
- Rate limit handled server-side (1 per address per plot per minute)
- Max 1000 chars, live counter
- Connect wallet prompt for unauthenticated users

Integrated into:
- Story page (genesis plot comments)
- Plot detail pages (per-chapter comments)

Fixes #189

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES

Summary

The comment UI is close, but the pagination behavior is incorrect. Show more switches the query to the next page and replaces the rendered list instead of appending additional comments, so the component does not actually behave like incremental pagination.

Findings

  • [high] Show more drops earlier comments instead of appending them
    • File: src/components/CommentSection.tsx:55
    • File: src/components/CommentSection.tsx:64
    • Suggestion: keep previously loaded pages in local state or use an infinite-query pattern so clicking Show more appends page 2+ onto the existing comment list. Right now page changes the query key, comments is assigned from data?.comments, and the render only shows the latest page response.

Decision

Requesting changes because issue #189 explicitly calls for pagination with a Show more interaction, and the current implementation replaces page 1 with page 2 rather than loading additional comments.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2b: APPROVE

Well-built comment system:

  • Auth: Wallet signature with message binding to specific comment — matches API contract from PR #225
  • Fetching: React Query with page/limit pagination, 30s staleTime, proper cache invalidation on post
  • UX: Relative timestamps, char counter, loading/empty/error states, connect wallet prompt
  • Integration: Correctly wired into both genesis (story page) and chapter detail pages

Non-blocking note: "Show more comments" replaces content (page change) rather than appending (infinite scroll). The label implies additive behavior — consider renaming to "Next page" or accumulating results in a future pass.

First page fetched via useQuery, additional pages appended to
extraComments state on "Show more" click. New comments reset
accumulated pages and refetch. Addresses T2a review feedback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The follow-up change fixes the pagination bug by accumulating additional comment pages instead of replacing the first page. The comment section now matches the Show more behavior required by #189 on both genesis and plot-detail pages, and the updated head passes GitHub lint-and-typecheck.

Findings

  • None.

Decision

Approving because the previously blocking pagination behavior is resolved and the feature now aligns with the issue requirements.

@realproject7 realproject7 merged commit 51f89d3 into main Mar 16, 2026
1 check passed
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.

[P9-5] Per-plot comment system with pagination

2 participants