-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
443 lines (421 loc) · 24 KB
/
Copy pathindex.html
File metadata and controls
443 lines (421 loc) · 24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Lineup</title>
<meta name="description" content="An event pack generated by Lineup." />
<style>
/* Light theme tokens (default). */
:root {
--accent:#6366f1;
--bg:#fafaf7; --card:#fff; --text:#111; --subtext:#52525b;
--hint:#71717a; --muted:#a1a1aa; --border:#e4e4e7; --shadow:rgba(0,0,0,.06);
--halo: color-mix(in srgb,var(--accent) 18%, transparent);
}
/* Follow the OS when the user hasn't explicitly forced a theme. */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg:#0b0b0f; --card:#15151c; --text:#fafafa; --subtext:#a1a1aa;
--hint:#a1a1aa; --muted:#71717a; --border:#27272a; --shadow:rgba(0,0,0,.5);
--halo: color-mix(in srgb,var(--accent) 26%, #ffffff 14%);
}
}
/* Explicit toggle override (persisted in localStorage). */
:root[data-theme="dark"] {
--bg:#0b0b0f; --card:#15151c; --text:#fafafa; --subtext:#a1a1aa;
--hint:#a1a1aa; --muted:#71717a; --border:#27272a; --shadow:rgba(0,0,0,.5);
--halo: color-mix(in srgb,var(--accent) 26%, #ffffff 14%);
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
background:var(--bg); color:var(--text); -webkit-font-smoothing:antialiased;
min-height:100vh; transition: background .25s ease, color .25s ease;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; }
.empty { max-width: 520px; margin: 12vh auto; text-align:center; color:var(--subtext); }
.empty h1 { font-size: 34px; color:var(--text); letter-spacing:-0.02em; }
.brand { font-size:11px; letter-spacing:.14em; text-transform:uppercase; font-weight:700; color:var(--accent); }
.theme-toggle {
position:fixed; top:14px; right:14px; z-index:100; width:40px; height:40px;
border-radius:999px; border:1px solid var(--border); background:var(--card);
color:var(--text); font-size:18px; line-height:1; display:flex; align-items:center;
justify-content:center; cursor:pointer; box-shadow:0 2px 10px var(--shadow);
transition: background .25s ease, border-color .25s ease, transform .15s ease;
}
.theme-toggle:hover { transform: scale(1.08); }
.header {
position:relative; overflow:hidden; background:var(--card); border:1px solid var(--border);
border-radius:24px; padding:30px; margin-bottom:22px;
}
.header::before {
content:""; position:absolute; inset:0; pointer-events:none;
background:
radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 55%),
radial-gradient(80% 60% at 100% 100%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 60%);
}
.header-row { position:relative; display:flex; gap:24px; align-items:flex-start; flex-wrap:wrap; }
.header-main { flex:1 1 280px; min-width:240px; }
h1.title { font-size:34px; font-weight:700; line-height:1.08; margin:12px 0 14px; letter-spacing:-0.02em; color:var(--text); }
.meta { color:var(--subtext); font-size:14px; display:flex; flex-direction:column; gap:4px; }
.meta b { color:var(--text); }
.ctas { display:flex; gap:10px; margin-top:22px; flex-wrap:wrap; }
button, a.btn {
font: inherit; cursor:pointer; border-radius:999px; padding:10px 18px;
font-weight:600; font-size:14px; border:1px solid var(--border); background:transparent;
color:var(--text); text-decoration:none; display:inline-block;
}
button.primary, a.btn.primary { background:var(--accent); color:#fff; border:none; }
/* QR tiles stay light in both themes so the codes remain scannable. */
.qrtile { width:148px; height:148px; border-radius:18px; background:#fff; padding:12px; border:1px solid var(--border); flex-shrink:0; cursor:zoom-in; }
.qrtile svg, .qrtile img { width:100%; height:100%; display:block; }
.crew-head { display:flex; justify-content:space-between; align-items:baseline; margin:6px 2px 14px; }
.crew-head .label { font-weight:600; font-size:14px; }
.crew-head .hint { color:var(--hint); font-size:12px; }
.grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap:16px; }
.badge {
border-radius:18px; padding:2px;
background: linear-gradient(140deg, var(--accent) 0%, color-mix(in srgb,var(--accent) 35%, transparent) 50%, var(--accent) 100%);
transition: transform .18s cubic-bezier(.2,.7,.2,1), box-shadow .18s ease;
box-shadow: 0 1px 2px var(--shadow);
transform-style: preserve-3d; will-change: transform;
}
.badge:hover {
transform: translateY(-5px) scale(1.02);
box-shadow:
0 18px 42px -12px color-mix(in srgb,var(--accent) 60%, transparent),
0 0 28px -2px color-mix(in srgb,var(--accent) 45%, transparent);
}
.badge-inner { background:var(--card); border-radius:16px; min-height:380px; padding:14px; display:flex; flex-direction:column; position:relative; overflow:hidden; }
/* Holographic foil glare that sweeps across on hover. */
.badge-inner::after {
content:""; position:absolute; top:-60%; left:0; width:55%; height:220%;
background:linear-gradient(100deg, transparent 0%, rgba(255,255,255,.55) 50%, transparent 100%);
transform:translateX(-180%) rotate(8deg); filter:blur(2px); pointer-events:none; z-index:3;
}
.badge:hover .badge-inner::after { animation:foil .7s ease-out; }
@keyframes foil { from { transform:translateX(-180%) rotate(8deg); } to { transform:translateX(320%) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { .badge:hover .badge-inner::after { animation:none; } }
.halo-wrap { display:flex; justify-content:center; margin:4px 0 8px; }
/* --halo brightens in dark mode (set in the theme blocks) so line-art avatars stay legible. */
.halo { width:118px; height:118px; border-radius:50%; background: var(--halo); padding:5px; display:flex; align-items:center; justify-content:center; box-shadow: 0 0 22px -4px color-mix(in srgb, var(--accent) 40%, transparent); }
.halo img { width:100%; height:100%; }
.bname { text-align:center; font-weight:700; font-size:17px; letter-spacing:-0.01em; line-height:1.1; margin-bottom:6px; color:var(--text); }
.role { display:block; text-align:center; margin-bottom:auto; }
.role span { display:inline-block; font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--accent); background:color-mix(in srgb,var(--accent) 12%, transparent); padding:3px 10px; border-radius:999px; }
.badge-foot { display:flex; align-items:flex-end; justify-content:space-between; gap:8px; margin-top:10px; }
.badge-foot button { padding:5px 9px; border-radius:8px; font-size:11px; color:var(--subtext); }
/* vCard QR tile stays light so it scans. Tap to enlarge for showing/scanning. */
.vqr { width:88px; height:88px; background:#fff; border-radius:8px; padding:5px; border:1px solid var(--border); cursor:zoom-in; }
.vqr svg, .vqr img { width:100%; height:100%; display:block; }
.footer { margin-top:32px; text-align:center; color:var(--muted); font-size:12px; }
/* Tap-to-enlarge QR overlay — show a big code for a room to scan. */
.qr-modal { position:fixed; inset:0; z-index:200; display:none; align-items:center; justify-content:center;
background:rgba(0,0,0,.78); padding:24px; cursor:zoom-out; }
.qr-modal.open { display:flex; }
.qr-modal-card { background:#fff; border-radius:24px; padding:24px; display:flex; flex-direction:column; align-items:center; gap:14px; max-width:92vw; }
.qr-modal-card .qr-big { width:min(78vw,78vh,560px); height:min(78vw,78vh,560px); }
.qr-modal-card .qr-big svg, .qr-modal-card .qr-big img { width:100%; height:100%; display:block; }
.qr-modal-card .qr-cap { font-weight:700; font-size:16px; color:#111; text-align:center; }
.qr-modal-card .qr-sub { font-size:13px; color:#71717a; margin-top:-6px; }
/* Mobile: bigger faces + QRs so they're easy to read and scan on a phone. */
@media (max-width:560px) {
.grid { grid-template-columns: repeat(2, 1fr); gap:12px; }
.halo { width:96px; height:96px; }
.vqr { width:72px; height:72px; }
.qrtile { width:128px; height:128px; }
}
.footer a { color:var(--hint); }
</style>
<script>
/* Apply a stored theme before first paint to avoid a flash. No stored
preference → the prefers-color-scheme media query handles it. */
(function () {
try {
var t = localStorage.getItem('lineup-theme');
if (t === 'dark' || t === 'light') document.documentElement.setAttribute('data-theme', t);
} catch (e) {}
})();
</script>
</head>
<body>
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode" title="Toggle dark mode">🌙</button>
<div class="qr-modal" id="qrModal" role="dialog" aria-modal="true" aria-label="Enlarged QR code">
<div class="qr-modal-card">
<div class="qr-big" id="qrBig"></div>
<div class="qr-cap" id="qrCap"></div>
<div class="qr-sub">Hold up for others to scan · tap anywhere to close</div>
</div>
</div>
<div id="app" class="wrap"><div class="empty"><div class="brand">Lineup</div><h1>Loading…</h1></div></div>
<script type="module">
import { createAvatar } from 'https://esm.sh/@dicebear/core@9.4.2';
import * as collection from 'https://esm.sh/@dicebear/collection@9.4.2';
import QRCode from 'https://esm.sh/qrcode@1.5.4';
const STYLES = {
lorelei: collection.lorelei,
notionists: collection.notionists,
bottts: collection.bottts,
shapes: collection.shapes,
};
const app = document.getElementById('app');
// ── Dark-mode toggle ────────────────────────────────────────────────────────
const THEME_KEY = 'lineup-theme';
const root = document.documentElement;
const toggleBtn = document.getElementById('themeToggle');
const systemDark = () => window.matchMedia('(prefers-color-scheme: dark)').matches;
function effectiveTheme() {
const stored = localStorage.getItem(THEME_KEY);
if (stored === 'dark' || stored === 'light') return stored;
return systemDark() ? 'dark' : 'light';
}
function syncToggleIcon() {
// Show the action: moon = "switch to dark", sun = "switch to light".
if (toggleBtn) toggleBtn.textContent = effectiveTheme() === 'dark' ? '☀️' : '🌙';
}
if (toggleBtn) {
toggleBtn.addEventListener('click', () => {
const next = effectiveTheme() === 'dark' ? 'light' : 'dark';
try { localStorage.setItem(THEME_KEY, next); } catch (e) {}
root.setAttribute('data-theme', next);
syncToggleIcon();
});
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener?.('change', syncToggleIcon);
syncToggleIcon();
// ── Tap-to-enlarge QR overlay ───────────────────────────────────────────────
const qrModal = document.getElementById('qrModal');
const qrBig = document.getElementById('qrBig');
const qrCap = document.getElementById('qrCap');
function openQr(svgMarkup, caption) {
qrBig.innerHTML = svgMarkup;
qrCap.textContent = caption || '';
qrModal.classList.add('open');
}
function closeQr() { qrModal.classList.remove('open'); qrBig.innerHTML = ''; }
qrModal.addEventListener('click', closeQr);
window.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeQr(); });
function b64urlToBytes(s) {
s = s.replace(/-/g, '+').replace(/_/g, '/');
while (s.length % 4) s += '=';
return Uint8Array.from(atob(s), (c) => c.charCodeAt(0));
}
async function decodePayload(s) {
s = s.replace(/^#/, '').replace(/^d=/, '');
// "z" prefix = deflate-raw compressed (newer, shorter links); else plain base64.
if (s[0] === 'z') {
const bytes = b64urlToBytes(s.slice(1));
const stream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate-raw'));
const json = await new Response(stream).text();
return JSON.parse(json);
}
return JSON.parse(new TextDecoder().decode(b64urlToBytes(s)));
}
function genderOptions(gender){
if (gender === 'm') return { beardProbability: 100, earringsProbability: 0 };
if (gender === 'f') return { beardProbability: 0, earringsProbability: 100 };
return {};
}
function esc(s){ return String(s).replace(/[&<>"']/g, m => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[m])); }
function svgDataUrl(svg){ return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg); }
function slugify(s){ return (s||'lineup').toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/(^-|-$)/g,'').slice(0,60) || 'lineup'; }
function vesc(v){ return String(v).replace(/\\/g,'\\\\').replace(/\n/g,'\\n').replace(/,/g,'\\,').replace(/;/g,'\\;'); }
function vurl(v){ const t=String(v).trim(); return /^https?:\/\//i.test(t)?t:`https://${t}`; }
function buildVcard({ name, role, eventTitle, email, phone, company, website, linkedin, address }) {
const [first, ...rest] = String(name).split(' ');
const last = rest.join(' ');
return ['BEGIN:VCARD','VERSION:3.0',`FN:${vesc(name)}`,`N:${vesc(last)};${vesc(first)};;;`,
company ? `ORG:${vesc(company)}` : null,
role ? `TITLE:${vesc(role)}` : null,
email ? `EMAIL;TYPE=INTERNET:${vesc(String(email).trim())}` : null,
phone ? `TEL;TYPE=CELL:${vesc(String(phone).trim())}` : null,
website ? `URL:${vesc(vurl(website))}` : null,
linkedin ? `URL:${vesc(vurl(linkedin))}` : null,
linkedin ? `X-SOCIALPROFILE;TYPE=linkedin:${vesc(vurl(linkedin))}` : null,
address ? `ADR;TYPE=WORK:;;${vesc(address)};;;;` : null,
eventTitle ? `NOTE:Met at ${vesc(eventTitle)}` : null,
'END:VCARD'].filter(Boolean).join('\r\n');
}
function pad(n){ return String(n).padStart(2,'0'); }
function buildIcs({ title, dateISO, venue, durationHours = 3 }) {
const d = new Date(dateISO);
const dt = `${d.getUTCFullYear()}${pad(d.getUTCMonth()+1)}${pad(d.getUTCDate())}T${pad(d.getUTCHours())}${pad(d.getUTCMinutes())}00Z`;
const now = new Date();
const stamp = `${now.getUTCFullYear()}${pad(now.getUTCMonth()+1)}${pad(now.getUTCDate())}T${pad(now.getUTCHours())}${pad(now.getUTCMinutes())}${pad(now.getUTCSeconds())}Z`;
return ['BEGIN:VCALENDAR','VERSION:2.0','CALSCALE:GREGORIAN','PRODID:lineup','METHOD:PUBLISH',
'BEGIN:VEVENT',`UID:${slugify(title)}-${dt}@lineup`,`DTSTAMP:${stamp}`,`SUMMARY:${title}`,
venue ? `LOCATION:${venue}` : null, `DTSTART:${dt}`, `DURATION:PT${durationHours}H`,
'END:VEVENT','END:VCALENDAR'].filter(Boolean).join('\r\n');
}
// Google Calendar "add event" URL — scanning the event QR opens this so the
// event lands straight in the user's calendar (works on any phone).
function gcalStamp(d){ return d.toISOString().replace(/[-:]/g,'').replace(/\.\d{3}/,''); }
function gcalUrl(ev){
const start = new Date(ev.dateISO);
if (isNaN(start.getTime())) return `EVENT:${ev.title}`;
const end = new Date(start.getTime() + (ev.durationHours||3)*3600*1000);
const p = new URLSearchParams({ action:'TEMPLATE', text: ev.title, dates: `${gcalStamp(start)}/${gcalStamp(end)}` });
if (ev.venue) p.set('location', ev.venue);
p.set('details', ev.rsvpUrl ? `RSVP: ${ev.rsvpUrl}` : 'Added via Lineup');
return `https://calendar.google.com/calendar/render?${p.toString()}`;
}
function fmtDate(dateISO){
try {
const d = new Date(dateISO);
return {
day: d.toLocaleDateString(undefined,{weekday:'short',month:'short',day:'numeric',year:'numeric'}),
time: d.toLocaleTimeString(undefined,{hour:'2-digit',minute:'2-digit'})
};
} catch { return { day: dateISO, time: '' }; }
}
function downloadText(filename, text, mime){
const blob = new Blob([text], { type: mime });
const url = URL.createObjectURL(blob);
const a = document.createElement('a'); a.href = url; a.download = filename; a.click();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
function composeBadgeSvg(b, ev, accent, avatarSvg, vcardQrSvg){
const strip = (s)=>s.replace(/^[\s\S]*?<svg[^>]*>/,'').replace(/<\/svg>\s*$/,'');
const first = String(b.name).split(' ')[0];
return `<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="480" height="640" viewBox="0 0 480 640">
<defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="${accent}"/><stop offset="50%" stop-color="${accent}" stop-opacity="0.45"/><stop offset="100%" stop-color="${accent}"/></linearGradient></defs>
<rect width="480" height="640" rx="32" fill="url(#g)"/><rect x="6" y="6" width="468" height="628" rx="28" fill="#fff"/>
<circle cx="80" cy="80" r="120" fill="${accent}" fill-opacity="0.12"/>
<g transform="translate(144,80)"><circle cx="96" cy="96" r="96" fill="${accent}" fill-opacity="0.18"/><g transform="translate(20,20) scale(0.59)">${strip(avatarSvg)}</g></g>
<text x="240" y="370" text-anchor="middle" font-family="Inter,system-ui,sans-serif" font-size="42" font-weight="700" fill="#111" letter-spacing="-1">${esc(first)}</text>
<g transform="translate(150,395)"><rect width="180" height="32" rx="16" fill="${accent}" fill-opacity="0.14"/><text x="90" y="21" text-anchor="middle" font-family="Inter,system-ui,sans-serif" font-size="13" font-weight="700" letter-spacing="1.5" fill="${accent}">${esc(String(b.role||'Guest').toUpperCase())}</text></g>
<g transform="translate(40,500)"><text font-family="Inter,system-ui,sans-serif" font-size="11" font-weight="600" letter-spacing="1.2" fill="#71717a">SCAN TO SAVE</text><text y="22" font-family="Inter,system-ui,sans-serif" font-size="13" font-weight="600" fill="#111">${esc(ev.title)}</text></g>
<g transform="translate(340,490)"><rect width="100" height="100" rx="10" fill="#fff" stroke="#e4e4e7"/><g transform="translate(8,8) scale(0.84)">${strip(vcardQrSvg)}</g></g>
</svg>`;
}
function renderEmpty(msg){
app.innerHTML = `<div class="empty"><div class="brand">Lineup</div><h1>${esc(msg)}</h1>
<p>This page renders an event pack from a Lineup share link. Generate one inside ChatGPT, then open the link here.</p>
<p><a href="https://github.com/kaiser-data/lineup">github.com/kaiser-data/lineup</a></p></div>`;
}
async function render(){
let payload;
try {
if (!location.hash || location.hash.length < 3) return renderEmpty('No event in this link.');
payload = await decodePayload(location.hash);
} catch { return renderEmpty('This link could not be read.'); }
// Accept both the compact v2 short keys (t/d/v/a/u/y/h/p[{n,r,s,g}]) and the
// legacy long keys (title/dateISO/.../attendees[{name,role,seed,gender}]).
const P = payload || {};
const ev = {
title: P.t ?? P.title ?? 'Event',
dateISO: P.d ?? P.dateISO,
venue: P.v ?? P.venue ?? '',
accentHex: P.a ?? P.accentHex ?? '#6366f1',
rsvpUrl: P.u ?? P.rsvpUrl ?? '',
durationHours: P.h ?? P.durationHours ?? 3,
avatarStyle: (() => { const s = P.y ?? P.avatarStyle; return s && STYLES[s] ? s : 'notionists'; })(),
};
const rawAttendees = Array.isArray(P.p) ? P.p : Array.isArray(P.attendees) ? P.attendees : [];
const attendees = rawAttendees.map(a => ({
name: a.n ?? a.name,
role: a.r ?? a.role,
seed: a.s ?? a.seed,
gender: a.g ?? a.gender,
email: a.e ?? a.email,
phone: a.ph ?? a.phone,
company: a.co ?? a.company,
website: a.w ?? a.website,
linkedin: a.li ?? a.linkedin,
address: a.ad ?? a.address,
}));
document.documentElement.style.setProperty('--accent', ev.accentHex);
document.title = `${ev.title} · Lineup`;
const { day, time } = fmtDate(ev.dateISO);
// Event QR: RSVP link if given, otherwise an add-to-calendar link so scanning
// saves the event details straight to the phone's calendar.
const eventQrTarget = ev.rsvpUrl || gcalUrl(ev);
const eventQrCaption = ev.rsvpUrl ? 'Scan to RSVP' : 'Scan to add to calendar';
const eventQrSvg = await QRCode.toString(eventQrTarget, { type:'svg', margin:0, color:{ dark: ev.accentHex, light:'#00000000' } });
const icsString = buildIcs(ev);
// Header
const header = document.createElement('div');
header.className = 'header';
header.innerHTML = `<div class="header-row">
<div class="header-main">
<div class="brand">Lineup</div>
<h1 class="title">${esc(ev.title)}</h1>
<div class="meta">
<div><b>${esc(day)}</b>${time ? ' · ' + esc(time) : ''}</div>
${ev.venue ? `<div>${esc(ev.venue)}</div>` : ''}
</div>
<div class="ctas">
<button class="primary" id="ics">Add to calendar</button>
<button class="btn" id="share">Share</button>
${ev.rsvpUrl ? `<a class="btn" href="${esc(ev.rsvpUrl)}" target="_blank" rel="noopener">RSVP</a>` : ''}
</div>
</div>
<div class="qrtile">${eventQrSvg}</div>
</div>`;
app.innerHTML = '';
app.appendChild(header);
header.querySelector('#ics').addEventListener('click', () => downloadText(`${slugify(ev.title)}.ics`, icsString, 'text/calendar'));
const shareBtn = header.querySelector('#share');
shareBtn.addEventListener('click', async () => {
const data = { title: `${ev.title} · Lineup`, text: `${ev.title} — see the lineup`, url: location.href };
try { if (navigator.share) { await navigator.share(data); return; } } catch (e) { if (e && e.name === 'AbortError') return; }
try { await navigator.clipboard.writeText(location.href); shareBtn.textContent = 'Link copied ✓'; setTimeout(() => { shareBtn.textContent = 'Share'; }, 1800); } catch (e) {}
});
const eventTile = header.querySelector('.qrtile');
eventTile.title = 'Tap to enlarge';
eventTile.addEventListener('click', () => openQr(eventQrSvg, eventQrCaption));
// Crew
const crewHead = document.createElement('div');
crewHead.className = 'crew-head';
crewHead.innerHTML = `<div class="label">The crew · ${attendees.length}</div><div class="hint">Scan a QR to save the contact</div>`;
app.appendChild(crewHead);
const grid = document.createElement('div');
grid.className = 'grid';
app.appendChild(grid);
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
for (const a of attendees) {
const name = a.name || 'Guest';
const role = a.role || 'Guest';
const first = String(name).split(' ')[0];
const avatarSvg = createAvatar(STYLES[ev.avatarStyle], { seed: a.seed || name, size: 256, backgroundColor: ['transparent'], ...genderOptions(a.gender) }).toString();
const vcardQrSvg = await QRCode.toString(buildVcard({ name, role, eventTitle: ev.title, email: a.email, phone: a.phone, company: a.company, website: a.website, linkedin: a.linkedin, address: a.address }), { type:'svg', margin:0, color:{ dark:'#111111', light:'#00000000' } });
const card = document.createElement('div');
card.className = 'badge';
card.innerHTML = `<div class="badge-inner">
<div class="halo-wrap"><div class="halo"><img src="${svgDataUrl(avatarSvg)}" alt="${esc(name)}"/></div></div>
<div class="bname">${esc(first)}</div>
<div class="role"><span>${esc(role)}</span></div>
<div class="badge-foot"><button>Download</button><div class="vqr">${vcardQrSvg}</div></div>
</div>`;
card.querySelector('button').addEventListener('click', (e) => {
e.stopPropagation();
downloadText(`${slugify(name)}-badge.svg`, composeBadgeSvg({ name, role }, ev, ev.accentHex, avatarSvg, vcardQrSvg), 'image/svg+xml');
});
const vqr = card.querySelector('.vqr');
vqr.title = 'Tap to enlarge';
vqr.addEventListener('click', (e) => { e.stopPropagation(); openQr(vcardQrSvg, `${first} · scan to save contact`); });
// Pointer-tracking 3D tilt — same "trading card in hand" feel as the app.
if (!reduceMotion) {
card.addEventListener('mousemove', (e) => {
const r = card.getBoundingClientRect();
const px = (e.clientX - r.left) / r.width - 0.5;
const py = (e.clientY - r.top) / r.height - 0.5;
card.style.transform = `perspective(900px) rotateX(${-py * 9}deg) rotateY(${px * 11}deg) translateY(-5px) scale(1.02)`;
});
card.addEventListener('mouseleave', () => { card.style.transform = ''; });
}
grid.appendChild(card);
}
const foot = document.createElement('div');
foot.className = 'footer';
foot.innerHTML = `Made with <a href="https://github.com/kaiser-data/lineup">Lineup</a> · this page is generated entirely from the link — nothing is stored.`;
app.appendChild(foot);
}
render();
window.addEventListener('hashchange', render);
</script>
</body>
</html>