4.3 KiB
4.3 KiB
Retire Donation Page, Add Configurable External Donation URL
Context
The donation page (/donate) is being retired — it was a tier-based landing page with calls to action. All donation links will instead point to an external URL (e.g., a nonprofit payment processor). Admins configure this URL in the existing Station Config screen.
Approach
- Add
donation_urlfield to the existingStationConfigsingleton (backend model + schema, frontend interface + admin form) - Replace all donation links across the site with external
<a href>links driven byconfig().donation_url, hidden when empty - Delete the donation page, tier service, tier admin UI, and all backend tier infrastructure
Step-by-Step
Phase 1 — Add donation_url to StationConfig (backend)
backend/app/models.py— Adddonation_url = Column(String(500), nullable=False, default="")toStationConfigclassbackend/app/schemas.py— Adddonation_url: strtoStationConfigResponse; adddonation_url: Optional[str] = NonetoStationConfigUpdatebackend/seed.py— Add"donation_url": ""toSTATION_CONFIGdict
Phase 2 — Add donation_url to StationConfig (frontend)
src/app/interfaces/station-config.ts— Adddonation_url: stringsrc/app/services/station-config.service.ts— Adddonation_url: ''toDEFAULT_CONFIGsrc/app/admin/admin-station-form.component.ts— Adddonation_urlproperty, wire it inpopulate()andonSubmit()payloadsrc/app/admin/admin-station-form.component.html— Add a "Donation" form section with a URL input fieldsrc/app/admin/admin.component.html— Showdonation_urlin the station config summary view
Phase 3 — Replace donation links with external links
All links switch from routerLink="/donate" to [href]="config().donation_url" with target="_blank" rel="noopener noreferrer", wrapped in @if (config().donation_url) so they hide when empty.
src/app/navbar/navbar.component.html— "Donate Now" button (line 37)src/app/hero/hero.component.html— "Support the Station" button (line 28)src/app/about/about.component.html— "Become a Member" CTA section (lines 76-88), wrap entire block in@ifsrc/app/footer/footer.component.html— "Donate" and "Become a Member" links (lines 26, 33)
Phase 4 — Delete donation page
- Remove
/donateroute fromsrc/app/app.routes.ts(lines 22-25) - Delete
src/app/donate/directory (3 files:.ts,.html,.scss)
Phase 5 — Remove tier infrastructure (frontend)
- Delete
src/app/interfaces/tier.ts - Delete
src/app/services/tier.service.ts - Delete
src/app/admin/admin-tier-form.component.*(3 files) src/app/admin/admin.component.ts— RemoveTier/TierService/AdminTierFormComponentimports,TabKeyentry, injected service,tiers$BehaviorSubject,editingTier,showTierForm,reloadTiers(), and all tier CRUD methodssrc/app/admin/admin.component.html— Remove Tiers tab button, Tiers tab content panel, tier form modal
Phase 6 — Remove tier infrastructure (backend)
- Delete
backend/app/api/tiers.py backend/app/models.py— DeleteDonationTierclassbackend/app/schemas.py— DeleteTierCreate,TierUpdate,TierResponsebackend/app/main.py— Removetiersimport and router registrationbackend/app/api/admin.py— RemoveDonationTierfrom reset truncationbackend/seed.py— RemoveDonationTierimport,TIERSlist,_upsert_tier()helper, tier seeding, tier truncation
Phase 7 — Contact form cleanup
src/app/contact/contact.component.html— Remove<option value="donation">Donation Question</option>
Execution Order
1 → 2 → 3 → 4 → 5 → 6 → 7
Verification
- Grep for remaining references to
Tier,tier,DonationTier,donate,/donate— none should remain in live code ng build— no import errors, no unresolved references- Backend starts without import errors
- Admin station form shows the new "External Donation URL" field
- Setting a URL → all 4 link locations render external links with
target="_blank" - Clearing the URL → all 4 link locations hide
- Navigate to
/donate→ 404 or wildcard redirect to home