From 0dd68ff1aa3e2ef73b871cd97c102f7b9dd0a43c Mon Sep 17 00:00:00 2001 From: Jennie Robinson Faber Date: Sat, 23 May 2026 15:47:10 +0100 Subject: [PATCH] fix(display): cadence-aware contribution suffix across UI + admin dashboard Add formatContribution helper in app/config/contributions.js and route all member-facing and admin contribution displays through cadence-aware expressions so annual members see /yr instead of /mo. Normalize annual amounts to monthly equivalents in the admin dashboard revenue aggregate now that contributionAmount is stored in cadence units. --- app/config/contributions.js | 9 +++++++++ app/pages/admin/members/[id].vue | 2 +- app/pages/admin/members/index.vue | 10 ++++++---- app/pages/join.vue | 4 ++-- app/pages/member/dashboard.vue | 6 ++++-- server/api/admin/dashboard.get.js | 10 +++++++--- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/app/config/contributions.js b/app/config/contributions.js index 73005f1..ea60f98 100644 --- a/app/config/contributions.js +++ b/app/config/contributions.js @@ -20,3 +20,12 @@ export const getGuidanceLabel = (amount) => { const match = CONTRIBUTION_PRESETS.findLast(p => p.amount <= n) return match?.label ?? null } + +// Format a contribution amount with cadence-aware suffix. +// amount is interpreted in cadence units (e.g. 180 + 'annual' → "$180/yr"). +export const formatContribution = (amount, cadence) => { + const n = Number(amount) || 0 + if (n === 0) return '$0' + const suffix = cadence === 'annual' ? '/yr' : '/mo' + return `$${n}${suffix}` +} diff --git a/app/pages/admin/members/[id].vue b/app/pages/admin/members/[id].vue index e082be7..76d650b 100644 --- a/app/pages/admin/members/[id].vue +++ b/app/pages/admin/members/[id].vue @@ -54,7 +54,7 @@
- +

Writes to our database only. If the member is on a paid plan, also update recurringAmount in the Helcim dashboard — this form does not sync. diff --git a/app/pages/admin/members/index.vue b/app/pages/admin/members/index.vue index d602447..eefc723 100644 --- a/app/pages/admin/members/index.vue +++ b/app/pages/admin/members/index.vue @@ -111,7 +111,7 @@ - ${{ member.contributionAmount ?? 0 }}/mo + ${{ member.contributionAmount ?? 0 }}{{ member.billingCadence === 'annual' ? '/yr' : '/mo' }} {{ statusLabel(member.status) }} @@ -192,7 +192,7 @@

- +
- +
@@ -860,6 +860,7 @@ const editingMember = reactive({ email: "", circle: "community", contributionAmount: 0, + billingCadence: "monthly", status: "pending_payment", }); @@ -870,6 +871,7 @@ const editMember = (member) => { email: member.email, circle: member.circle, contributionAmount: member.contributionAmount ?? 0, + billingCadence: member.billingCadence || "monthly", status: member.status || "pending_payment", }); showEditModal.value = true; diff --git a/app/pages/join.vue b/app/pages/join.vue index 8fbcd75..51d5eab 100644 --- a/app/pages/join.vue +++ b/app/pages/join.vue @@ -32,7 +32,7 @@
- ${{ memberData?.contributionAmount ?? 0 }} CAD/month + {{ formatContribution(memberData?.contributionAmount ?? 0, memberData?.billingCadence) }} CAD
@@ -308,7 +308,7 @@