Skip to content

Give v2.1 polish: Sprint 5 P3 fixes, /me ambassador toggle, and README Production sync - #332

Merged
JOY (JOY) merged 1 commit into
devfrom
antigravity/give-331-v2-1-polish
Nov 23, 2026
Merged

JOY (JOY) merged 1 commit into
devfrom
antigravity/give-331-v2-1-polish

Conversation

@JOY

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

Copy link
Copy Markdown
Contributor

Refs #331

Summary

App-only polish batch resolving all non-blocking P3 items across Give v2 (#313–#320), adding a post-end ambassador leaderboard visibility toggle on /me, and syncing README.md with live Production (https://give.vn). Zero DB schema changes and zero money-logic changes.

Changes

  1. Viral sharing (#313 P3s):
    • apps/web/src/lib/canvas-cards.ts: resolve computed document.body font family at draw time (falling back safely to SANS_FONT in SSR/Node) so client PNG posters and thank-you cards use self-hosted Be Vietnam Pro across browsers; added canvas-cards.test.ts covering Node/SSR fallback, computed family, Story/Square VietQR cards, and thank-you cards.
    • apps/web/src/app/campaigns/[slug]/opengraph-image.tsx: return Cache-Control: no-store when !prelaunch && totals === null so CDNs never cache transient 0 ₫ fallback figures (preserving PUBLIC_COVER_CACHE on pre-launch teasers and normal renders); added Vitest coverage.
  2. Transparency moat (#314 P3s):
    • TransparencySummaryBox.tsx, ClosingImpactReport.tsx, MilestoneList.tsx, ImpactReportSection.tsx: bumped non-Badge text-xs labels/metadata/links to text-sm (DESIGN.md §3), removed nested border border-border boxes inside .card/<Panel> in favor of hairline dividers and borderless bg-surface fills (DESIGN.md §1 Rule 2), and aligned TransparencySummaryBox.tsx padding/gap to sm:p-6/gap-3 (DESIGN.md §2.4).
    • apps/web/src/app/me/campaigns/[id]/disbursements/actions.ts: passed context-specific GIVE_DISBURSEMENT_NOT_FOUND wording for linkDisbursementMilestone on both pre-check and RPC error paths + tests.
    • apps/web/src/components/campaign/MilestoneList.test.ts: aligned test prop query param to ?filter=out matching statementHref.
  3. FAQ formatting (#316 P3):
    • Aligned Vietnamese 4.000 formatting consistently across apps/web/src/lib/errors.ts, apps/web/src/lib/validation.ts, FaqSection.tsx, and tests.
  4. Early Bird UI polish (#317 P3s — UI/tests only, zero money-logic changes):
    • PledgeForm.tsx: switched "Mức hiện tại của bạn" badge inside disabled bg-surface card from tone="info" to tone="brand" for readable contrast.
    • pledge/page.tsx: gated the second expired-tier reassurance sentence mentioning cancel/switch on accepting.
    • pledge/actions.test.ts: added fast-fail expired-tier regression assertion for change_pledge (savePledge(CAMPAIGN, PLEDGE, ...)).
  5. Discovery 2.0 defense-in-depth (#318 P3):
    • CampaignCard.tsx: tightened validLastStatementAt check to isPublicStatus(campaign.status) with non-public status test coverage.
  6. Ambassadors (#319 P3s):
    • ambassador-actions.ts: added local override for GIVE_CAMPAIGN_NOT_ACCEPTING ("Chiến dịch này hiện không còn mở tạo liên kết kêu gọi.").
    • apps/web/src/app/me/actions.ts, /me/page.tsx, MyAmbassadorLinksSection.tsx: added "Ẩn khỏi bảng xếp hạng" / "Hiện trên bảng xếp hạng" toggle calling give.get_my_campaign_ambassador + give.upsert_my_campaign_ambassador strictly under dbAs(session.accessToken) (zero dbService()), preserving authoritative display_name, working on ended campaigns, revalidating /me and validated /campaigns/[slug], and syncing cleanly on server prop refresh + error paths.
  7. Donor wishes wall (#320 P3s):
    • apps/web/src/app/admin/reports/wishes/page.tsx: aligned Callout button wording to “Xác nhận ẩn & chốt báo cáo” and added truncation note when totalCount > reports.length matching SQL sort order (open = sớm nhất, others = mới nhất).
    • apps/web/src/components/campaign/WishHeartButton.tsx: removed redundant inner .sr-only span since <button> already carries descriptive aria-label.
  8. README.md Production sync:
    • Updated ## Status, ### Staff, ### Cron, ## Routes, and ## Security model to accurately reflect live Production (https://give.vn), Beta (https://beta.give.vn), Wave 1/2, Give v2, all 62 routes, and all 10 Vercel Cron jobs.

Verification

  • pnpm format:check — PASS
  • pnpm lint — PASS
  • pnpm typecheck — PASS
  • pnpm test (vitest run) — 212 files / 2,900 tests PASS
  • pnpm build — PASS (all 62 routes compiled cleanly)
  • Fresh-context independent code review — PASS (all 3 P2 + 3 P3 findings resolved and re-verified)

📌 TL;DR

This PR updates the README.md to reflect the full production release status (Give v2, Wave 1/2) and expands the documented route/cron surface. It also introduces several UX and robustness improvements, including a truncation notice for admin report queues, dynamic Cache-Control headers for Open Graph images to prevent caching of transient errors, and specific error handling for ambassador links and expired Early Bird pledges.

🎯 Type of Change

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

🔍 Changes Walkthrough

File Summary of Changes
README.md Major Documentation Update:
1. Status: Updated to reflect main as Production (live on Vercel) and dev as Beta. Detailed shipped capabilities for Core, Wave 1/2, and Give v2.
2. Staff: Added finance role and documented the new /admin/roles management UI.
3. Cron: Expanded the list from 3 to 10 scheduled routes, detailing new jobs for reminders, pledge lapsing, email outbox, and data purging.
4. Routes: Significantly expanded the route table to include new admin finance pages, donor tracking, ambassador features, and email unsubscribe flows.
5. Security: Clarified the scope of dbService() usage for server-side operations.
apps/web/src/app/admin/reports/wishes/page.tsx UX Improvement: Added a truncation notice ("Đang hiển thị X báo cáo... trên tổng số Y") when the admin report list is paginated/limited. Updated button label for hiding wishes to "Xác nhận ẩn & chốt báo cáo" for clarity.
apps/web/src/app/admin/reports/wishes/page.test.ts Tests: Added tests to verify the truncation notice appears when total_count exceeds the returned list length. Updated assertions for the new button label.
apps/web/src/app/campaigns/[slug]/opengraph-image.tsx Bugfix/Robustness: Added logic to set Cache-Control: no-store if the campaign is live/ended but the totals lookup fails (returns null). This prevents CDNs from caching "0 ₫" fallback images during transient database errors.
apps/web/src/app/campaigns/[slug]/opengraph-image.test.ts Tests: Added tests to ensure no-store header is returned when totals lookup fails for live/ended campaigns, and PUBLIC_COVER_CACHE is used otherwise.
apps/web/src/app/campaigns/[slug]/ambassador-actions.ts Error Handling: Added AMBASSADOR_ERROR_OVERRIDES to map specific database errors (e.g., GIVE_CAMPAIGN_NOT_ACCEPTING) to user-friendly Vietnamese messages.
apps/web/src/app/campaigns/[slug]/ambassador-actions.test.ts Tests: Added test case to verify the specific error message when a campaign is no longer accepting ambassador links.
apps/web/src/app/campaigns/[slug]/pledge/PledgeForm.tsx UI Polish: Changed the badge tone for "Mức hiện tại của bạn" (Your current level) from info to brand for better visual consistency.
apps/web/src/app/campaigns/[slug]/pledge/PledgeForm.test.ts Tests: Updated assertions to check for the new brand badge styling.
apps/web/src/app/campaigns/[slug]/pledge/actions.test.ts Tests: Updated test description and added assertion to ensure savePledge correctly rejects expired Early Bird tiers without calling the database.
apps/web/src/app/campaigns/[slug]/pledge/page.test.ts Tests: Added assertion to verify the presence of the explanatory text for users with expired Early Bird pledges ("Bạn có thể giữ nguyên, hủy cam kết...").
apps/web/src/app/campaigns/[slug]/DonorWishesWall.test.ts Tests: Added assertions to verify the aria-label of the heart button includes the count and that no .sr-only element is present (accessibility check).

📊 Architectural Flow

flowchart TD
    subgraph Client
        A[User Browser]
    end

    subgraph Next.js App
        B[Admin Reports Page]
        C[Open Graph Image Route]
        D[Ambassador Action]
        E[Pledge Form]
    end

    subgraph Database / Supabase
        F[RPC: list_reported_contribution_messages]
        G[RPC: public_campaigns / campaigns]
        H[RPC: save_ambassador]
        I[RPC: create_pledge / change_pledge]
    end

    A -->|Request| B
    A -->|Request| C
    A -->|Action| D
    A -->|Action| E

    B -->|Query| F
    F -->|Returns rows + total_count| B
    B -->|If total > rows| B1[Show Truncation Notice]

    C -->|Query| G
    G -->|Returns data| C
    G -->|Returns null/error| C1[Set Cache-Control: no-store]
    G -->|Returns valid data| C2[Set Cache-Control: public]
    C1 -->|Response| A
    C2 -->|Response| A

    D -->|Action| H
    H -->|Error: GIVE_CAMPAIGN_NOT_ACCEPTING| D1[Map to Friendly Error]
    D1 -->|Response| A

    E -->|Validation| E1{Check Early Bird Status}
    E1 -->|Expired| E2[Reject Client-Side]
    E1 -->|Valid| I
    I -->|Response| A
Loading

@JOY JOY (JOY) added line:campaigns Product line: campaigns po:agy Owned by Antigravity PO (mutual-exclusion parallel PO label) labels Nov 23, 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 23, 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 23, 2026 9:00am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 23, 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: 55edd451-b77e-477b-a531-f0ff42cbae5c

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 23, 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 (35 eligible files · 134,623 chars · 1 model call(s) · 5 PR unit(s))

Whole diff with bounded context at base 871a5c6 / head 61f2c9c.

✅ CLEAN_PASS: Complete diff reviewed

@JOY

Copy link
Copy Markdown
Contributor Author

PO acceptance: merge at 61f2c9c

Independent PO flagship review (37809884-b7d9-46ce-9590-1d1baba07e20): APPROVE (0 P0/P1/P2 findings).

@JOY
JOY (JOY) merged commit 16a8357 into dev Nov 23, 2026
6 checks passed
@JOY
JOY (JOY) deleted the antigravity/give-331-v2-1-polish branch November 23, 2026 09:08
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