🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
279 lines
12 KiB
HTML
279 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<script>document.documentElement.className = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'wa-dark' : 'wa-light';</script>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Applause for a Cause - HCA Tickets</title>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist-cdn/styles/themes/default.css">
|
|
<script type="module" src="https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist-cdn/webawesome.loader.js"></script>
|
|
<style>
|
|
body {
|
|
font-family: var(--wa-font-sans);
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
min-height: 100vh;
|
|
margin: 0;
|
|
padding: 1rem;
|
|
}
|
|
#signin { display: none; flex: 1; align-items: center; justify-content: center; }
|
|
#main { display: none; width: 100%; max-width: 600px; }
|
|
.header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
margin-bottom: 2rem;
|
|
width: 100%;
|
|
}
|
|
.header img {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 50%;
|
|
}
|
|
.header .spacer { flex: 1; }
|
|
.event-header {
|
|
text-align: center;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
.event-header img {
|
|
height: 120px;
|
|
border-radius: 8px;
|
|
margin-bottom: 1rem;
|
|
}
|
|
.event-header p {
|
|
margin: 0.25rem 0;
|
|
opacity: 0.7;
|
|
}
|
|
.rsvp-section {
|
|
margin-top: 1.5rem;
|
|
padding-top: 1.5rem;
|
|
border-top: 1px solid var(--wa-color-neutral-80);
|
|
}
|
|
.button-group {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.5rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
.donation-section {
|
|
margin-top: 1rem;
|
|
padding-top: 1rem;
|
|
border-top: 1px solid var(--wa-color-neutral-80);
|
|
}
|
|
.custom-amount {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
.rsvp-controls {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
.thank-you {
|
|
background: var(--wa-color-success-95);
|
|
color: var(--wa-color-success-30);
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
margin-bottom: 1rem;
|
|
}
|
|
.wa-dark .thank-you {
|
|
background: var(--wa-color-success-20);
|
|
color: var(--wa-color-success-90);
|
|
}
|
|
.donation-info {
|
|
margin-top: 0.5rem;
|
|
opacity: 0.7;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body style="opacity: 0">
|
|
<div id="signin"></div>
|
|
<div id="main">
|
|
<div class="header">
|
|
<img data-bind="picture" alt="Profile">
|
|
<span data-bind="name"></span>
|
|
<span class="spacer"></span>
|
|
<wa-button variant="neutral" size="small" id="logout-btn">Switch User</wa-button>
|
|
</div>
|
|
<div id="thank-you" class="thank-you" style="display: none;">
|
|
Thank you for your generous donation!
|
|
</div>
|
|
<wa-card>
|
|
<div class="event-header">
|
|
<img src="/afac26-logo.png" alt="Applause for a Cause">
|
|
<p>Feb 7, 2026 · 6:30 PM</p>
|
|
<p>Helios Gym</p>
|
|
</div>
|
|
<div class="rsvp-section">
|
|
<div id="rsvp-prompt">
|
|
<strong>RSVP now!</strong>
|
|
<div style="margin-top: 0.5rem;">Number of people:</div>
|
|
<div class="button-group" id="num-people-group">
|
|
<wa-button size="small" variant="brand" data-value="1">1</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="2">2</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="3">3</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="4">4</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="5">5</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="6">6+</wa-button>
|
|
</div>
|
|
<div class="donation-section">
|
|
<strong>Would you like to make a donation?</strong>
|
|
<div style="opacity: 0.7; margin-top: 0.25rem;">Suggested: $25 per family</div>
|
|
<div class="button-group" id="donation-group">
|
|
<wa-button size="small" variant="brand" data-value="25">$25</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="50">$50</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="100">$100</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="custom">Other</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="0">Maybe later</wa-button>
|
|
</div>
|
|
<div class="custom-amount" id="custom-amount-row" style="display: none;">
|
|
$<wa-input type="number" id="custom-amount" min="1" value="25" style="width: 100px;"></wa-input>
|
|
</div>
|
|
</div>
|
|
<wa-button variant="brand" id="rsvp-btn" style="margin-top: 1rem;">RSVP</wa-button>
|
|
</div>
|
|
<div id="rsvp-status" style="display: none;">
|
|
<strong id="rsvp-message"></strong>
|
|
<div id="donation-status" class="donation-info"></div>
|
|
<div style="margin-top: 1rem;">Change to:</div>
|
|
<div class="button-group" id="num-people-update-group">
|
|
<wa-button size="small" variant="neutral" data-value="1">1</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="2">2</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="3">3</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="4">4</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="5">5</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="6">6+</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="0">Cancel RSVP</wa-button>
|
|
</div>
|
|
<div class="donation-section">
|
|
<strong>Make an additional donation?</strong>
|
|
<div class="button-group" id="additional-donation-group">
|
|
<wa-button size="small" variant="neutral" data-value="25">$25</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="50">$50</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="100">$100</wa-button>
|
|
<wa-button size="small" variant="neutral" data-value="custom">Other</wa-button>
|
|
</div>
|
|
<div class="custom-amount" id="additional-custom-row" style="display: none;">
|
|
$<wa-input type="number" id="additional-amount" min="1" value="25" style="width: 100px;"></wa-input>
|
|
<wa-button size="small" variant="neutral" id="additional-custom-btn">Donate</wa-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</wa-card>
|
|
<wa-button variant="text" size="small" href="/" style="margin-top: 2rem; margin-left: 3px;">« Events</wa-button>
|
|
</div>
|
|
<script type="module">
|
|
import { auth, logout, api } from '/app.js';
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
|
|
document.documentElement.className = e.matches ? 'wa-dark' : 'wa-light';
|
|
});
|
|
|
|
await auth();
|
|
document.getElementById('main').style.display = 'block';
|
|
document.getElementById('logout-btn').addEventListener('click', logout);
|
|
|
|
const eventId = 'afac26';
|
|
|
|
if (new URLSearchParams(location.search).get('donated') === '1') {
|
|
document.getElementById('thank-you').style.display = 'block';
|
|
history.replaceState({}, '', location.pathname);
|
|
}
|
|
|
|
let selectedNumPeople = 1;
|
|
let selectedDonation = 25;
|
|
|
|
function setupButtonGroup(groupId, onChange) {
|
|
const group = document.getElementById(groupId);
|
|
group.querySelectorAll('wa-button').forEach(btn => {
|
|
btn.addEventListener('click', () => {
|
|
group.querySelectorAll('wa-button').forEach(b => b.variant = 'neutral');
|
|
btn.variant = 'brand';
|
|
onChange(btn.dataset.value);
|
|
});
|
|
});
|
|
}
|
|
|
|
setupButtonGroup('num-people-group', val => {
|
|
selectedNumPeople = parseInt(val);
|
|
});
|
|
|
|
setupButtonGroup('donation-group', val => {
|
|
selectedDonation = val === 'custom' ? 'custom' : (val === '0' ? 0 : parseInt(val));
|
|
document.getElementById('custom-amount-row').style.display = val === 'custom' ? 'flex' : 'none';
|
|
});
|
|
|
|
setupButtonGroup('num-people-update-group', async val => {
|
|
const numPeople = parseInt(val);
|
|
const data = await api('POST', `/api/rsvp/${eventId}`, { numPeople });
|
|
updateUI(data);
|
|
});
|
|
|
|
setupButtonGroup('additional-donation-group', async val => {
|
|
if (val === 'custom') {
|
|
document.getElementById('additional-custom-row').style.display = 'flex';
|
|
} else {
|
|
await startDonation(parseInt(val));
|
|
}
|
|
});
|
|
|
|
document.getElementById('additional-custom-btn').addEventListener('click', async () => {
|
|
const amount = parseInt(document.getElementById('additional-amount').value) || 0;
|
|
if (amount > 0) {
|
|
await startDonation(amount);
|
|
}
|
|
});
|
|
|
|
async function loadRSVP() {
|
|
const data = await api('GET', `/api/rsvp/${eventId}`);
|
|
updateUI(data);
|
|
}
|
|
|
|
function updateUI(data) {
|
|
if (data.numPeople > 0) {
|
|
document.getElementById('rsvp-prompt').style.display = 'none';
|
|
document.getElementById('rsvp-status').style.display = 'block';
|
|
const word = data.numPeople === 1 ? 'person' : 'people';
|
|
document.getElementById('rsvp-message').textContent = `You're RSVPed for ${data.numPeople} ${word}.`;
|
|
if (data.donation > 0) {
|
|
document.getElementById('donation-status').textContent = `You've donated $${data.donation.toFixed(2)}. Thank you!`;
|
|
} else {
|
|
document.getElementById('donation-status').textContent = '';
|
|
}
|
|
} else {
|
|
document.getElementById('rsvp-prompt').style.display = 'block';
|
|
document.getElementById('rsvp-status').style.display = 'none';
|
|
}
|
|
}
|
|
|
|
async function startDonation(amount) {
|
|
const data = await api('POST', `/api/donate/${eventId}`, { amount: amount * 100 });
|
|
location.href = data.url;
|
|
}
|
|
|
|
document.getElementById('rsvp-btn').addEventListener('click', async () => {
|
|
const data = await api('POST', `/api/rsvp/${eventId}`, { numPeople: selectedNumPeople });
|
|
updateUI(data);
|
|
|
|
let donationAmount = selectedDonation;
|
|
if (donationAmount === 'custom') {
|
|
donationAmount = parseInt(document.getElementById('custom-amount').value) || 0;
|
|
}
|
|
if (donationAmount > 0) {
|
|
await startDonation(donationAmount);
|
|
}
|
|
});
|
|
|
|
await loadRSVP();
|
|
|
|
await customElements.whenDefined('wa-card');
|
|
document.body.style.opacity = 1;
|
|
</script>
|
|
</body>
|
|
</html>
|