Add notification preferences and alternate dues payment options
Notification preferences (migration 048): - Per-member opt-out of muteable categories (bookings, classes, forms, admin alerts); billing is always-on. Opt-out model, default on. - Dispatcher reads prefs and marks muted outbox rows 'skipped' instead of sending; pure isMuted logic, fail-open on a prefs lookup error. - notification_preferences table (default-deny RLS); /me toggles and self-view via validated service-client actions. Alternate dues payment methods (migration 049): - Admin sets external pay-here URLs per platform (PayPal/Zeffy/Venmo) in /settings; members see active ones on /me and pay off-platform; the treasurer reconciles manually (platform pre-tagged). https-only. - dues_payment_methods table (SELECT space member, write admin/board). /me visual pass: - Restore the chip/preset profile editor (skills/interests/willing-to/ affiliations); promote ChipInput and presets to shared modules. - Gate the Stripe pay-dues button on whether the space has Stripe configured; show external links or a contact-admin note otherwise.
This commit is contained in:
+14
-2
@@ -3,7 +3,9 @@ import { createClient } from '@/lib/supabase/server'
|
||||
import { createAdminClient } from '@/lib/supabase/admin'
|
||||
import { PageHeader, PageTitle } from '@/components/ui/page-title'
|
||||
import { PERMISSIONS, PERMISSION_CODES } from '@/lib/permissions-catalog'
|
||||
import { getMyClassSignups, getMyReservations, getMyCards, getMyVisits, getMyBilling, getMyNotifications, getMyPayments } from '@/lib/actions'
|
||||
import { getMyClassSignups, getMyReservations, getMyCards, getMyVisits, getMyBilling, getMyNotifications, getMyNotificationPreferences, getMyPayments, listActiveDuesPaymentMethods } from '@/lib/actions'
|
||||
import type { PrefMap } from '@/lib/notifications-prefs-logic'
|
||||
import type { DuesMethod } from '@/components/billing/dues-card'
|
||||
import {
|
||||
MePortalClient,
|
||||
type Grant,
|
||||
@@ -107,12 +109,20 @@ export default async function MePage() {
|
||||
|
||||
const billingRes = await getMyBilling()
|
||||
const billing = ('data' in billingRes ? billingRes.data : null) as
|
||||
| { status: string | null; currentPeriodEnd: string | null; hasCustomer: boolean }
|
||||
| { status: string | null; currentPeriodEnd: string | null; hasCustomer: boolean; configured: boolean }
|
||||
| null
|
||||
|
||||
const duesMethodsRes = await listActiveDuesPaymentMethods()
|
||||
const duesMethods: DuesMethod[] = 'data' in duesMethodsRes
|
||||
? duesMethodsRes.data.map(m => ({ platform: m.platform, url: m.url, instructions: m.instructions }))
|
||||
: []
|
||||
|
||||
const notifsRes = await getMyNotifications()
|
||||
const notifs: MyNotif[] = 'data' in notifsRes ? (notifsRes.data as MyNotif[]) : []
|
||||
|
||||
const notifPrefsRes = await getMyNotificationPreferences()
|
||||
const notifPrefs: PrefMap = 'data' in notifPrefsRes ? notifPrefsRes.data : {}
|
||||
|
||||
const paymentsRes = await getMyPayments()
|
||||
const payments: MyPayment[] = 'data' in paymentsRes ? (paymentsRes.data as MyPayment[]) : []
|
||||
|
||||
@@ -127,8 +137,10 @@ export default async function MePage() {
|
||||
grants={grants}
|
||||
held={held}
|
||||
billing={billing}
|
||||
duesMethods={duesMethods}
|
||||
payments={payments}
|
||||
notifs={notifs}
|
||||
notifPrefs={notifPrefs}
|
||||
classSignups={classSignups}
|
||||
reservations={reservations}
|
||||
myCards={myCards}
|
||||
|
||||
Reference in New Issue
Block a user