Skip to content

feat(web): campaign/organizer follows, pre-launch teasers, and donor impact summary (#315) - #323

Merged
JOY (JOY) merged 1 commit into
devfrom
antigravity/give-315-follows-prelaunch
Nov 22, 2026
Merged

JOY (JOY) merged 1 commit into
devfrom
antigravity/give-315-follows-prelaunch

Conversation

@JOY

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

Copy link
Copy Markdown
Contributor

Refs #315

Summary

Phase 2 web application implementation for #315 (Retention & Pre-launch: campaign/organizer follows, pre-launch "Sắp ra mắt" opt-in & notify-me teaser, in-app follow notices, and donor impact summary), built against the deployed DOS/DOS.Me#1880 (20261201120000_give_follows_prelaunch_and_donor_impact.sql) schema on Supabase Beta (2559201b22c9cc1c09e60838d70acbec556994d0).

Key Changes

  • Follows data layer & UI (lib/follows.ts, components/FollowButton.tsx):
    • Campaign follow/unfollow on /campaigns/[slug] via user-JWT RLS on give.campaign_follows and public aggregate give.campaign_follower_count.
    • Organizer follow/unfollow on /u/[handle] strictly via handle-based RPCs (organizer_follower_count_by_handle, is_following_organizer_by_handle, follow_organizer_by_handle, unfollow_organizer_by_handle, list_my_followed_organizers) — zero direct table queries and zero organizer_id exposure to browsers.
    • Clean guest redirect via <a href="/auth/login?return_path=...">; keyed inner useActionState form so server refreshes stay in sync while preserving inline errors.
  • Pre-launch "Sắp ra mắt" opt-in, teaser, discovery & OG card:
    • Owner/co-organizer toggle in /me/campaigns/[id] (PrelaunchSection.tsx + setCampaignPrelaunchPublic) with TOC entry and live teaser link.
    • Public teaser page on /campaigns/[slug] for approved + prelaunch_public = true + future starts_at showing "Nhận thông báo khi mở" CTA and strictly suppressing all payment accounts, VietQR, donate/pledge/monthly forms, statements, poster QR, report form, and view/share analytics beacons.
    • Defense-in-depth status === "live" pre-checks on donate, startMonthlyPlan, and savePledge before dbService().
    • Discovery filter "Sắp ra mắt" (status=prelaunch), pre-launch CampaignCard layout, organizer profile "Sắp ra mắt" grid with enriched starts_at, and teaser Open Graph card in /campaigns/[slug]/opengraph-image (with non-opted-in/expired approved still strictly 404).
  • In-app notification rendering (lib/notices.ts):
    • Vietnamese copy and strictly validated internal links for campaign_launched, campaign_update_posted, and organizer_campaign_launched.
  • Donor impact summary (/me/contributions, DonorImpactCard.tsx):
    • "Dấu ấn đóng góp của tôi" summary card backed by give.my_donor_impact_summary() and give.list_my_followed_organizers() under the donor's own JWT.

Verification

  • pnpm format:check — passed
  • pnpm lint — passed
  • pnpm typecheck — passed
  • pnpm test — 192/192 test files, 2,754/2,754 tests passed (6 new test files + 10 updated test suites)
  • pnpm build — passed (Next.js 16.4.6 production build)
  • Independent fresh-context security & correctness review completed; all P1, P2, and P3 findings resolved and verified.

📌 TL;DR

This PR introduces a public "Pre-launch" (Sắp ra mắt) state for campaigns, allowing approved campaigns with future start dates to display a teaser page with a "Follow" feature while strictly blocking all donation, pledge, and payment surfaces until the campaign goes live.

🎯 Type of Change

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

🔍 Changes Walkthrough

File Summary of Changes
apps/web/src/app/(public)/donations/actions.ts Updated donate action to select status and reject donations if the campaign is not live.
apps/web/src/app/(public)/donations/actions.test.ts Added tests to verify donations are refused for approved (pre-launch) campaigns.
apps/web/src/app/campaigns/[slug]/follow-actions.ts New Server action toggleCampaignFollow to handle follow/unfollow logic, RLS error mapping, and path revalidation.
apps/web/src/app/campaigns/[slug]/follow-actions.test.ts New Tests for the follow action, covering auth checks, RLS errors, and state updates.
apps/web/src/app/campaigns/[slug]/page.tsx Major UI update: detects publicPrelaunch state, renders a teaser sidebar (goal, dates, follow button) instead of donation forms, and hides payment/pledge/statement sections.
apps/web/src/app/campaigns/[slug]/page.test.ts Added tests ensuring pre-launch pages render the teaser UI and strictly exclude payment/donation elements.
apps/web/src/app/campaigns/[slug]/monthly-actions.ts Updated startMonthlyPlan to check campaign status and reject plans for non-live campaigns.
apps/web/src/app/campaigns/[slug]/monthly-actions.test.ts Added tests for monthly plan rejection on pre-launch campaigns.
apps/web/src/app/campaigns/[slug]/pledge/actions.ts Updated savePledge to check campaign status and reject pledges for non-live campaigns.
apps/web/src/app/campaigns/[slug]/pledge/actions.test.ts Added tests for pledge rejection on pre-launch campaigns.
apps/web/src/app/campaigns/[slug]/opengraph-image.tsx Updated OG image generation to handle pre-launch campaigns (hides progress bar, skips money totals).
apps/web/src/app/campaigns/[slug]/opengraph-image.test.ts Added tests for OG image rendering on pre-launch campaigns.
apps/web/src/app/campaigns/page.tsx Updated discovery page to exclude approved campaigns from money totals queries.
apps/web/src/app/campaigns/page.test.ts Updated tests to include the new "Sắp ra mắt" filter option.
apps/web/src/app/me/campaigns/[id]/PrelaunchSection.tsx New Component for the organizer dashboard to toggle the pre-launch public visibility.
apps/web/src/app/me/campaigns/[id]/PrelaunchSection.test.ts New Tests for the pre-launch toggle logic and UI states.

📊 Architectural Flow

flowchart TD
    A[Visitor / Organizer] --> B{Campaign Status?}
    
    B -->|Live / Ended| C[Standard Campaign Page]
    C --> D[Donation / Pledge Forms]
    C --> E[Payment / VietQR]
    C --> F[Statement / Totals]
    
    B -->|Approved + Future Start + prelaunch_public| G[Pre-launch Teaser Page]
    G --> H[Show Goal & Dates]
    G --> I[Follow Button]
    G --> J[Hide Payment / Pledge / Statement]
    
    B -->|Draft / In Review| K[Private Preview / 404]
    
    I --> L[Server Action: toggleCampaignFollow]
    L --> M{Auth Check}
    M -->|Signed Out| N[Redirect to Login]
    M -->|Signed In| O[DB: Insert/Delete Follow]
    O --> P[Revalidate Paths]
    P --> Q[Update UI State]
Loading

@JOY JOY (JOY) added line:campaigns Product line: campaigns po:agy Owned by Antigravity PO (mutual-exclusion parallel PO label) labels Nov 22, 2026
@vercel

vercel Bot commented Nov 22, 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 22, 2026 3:03pm UTC

Request Review

@JOY JOY (JOY) added line:campaigns Product line: campaigns po:agy Owned by Antigravity PO (mutual-exclusion parallel PO label) labels Nov 22, 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.

@coderabbitai

coderabbitai Bot commented Nov 22, 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: a20dcae8-2d4d-45e8-9a0c-d7a465eef224

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 22, 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 (42 eligible files · 155,649 chars · 1 model call(s) · 6 PR unit(s))

Whole diff with bounded context at base 4c1b736 / head 4c38070.

✅ CLEAN_PASS: Complete diff reviewed

@JOY
JOY (JOY) force-pushed the antigravity/give-315-follows-prelaunch branch from 4c38070 to c6a3622 Compare November 22, 2026 15:02
dos[bot]
dos Bot approved these changes Nov 22, 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 (42 eligible files · 158,650 chars · 3 model call(s) · 6 PR unit(s))

Whole diff with bounded context at base d194a8f / head c6a3622.

✅ 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 c6a3622

Independent PO flagship review (d86f4f60-0e1e-45d9-8d9c-57fcee65cd25): APPROVE (0 P0/P1/P2).

@JOY
JOY (JOY) merged commit 56274cf into dev Nov 22, 2026
6 checks passed
@JOY
JOY (JOY) deleted the antigravity/give-315-follows-prelaunch branch November 22, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

line:campaigns Product line: campaigns po:agy Owned by Antigravity PO (mutual-exclusion parallel PO label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant