From 772f804de6f248ce975a0f15d30405cb9f18fed4 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Tue, 30 Dec 2025 12:14:44 -0800 Subject: [PATCH] Show specific counts and amounts in confirmation bars --- main.go | 3 ++- static/afac26.html | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index cac638e..d9581cd 100644 --- a/main.go +++ b/main.go @@ -367,7 +367,8 @@ func handleDonateSuccess(w http.ResponseWriter, r *http.Request) { log.Println("[ERROR] failed to process payment:", err) } - http.Redirect(w, r, fmt.Sprintf("/%s?donated=1", eventID), http.StatusSeeOther) + amount := float64(sess.AmountTotal) / 100 + http.Redirect(w, r, fmt.Sprintf("/%s?donated=%.2f", eventID, amount), http.StatusSeeOther) } func handleStripeWebhook(w http.ResponseWriter, r *http.Request) { diff --git a/static/afac26.html b/static/afac26.html index c2639ae..0f6f9e6 100644 --- a/static/afac26.html +++ b/static/afac26.html @@ -179,7 +179,9 @@ const eventId = 'afac26'; - if (new URLSearchParams(location.search).get('donated') === '1') { + const donatedAmount = new URLSearchParams(location.search).get('donated'); + if (donatedAmount) { + document.getElementById('thank-you').textContent = `Thank you for your $${parseFloat(donatedAmount).toFixed(2)} donation!`; document.getElementById('thank-you').style.display = 'block'; history.replaceState({}, '', location.pathname); } @@ -269,6 +271,8 @@ location.href = data.url; } else { updateUI(data); + const word = data.numPeople === 1 ? 'person' : 'people'; + document.getElementById('rsvp-confirmed').textContent = `Your RSVP has been updated to ${data.numPeople} ${word}.`; document.getElementById('rsvp-confirmed').style.display = 'block'; } });