Skip to content

fix(campaigns): paginate fulfillment backers, reset bulk save, and harden organizer UX (#241) - #244

Merged
JOY (JOY) merged 1 commit into
devfrom
qwen/241-organizer-fulfillment-ux
Nov 18, 2026
Merged

JOY (JOY) merged 1 commit into
devfrom
qwen/241-organizer-fulfillment-ux

Conversation

@JOY

@JOY JOY (JOY) commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes organizer workspace and reward-fulfillment UX, state safety, and accessibility gaps (line:campaigns only):

  1. Paginate 500+ fulfillment backers (apps/web/src/lib/fulfillment.ts, apps/web/src/app/me/campaigns/[id]/fulfillment/page.tsx)

    • Adds 1-based page to FulfillmentFilters / parseFulfillmentFilters and exports fulfillmentHref to preserve tier, status, and page query parameters while omitting default page=1.
    • Switches listFulfillmentPledges from offset-0 .limit(500) to .range((page - 1) * FULFILLMENT_BATCH_MAX, page * FULFILLMENT_BATCH_MAX - 1) (handling PostgREST PGRST103 out-of-range responses with a head count fallback), keeping each page <= 500 rows so "Chọn tất cả trong danh sách" fits a single set_pledge_fulfillment RPC call while making rows 501+ reachable across every status/tier filter.
    • Renders filter-preserving "Trang trước" / "Trang sau" pagination controls whenever page > 1 or further pages exist, including when an upper page becomes empty after moving backers out of a filtered status.
  2. Reset bulk selection & #bulk_note after save, contextualize row save buttons, and skip unused tier reads (apps/web/src/app/me/campaigns/[id]/fulfillment/page.tsx)

    • Enables resetOnSuccess on FulfillmentForm's ActionForm and keys both the bulk fieldset controls and per-row checkboxes/inputs on saved fulfillment state (status, updated_at, note), so a successful bulk update clears contribution_id checkboxes, <SelectAll>, and #bulk_note (preventing subsequent ticks from silently re-submitting earlier backers or wiping their tracking notes) while keeping inputs intact on failed submissions.
    • Includes pledge.reference_code in each per-row "Lưu cho người này" button's accessible name (<span className="sr-only">) and skips listCampaignTiers when !canUpdateFulfillment(campaign).
  3. Surface stopped payment requests and post-live status notices on /me/campaigns/[id] (apps/web/src/app/me/campaigns/[id]/page.tsx)

    • Renders a warning Callout when totals?.payments_stopped_at is set (including totals.payments_stopped_note when present and Give's support email link).
    • Exhaustively covers all CampaignStatus values—including post-live settling, succeeded, failed, and closed—in StatusNotice.
  4. Destructive milestone confirmation & organizer form/row accessibility (apps/web/src/app/me/campaigns/[id]/page.tsx, RewardTiersSection.tsx, apps/web/src/app/start/page.tsx)

    • Adds a confirm prompt (Xóa mốc “${milestone.title}”?) and milestone.title accessible label context on deleteMilestone, plus required on payment_window_days for back campaigns.
    • Promotes tier titles in TierSummary from <p> to semantic <h3> under the "Phần thưởng" <h2> panel and adds tier.title context to repeated row controls (↑ Lên, ↓ Xuống, Xóa, <summary> "Sửa mức này", Lưu phần thưởng, and Ngừng nhận mức này; <SubmitButton> uses .sr-only children to preserve PendingContext without modifying shared components/forms.tsx).
    • Wires id / aria-describedby hints (including #organizer_reverify_hint when verified/pending) and maxLength={20} on #phone in /start/page.tsx.

Verification

  • pnpm format:check
  • pnpm lint
  • pnpm typecheck
  • pnpm --filter @give/web test (123 test files, 1,759 tests passing)
  • pnpm build

Closes #241


📌 TL;DR

This PR enhances the campaign management dashboard by implementing server-side pagination for the fulfillment page, adding accessibility (a11y) improvements via aria-labels and screen-reader-only text, and introducing new status notifications for post-live campaign states (settling, succeeded, failed, closed).

🎯 Type of Change

  • 🚀 New feature
  • 🐛 Bugfix
  • 🧹 Refactor
  • ⚡ Performance
  • 📚 Documentation
  • ⚙️ CI / Configuration

🔍 Changes Walkthrough

File Summary of Changes
apps/web/src/app/me/campaigns/[id]/RewardTiersSection.tsx Added sr-only spans to buttons for screen reader context (e.g., "Move up: [Tier Name]"). Changed tier title from <p> to <h3> for semantic heading hierarchy. Added aria-label to the "Edit tier" summary element.
apps/web/src/app/me/campaigns/[id]/RewardTiersSection.test.ts Updated tests to verify the new sr-only text content and aria-label attributes on reward tier controls.
apps/web/src/app/me/campaigns/[id]/fulfillment/page.tsx Major Update: Implemented pagination logic using page search param. Added nav element for "Previous/Next" page links. Updated FulfillmentForm to use resetOnSuccess and keyed inputs to ensure React re-renders controls with fresh server data after bulk updates. Added sr-only reference codes to "Save for this person" buttons.
apps/web/src/app/me/campaigns/[id]/fulfillment/page.test.ts Added comprehensive tests for pagination (handling 500+ items, empty pages, filter preservation) and bulk save behavior (verifying that checkboxes and notes reset on success but persist on failure).
apps/web/src/app/me/campaigns/[id]/page.tsx Added StatusNotice support for new campaign statuses (settling, succeeded, failed, closed). Added a warning Callout when payments_stopped_at is set. Added required attribute to payment_window_days. Added confirm dialog and sr-only text to milestone delete buttons.
apps/web/src/app/me/campaigns/[id]/page.test.ts Added tests for the new status notices, payment stopped callouts, and milestone deletion accessibility (confirm dialogs and accessible names).
apps/web/src/app/start/page.tsx Improved form accessibility by adding id attributes to hint paragraphs and linking them via aria-describedby on inputs. Added maxLength to phone input.
apps/web/src/app/start/page.test.ts Updated tests to verify aria-describedby links and maxLength constraints on the start page forms.
apps/web/src/lib/fulfillment.test.ts Updated tests to reflect the new pagination logic in parseFulfillmentFilters and listFulfillmentPledges (using .range() instead of .limit()). Added tests for the new fulfillmentHref helper.

📊 Architectural Flow

sequenceDiagram
    participant User
    participant Browser
    participant Server (RSC)
    participant DB

    Note over User,Browser: Pagination Flow
    User->>Browser: Clicks "Next Page"
    Browser->>Server: GET /fulfillment?page=2
    Server->>DB: Query pledges with .range(500, 999)
    DB-->>Server: Returns page 2 data + total count
    Server-->>Browser: Renders FulfillmentForm with page 2 data
    
    Note over User,Browser: Bulk Update Flow
    User->>Browser: Selects rows & clicks "Bulk Update"
    Browser->>Server: POST /fulfillment (Action)
    Server->>DB: Updates selected pledges
    DB-->>Server: Success
    Server-->>Browser: Re-renders page with resetOnSuccess
    Note right of Browser: React keys force re-mount of inputs<br/>to reflect new DB state
Loading

@JOY JOY (JOY) added the line:campaigns Product line: campaigns label Nov 18, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
give Ready Ready Preview Nov 18, 2026 1:57pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96984ec4-4b0b-4905-97ca-e40ae4dcb894

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

dos[bot]
dos Bot approved these changes Nov 18, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⏱️ Code Review completed (10 eligible files · 65,985 chars · 3 model call(s) · 3 PR unit(s))

Whole diff with bounded context at base 854bda3 / head 782d162.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

@JOY

Copy link
Copy Markdown
Contributor Author

PO acceptance: merge at 782d162

Campaigns PO acceptance gate passed:

  • Strictly within the 10 scoped line:campaigns organizer/fulfillment files.
  • Required checks Lint and Build all apps green; fresh-context PO review verified 500+ backer pagination (including PostgREST 416 out-of-range recovery), post-save bulk checkbox/note reset, stopped-payment callout & exhaustive StatusNotice, destructive milestone confirmation, and 48 passing tests.

@JOY
JOY (JOY) merged commit e177792 into dev Nov 18, 2026
6 checks passed
@JOY
JOY (JOY) deleted the qwen/241-organizer-fulfillment-ux branch November 18, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

line:campaigns Product line: campaigns

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant