Rework donate flow into guided steps with gift options #7

Merged
barnabas merged 2 commits from feature/donate-enhancement into main 2026-10-24 15:40:46 +00:00
Owner

Summary

  • Split the donate page into one question per step (intent, rank or amount, username, gift, upgrade, confirm). Each step has its own ?step= URL, so browser back and forward move through the flow, and focus moves to the new step's heading.
  • Gifts can go to a player on the other edition. An anonymous gift leaves the donor blank, so the webhook says "someone".
  • The upgrade step looks up the recipient's current rank. Ranks they already have or are above are disabled, and the others show the price of the difference.
  • Custom amounts are checked on the server as whole pounds between £1 and £1,000 (src/app/api/donations/checkout/route.ts).
  • The glow previews the card under the pointer or focus, and on custom amounts it takes the colour of the rank that amount unlocks.
  • The Stripe appearance is built from the accent colour on the page (src/lib/stripe-appearance.ts), and the pay button shows the total.
  • Moved the step UI into src/components/donate-*.tsx and added helpers in src/lib/ for player lookup, checkout error messages, and fine-pointer detection.

Testing

  • Not run: type check, lint, or production build on this branch.
  • Not run: manual browser pass. Before merge, walk these flows on desktop and on a phone-width viewport:
    • Rank purchase, custom one-time amount, custom monthly amount, and patron.
    • Upgrade for a player who has a rank, and for an unknown name (should block at the upgrade step).
    • Gift to a player on the other edition, and an anonymous gift (check the webhook message).
    • Reload and deep-link into a later step, and confirm the draft restores.
  • Not run: API check that POST /api/donations/checkout rejects a custom amount of £0.50, £1,000.01, and a non-integer pence value.
## Summary - Split the donate page into one question per step (intent, rank or amount, username, gift, upgrade, confirm). Each step has its own `?step=` URL, so browser back and forward move through the flow, and focus moves to the new step's heading. - Gifts can go to a player on the other edition. An anonymous gift leaves the donor blank, so the webhook says "someone". - The upgrade step looks up the recipient's current rank. Ranks they already have or are above are disabled, and the others show the price of the difference. - Custom amounts are checked on the server as whole pounds between £1 and £1,000 (`src/app/api/donations/checkout/route.ts`). - The glow previews the card under the pointer or focus, and on custom amounts it takes the colour of the rank that amount unlocks. - The Stripe appearance is built from the accent colour on the page (`src/lib/stripe-appearance.ts`), and the pay button shows the total. - Moved the step UI into `src/components/donate-*.tsx` and added helpers in `src/lib/` for player lookup, checkout error messages, and fine-pointer detection. ## Testing - Not run: type check, lint, or production build on this branch. - Not run: manual browser pass. Before merge, walk these flows on desktop and on a phone-width viewport: - Rank purchase, custom one-time amount, custom monthly amount, and patron. - Upgrade for a player who has a rank, and for an unknown name (should block at the upgrade step). - Gift to a player on the other edition, and an anonymous gift (check the webhook message). - Reload and deep-link into a later step, and confirm the draft restores. - Not run: API check that `POST /api/donations/checkout` rejects a custom amount of £0.50, £1,000.01, and a non-integer pence value.
barnabas added 2 commits 2026-10-24 15:40:22 +00:00
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Split the donate page into step components and reorder the flow: intent, rank or amount, recipient, gift, upgrade target, then confirm
- Let a gift go to a player on the other edition, and allow anonymous gifts (donor is left blank in metadata)
- Look up the recipient's current rank for upgrades and disable ranks they already hold
- Validate custom amounts on the server as integers between CUSTOM_MIN and CUSTOM_MAX
- Show friendly messages for checkout errors and send users back to the step that needs fixing
- Build the Stripe appearance from the page's glow accent colour, and tint the glow to match a custom amount's unlocked tier
barnabas merged commit 6d8e813d19 into main 2026-10-24 15:40:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: frg/accesscodes#7
No description provided.