Phase 0 — Supabase core (Docker via CLI): - Schema: profiles, slots, sessions, preferences, connections, checkins, feedback, leaderboard (Realtime mirror), points_log - RLS on every table; transactional security-definer points RPCs - Seed: 6 slots, 18 sessions, 13 demo users (QR token as auth password) Phase 1 — Attendee web PWA (React + Vite + TS): - Login via QR token + email (GoTrue, no email sent) - Home, Agenda, Scan/Connect, staff Check-in, Feedback, live Leaderboard, Profile - Same-origin proxy to Supabase (Vite dev / nginx in Docker) - Docker: multi-stage build -> nginx sidecar on the Supabase network
1071 lines
54 KiB
HTML
1071 lines
54 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Convivo — Interactive Mockup</title>
|
||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
|
||
<style>
|
||
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
|
||
:root{
|
||
--bg:#f0f2f6; --phone-bg:#ffffff; --surface:#ffffff; --surface-2:#f4f5f9;
|
||
--line:#e4e6ee; --text:#423c3c; --muted:#8a8484;
|
||
--accent:#d50000; --accent-2:#20b2aa; --accent-soft:rgba(213,0,0,.08);
|
||
--cyan:#20b2aa; --amber:#f59e0b; --green:#059669; --red:#d50000;
|
||
}
|
||
html,body{ height:100%; }
|
||
body{
|
||
background: radial-gradient(1100px 700px at 75% -10%, rgba(213,0,0,.06) 0%, var(--bg) 55%);
|
||
font-family:'Poppins',ui-sans-serif,system-ui,-apple-system,'Segoe UI',sans-serif;
|
||
color:var(--text); display:flex; align-items:center; justify-content:center;
|
||
min-height:100vh; padding:24px;
|
||
}
|
||
.stage{ display:flex; gap:28px; align-items:flex-start; flex-wrap:wrap; justify-content:center; }
|
||
|
||
/* ---------- Phone frame ---------- */
|
||
.phone{
|
||
position:relative; width:390px; height:844px; flex-shrink:0;
|
||
background:var(--phone-bg); border-radius:54px; border:10px solid #1f1b1b;
|
||
box-shadow:0 0 0 2px #3a3333, 0 40px 90px rgba(66,60,60,.28); overflow:hidden;
|
||
}
|
||
.notch{ position:absolute; top:10px; left:50%; transform:translateX(-50%); width:118px; height:26px; background:#000; border-radius:20px; z-index:60; }
|
||
|
||
.screen{
|
||
position:absolute; inset:0; padding:56px 20px 100px; overflow-y:auto;
|
||
display:none; flex-direction:column; gap:14px; scrollbar-width:none;
|
||
}
|
||
.screen::-webkit-scrollbar{ display:none; }
|
||
.screen.active{ display:flex; }
|
||
.screen.no-tab{ padding-bottom:28px; }
|
||
|
||
/* ---------- Primitives ---------- */
|
||
.card{ background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:16px; box-shadow:0 8px 24px rgba(66,60,60,.07); }
|
||
.card + .card{ margin-top:0; }
|
||
.muted{ color:var(--muted); }
|
||
.small{ font-size:12.5px; }
|
||
.h1{ font-size:23px; font-weight:800; letter-spacing:-.5px; }
|
||
.h2{ font-size:17px; font-weight:700; }
|
||
.row{ display:flex; align-items:center; gap:10px; }
|
||
.row.between{ justify-content:space-between; }
|
||
.grow{ flex:1; min-width:0; }
|
||
.btn{
|
||
display:flex; align-items:center; justify-content:center; gap:8px; width:100%;
|
||
padding:15px 18px; border-radius:14px; border:1px solid var(--line);
|
||
background:var(--surface-2); color:var(--text); font-size:15px; font-weight:700;
|
||
cursor:pointer; transition:transform .08s ease, opacity .15s;
|
||
}
|
||
.btn:active{ transform:scale(.98); }
|
||
.btn.primary{ background:var(--accent); border:none; color:#fff; box-shadow:0 8px 20px rgba(213,0,0,.25); }
|
||
.btn.ghost{ background:transparent; }
|
||
.btn.danger{ background:rgba(213,0,0,.08); border-color:rgba(213,0,0,.35); color:var(--red); }
|
||
.btn.small{ width:auto; padding:9px 14px; font-size:13px; border-radius:10px; }
|
||
.btn:disabled{ opacity:.45; cursor:not-allowed; }
|
||
.pill{
|
||
display:inline-flex; align-items:center; gap:6px; padding:5px 11px; border-radius:999px;
|
||
font-size:12px; font-weight:700; background:var(--surface-2); border:1px solid var(--line);
|
||
}
|
||
.pill.amber{ background:rgba(245,158,11,.14); border-color:rgba(245,158,11,.4); color:#b45309; }
|
||
.pill.green{ background:rgba(5,150,105,.12); border-color:rgba(5,150,105,.35); color:var(--green); }
|
||
.pill.violet{ background:var(--accent-soft); border-color:rgba(213,0,0,.35); color:var(--accent); }
|
||
.pill.cyan{ background:rgba(32,178,170,.13); border-color:rgba(32,178,170,.4); color:#0f766e; }
|
||
.avatar{
|
||
display:inline-flex; align-items:center; justify-content:center; border-radius:50%;
|
||
font-weight:800; color:#fff; flex-shrink:0;
|
||
}
|
||
.input{
|
||
width:100%; padding:15px 16px; border-radius:14px; border:1px solid var(--line);
|
||
background:var(--surface-2); color:var(--text); font-size:15px; outline:none;
|
||
}
|
||
.input:focus{ border-color:var(--accent); }
|
||
textarea.input{ resize:none; min-height:96px; font-family:inherit; }
|
||
.divider{ height:1px; background:var(--line); margin:4px 0; }
|
||
|
||
/* ---------- Tab bar ---------- */
|
||
.tabbar{
|
||
position:absolute; left:0; right:0; bottom:0; height:88px; z-index:40;
|
||
background:rgba(255,255,255,.94); backdrop-filter:blur(14px);
|
||
border-top:1px solid var(--line); display:none; align-items:flex-start;
|
||
justify-content:space-around; padding:10px 8px 0;
|
||
}
|
||
.tabbar.show{ display:flex; }
|
||
.tab{
|
||
background:none; border:none; color:var(--muted); font-size:10.5px; font-weight:700;
|
||
display:flex; flex-direction:column; align-items:center; gap:3px; cursor:pointer;
|
||
width:64px; padding-top:4px;
|
||
}
|
||
.tab .ico{ font-size:21px; line-height:1; filter:grayscale(.4); }
|
||
.tab.active{ color:var(--accent); }
|
||
.tab.active .ico{ filter:none; }
|
||
.tab-scan{ position:relative; top:-18px; }
|
||
.tab-scan .scan-btn{
|
||
width:56px; height:56px; border-radius:50%; display:flex; align-items:center; justify-content:center;
|
||
font-size:24px; background:linear-gradient(135deg,var(--accent),#ff5a4e);
|
||
box-shadow:0 8px 20px rgba(213,0,0,.4); border:4px solid var(--phone-bg);
|
||
}
|
||
.tab-scan.active{ color:var(--accent); }
|
||
|
||
/* ---------- Splash ---------- */
|
||
#screen-splash{ align-items:center; justify-content:center; text-align:center; gap:18px; }
|
||
.logo{
|
||
width:96px; height:96px; border-radius:26px; display:flex; align-items:center; justify-content:center;
|
||
font-size:40px; font-weight:900; background:linear-gradient(135deg,var(--accent),#ff5a4e);
|
||
box-shadow:0 16px 40px rgba(213,0,0,.35);
|
||
}
|
||
.splash-title{ font-size:30px; font-weight:900; letter-spacing:-.5px; }
|
||
.splash-tag{ color:var(--muted); font-size:15px; }
|
||
.tap-hint{ margin-top:26px; color:var(--muted); font-size:13px; animation:pulse 1.6s infinite; }
|
||
@keyframes pulse{ 0%,100%{opacity:.45} 50%{opacity:1} }
|
||
|
||
/* ---------- Camera / scan ---------- */
|
||
.viewfinder{
|
||
position:relative; height:300px; border-radius:20px; overflow:hidden;
|
||
background:
|
||
radial-gradient(220px 160px at 50% 45%, rgba(213,0,0,.14), transparent 70%),
|
||
linear-gradient(160deg,#26211f 0%, #171312 100%);
|
||
border:1px solid var(--line);
|
||
}
|
||
.vf-corner{ position:absolute; width:34px; height:34px; border:3px solid #ff6b5e; }
|
||
.vf-corner.tl{ top:18px; left:18px; border-right:none; border-bottom:none; border-radius:8px 0 0 0; }
|
||
.vf-corner.tr{ top:18px; right:18px; border-left:none; border-bottom:none; border-radius:0 8px 0 0; }
|
||
.vf-corner.bl{ bottom:18px; left:18px; border-right:none; border-top:none; border-radius:0 0 0 8px; }
|
||
.vf-corner.br{ bottom:18px; right:18px; border-left:none; border-top:none; border-radius:0 0 8px 0; }
|
||
.vf-line{
|
||
position:absolute; left:26px; right:26px; height:2px; border-radius:2px;
|
||
background:linear-gradient(90deg,transparent,var(--cyan),transparent);
|
||
animation:scan 2.2s ease-in-out infinite;
|
||
}
|
||
@keyframes scan{ 0%,100%{ top:34px; } 50%{ top:258px; } }
|
||
.vf-qr{
|
||
position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
|
||
width:120px; height:120px; opacity:.5;
|
||
}
|
||
|
||
/* ---------- Home ---------- */
|
||
.points-pill{
|
||
display:inline-flex; align-items:center; gap:7px; padding:8px 14px; border-radius:999px;
|
||
background:rgba(245,158,11,.14); border:1px solid rgba(245,158,11,.4);
|
||
color:#b45309; font-weight:800; font-size:14px; cursor:pointer; flex-shrink:0; white-space:nowrap;
|
||
}
|
||
.now-card{
|
||
background:linear-gradient(135deg, rgba(213,0,0,.1), rgba(32,178,170,.08));
|
||
border:1px solid rgba(213,0,0,.35);
|
||
}
|
||
.qa-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
|
||
.qa{
|
||
display:flex; flex-direction:column; gap:8px; padding:16px; border-radius:16px; cursor:pointer;
|
||
background:var(--surface); border:1px solid var(--line); box-shadow:0 6px 18px rgba(66,60,60,.06); transition:transform .08s;
|
||
}
|
||
.qa:active{ transform:scale(.97); }
|
||
.qa .ico{ font-size:22px; }
|
||
.qa .lbl{ font-weight:700; font-size:14px; }
|
||
.pick-chip{
|
||
display:flex; align-items:center; gap:10px; width:100%; text-align:left;
|
||
padding:12px 14px; border-radius:13px; background:var(--surface); border:1px solid var(--line);
|
||
color:var(--text); cursor:pointer; font-size:13.5px;
|
||
}
|
||
.pick-chip + .pick-chip{ margin-top:8px; }
|
||
.pick-chip .t{ color:var(--muted); font-weight:800; font-size:12px; min-width:74px; }
|
||
|
||
/* ---------- Agenda ---------- */
|
||
.slot-card{ background:var(--surface); border:1px solid var(--line); border-radius:18px; overflow:hidden; box-shadow:0 8px 24px rgba(66,60,60,.07); }
|
||
.slot-head{ display:flex; align-items:center; gap:10px; padding:13px 16px; border-bottom:1px solid var(--line); }
|
||
.slot-head .name{ font-weight:800; font-size:14.5px; }
|
||
.slot-head .time{ color:var(--muted); font-size:12.5px; font-weight:600; }
|
||
.sess{
|
||
display:flex; align-items:center; gap:12px; width:100%; text-align:left;
|
||
padding:13px 16px; background:none; border:none; border-bottom:1px solid var(--line);
|
||
color:var(--text); cursor:pointer;
|
||
}
|
||
.sess:last-child{ border-bottom:none; }
|
||
.sess.picked{ background:var(--accent-soft); box-shadow:inset 3px 0 0 var(--accent); }
|
||
.sess .title{ font-weight:700; font-size:14px; }
|
||
.sess .meta{ color:var(--muted); font-size:12px; margin-top:2px; }
|
||
.sess .check{
|
||
margin-left:auto; width:24px; height:24px; border-radius:50%; flex-shrink:0;
|
||
border:2px solid var(--line); display:flex; align-items:center; justify-content:center;
|
||
font-size:13px; color:transparent;
|
||
}
|
||
.sess.picked .check{ background:var(--accent); border-color:var(--accent); color:#fff; }
|
||
|
||
/* ---------- Modal (bottom sheet) ---------- */
|
||
.backdrop{
|
||
position:absolute; inset:0; background:rgba(5,5,10,.66); backdrop-filter:blur(3px);
|
||
z-index:70; display:none; align-items:flex-end;
|
||
}
|
||
.backdrop.show{ display:flex; }
|
||
.sheet{
|
||
width:100%; background:var(--surface); border-radius:26px 26px 0 0;
|
||
border-top:1px solid var(--line); padding:14px 20px 26px; max-height:82%;
|
||
overflow-y:auto; animation:up .22s ease;
|
||
}
|
||
@keyframes up{ from{ transform:translateY(40px); opacity:.4 } to{ transform:none; opacity:1 } }
|
||
.sheet .grab{ width:44px; height:5px; border-radius:3px; background:var(--line); margin:0 auto 14px; }
|
||
.sheet h3{ font-size:19px; font-weight:800; letter-spacing:-.3px; }
|
||
.sheet .sub{ color:var(--muted); font-size:13px; margin-top:3px; }
|
||
|
||
/* ---------- Connections ---------- */
|
||
.seg{ display:flex; background:var(--surface); border:1px solid var(--line); border-radius:13px; padding:4px; }
|
||
.seg button{
|
||
flex:1; padding:10px; border:none; border-radius:10px; background:none; color:var(--muted);
|
||
font-weight:700; font-size:13.5px; cursor:pointer;
|
||
}
|
||
.seg button.active{ background:var(--accent-soft); color:var(--accent); }
|
||
.conn{
|
||
display:flex; align-items:center; gap:12px; padding:13px 14px; border-radius:14px;
|
||
background:var(--surface); border:1px solid var(--line); box-shadow:0 6px 18px rgba(66,60,60,.06);
|
||
}
|
||
.conn + .conn{ margin-top:9px; }
|
||
.conn .name{ font-weight:700; font-size:14.5px; }
|
||
.conn .meta{ color:var(--muted); font-size:12px; margin-top:2px; }
|
||
.empty{
|
||
text-align:center; padding:38px 20px; color:var(--muted); font-size:14px;
|
||
border:1.5px dashed var(--line); border-radius:16px;
|
||
}
|
||
.empty .big{ font-size:34px; margin-bottom:10px; }
|
||
|
||
/* ---------- Feedback ---------- */
|
||
.stars{ display:flex; gap:10px; justify-content:center; padding:6px 0 2px; }
|
||
.star{ font-size:40px; cursor:pointer; color:#d5d8e2; transition:transform .1s, color .1s; user-select:none; }
|
||
.star.on{ color:var(--amber); text-shadow:0 0 18px rgba(245,158,11,.4); }
|
||
.star:active{ transform:scale(1.2); }
|
||
.success-box{ text-align:center; padding:30px 16px; }
|
||
.success-box .emoji{ font-size:56px; }
|
||
.success-box h3{ font-size:22px; margin-top:12px; }
|
||
.success-box p{ color:var(--muted); margin-top:6px; font-size:14px; }
|
||
|
||
/* ---------- Leaderboard ---------- */
|
||
.podium{ display:flex; align-items:flex-end; justify-content:center; gap:12px; padding:18px 6px 6px; }
|
||
.pod{ display:flex; flex-direction:column; align-items:center; gap:7px; width:96px; }
|
||
.pod .bar{
|
||
width:100%; border-radius:12px 12px 0 0; display:flex; align-items:flex-start; justify-content:center;
|
||
padding-top:8px; font-weight:900; font-size:15px;
|
||
}
|
||
.pod .bar.b1{ height:86px; background:linear-gradient(180deg,rgba(245,158,11,.32),rgba(245,158,11,.08)); border:1px solid rgba(245,158,11,.5); border-bottom:none; color:#b45309; }
|
||
.pod .bar.b2{ height:62px; background:linear-gradient(180deg,rgba(148,163,184,.32),rgba(148,163,184,.08)); border:1px solid rgba(148,163,184,.5); border-bottom:none; color:#64748b; }
|
||
.pod .bar.b3{ height:48px; background:linear-gradient(180deg,rgba(217,119,6,.3),rgba(217,119,6,.08)); border:1px solid rgba(217,119,6,.5); border-bottom:none; color:#c2620a; }
|
||
.pod .pname{ font-size:12px; font-weight:700; }
|
||
.pod .ppoints{ font-size:11.5px; color:var(--muted); font-weight:700; }
|
||
.lb-row{
|
||
display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:14px;
|
||
background:var(--surface); border:1px solid var(--line); box-shadow:0 6px 18px rgba(66,60,60,.06);
|
||
}
|
||
.lb-row + .lb-row{ margin-top:8px; }
|
||
.lb-row.me{ border-color:rgba(213,0,0,.5); background:var(--accent-soft); }
|
||
.lb-row .rank{ width:26px; font-weight:900; color:var(--muted); font-size:14px; text-align:center; }
|
||
.lb-row .pts{ margin-left:auto; font-weight:800; color:#b45309; font-size:14px; }
|
||
.skeleton{ height:56px; border-radius:14px; background:linear-gradient(90deg,var(--surface) 25%,var(--surface-2) 50%,var(--surface) 75%); background-size:200% 100%; animation:sh 1.2s infinite; }
|
||
@keyframes sh{ to{ background-position:-200% 0 } }
|
||
|
||
/* ---------- Profile ---------- */
|
||
.qr-wrap{ display:flex; flex-direction:column; align-items:center; gap:12px; padding:20px; }
|
||
.qr{ position:relative; background:#fff; border-radius:10px; }
|
||
.qr i{ position:absolute; background:#0a0a10; }
|
||
.qr b{ position:absolute; background:#0a0a10; }
|
||
.qr b::before{ content:''; position:absolute; inset:14.3%; background:#fff; }
|
||
.qr b::after{ content:''; position:absolute; inset:28.6%; background:#0a0a10; }
|
||
.break-row{ display:flex; justify-content:space-between; align-items:center; padding:11px 0; border-bottom:1px solid var(--line); font-size:14px; }
|
||
.break-row:last-child{ border-bottom:none; }
|
||
.break-row .v{ font-weight:800; color:var(--amber); }
|
||
|
||
/* ---------- Toast ---------- */
|
||
.toast{
|
||
position:absolute; left:16px; right:16px; bottom:104px; z-index:90;
|
||
background:#fff; border:1px solid var(--line); border-radius:14px;
|
||
padding:13px 16px; font-size:13.5px; font-weight:600; text-align:center;
|
||
box-shadow:0 12px 30px rgba(66,60,60,.22); opacity:0; transform:translateY(12px);
|
||
transition:all .25s ease; pointer-events:none;
|
||
}
|
||
.toast.show{ opacity:1; transform:none; }
|
||
.toast.ok{ border-color:rgba(5,150,105,.5); }
|
||
.toast.err{ border-color:rgba(213,0,0,.55); }
|
||
|
||
/* ---------- Side panel ---------- */
|
||
.panel{
|
||
width:300px; background:rgba(255,255,255,.85); border:1px solid var(--line);
|
||
border-radius:20px; padding:20px; backdrop-filter:blur(10px);
|
||
box-shadow:0 8px 24px rgba(66,60,60,.08);
|
||
}
|
||
.panel h2{ font-size:15px; font-weight:800; margin-bottom:4px; }
|
||
.panel .sub{ font-size:12px; color:var(--muted); margin-bottom:14px; }
|
||
.panel h4{ font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin:16px 0 8px; }
|
||
.jump{ display:flex; flex-direction:column; gap:4px; }
|
||
.jump button{
|
||
text-align:left; padding:8px 11px; border-radius:9px; border:1px solid transparent;
|
||
background:none; color:var(--text); font-size:13px; cursor:pointer; font-weight:600;
|
||
}
|
||
.jump button:hover{ background:var(--surface-2); border-color:var(--line); }
|
||
.jump button.cur{ background:var(--accent-soft); border-color:rgba(213,0,0,.4); color:var(--accent); }
|
||
.role-seg{ display:flex; gap:6px; }
|
||
.role-seg button{
|
||
flex:1; padding:9px; border-radius:10px; border:1px solid var(--line); background:var(--surface);
|
||
color:var(--muted); font-weight:700; font-size:12.5px; cursor:pointer;
|
||
}
|
||
.role-seg button.active{ background:var(--accent-soft); border-color:rgba(213,0,0,.4); color:var(--accent); }
|
||
.note{ font-size:11.5px; color:var(--muted); line-height:1.5; margin-top:14px; border-top:1px solid var(--line); padding-top:12px; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="stage">
|
||
|
||
<!-- ================= PHONE ================= -->
|
||
<div class="phone">
|
||
<div class="notch"></div>
|
||
|
||
<!-- Splash -->
|
||
<section class="screen no-tab active" id="screen-splash">
|
||
<div class="logo">IK</div>
|
||
<div class="splash-title">Convivo</div>
|
||
<div class="splash-tag">Break the ice. Earn the points.</div>
|
||
<div class="tap-hint">Tap anywhere to continue</div>
|
||
</section>
|
||
|
||
<!-- Login: scan -->
|
||
<section class="screen no-tab" id="screen-login-scan">
|
||
<div class="h1">Welcome back 👋</div>
|
||
<div class="muted small">Scan the QR code on your lanyard to log in.</div>
|
||
<div class="viewfinder">
|
||
<span class="vf-corner tl"></span><span class="vf-corner tr"></span>
|
||
<span class="vf-corner bl"></span><span class="vf-corner br"></span>
|
||
<div class="vf-qr" id="vf-qr"></div>
|
||
<div class="vf-line"></div>
|
||
</div>
|
||
<div class="muted small" style="text-align:center">Point your camera at your lanyard QR</div>
|
||
<button class="btn primary" onclick="doLoginScan()">📷 Simulate scan</button>
|
||
<div class="muted small" style="text-align:center; opacity:.6">In the real app the camera opens automatically.</div>
|
||
</section>
|
||
|
||
<!-- Login: confirm -->
|
||
<section class="screen no-tab" id="screen-login-confirm">
|
||
<div class="row" style="gap:14px">
|
||
<span class="avatar" id="lc-avatar" style="width:64px;height:64px;font-size:22px"></span>
|
||
<div>
|
||
<div class="h2" id="lc-name">Ana Silva</div>
|
||
<div class="muted small">Found on lanyard</div>
|
||
</div>
|
||
</div>
|
||
<div class="card">
|
||
<div class="h2" style="margin-bottom:6px">Confirm it's you</div>
|
||
<div class="muted small" style="margin-bottom:12px">Enter the email address printed on your badge.</div>
|
||
<input class="input" id="lc-email" type="email" placeholder="[email protected]" autocomplete="off">
|
||
</div>
|
||
<button class="btn primary" onclick="doLoginConfirm()">Confirm & enter →</button>
|
||
<div class="muted small" style="text-align:center; opacity:.6">Demo: use <b>[email protected]</b></div>
|
||
</section>
|
||
|
||
<!-- Home -->
|
||
<section class="screen" id="screen-home">
|
||
<div class="row between">
|
||
<div>
|
||
<div class="h1" id="home-hello">Good morning, Ana 👋</div>
|
||
<div class="muted small">Wed 23 Oct · Convivo Conf</div>
|
||
</div>
|
||
<div class="points-pill" onclick="go('leaderboard')" id="home-points">⚡ 40</div>
|
||
</div>
|
||
<div id="home-now"></div>
|
||
<div id="home-next"></div>
|
||
<div>
|
||
<div class="row between" style="margin-bottom:9px">
|
||
<span class="h2">My picks today</span>
|
||
<span class="muted small">tap to change</span>
|
||
</div>
|
||
<div id="home-picks"></div>
|
||
</div>
|
||
<div class="qa-grid">
|
||
<div class="qa" onclick="go('scan')"><span class="ico">📷</span><span class="lbl" id="qa-scan">Scan & connect</span></div>
|
||
<div class="qa" onclick="go('agenda')"><span class="ico">📅</span><span class="lbl">Agenda</span></div>
|
||
<div class="qa" onclick="go('connections')"><span class="ico">🤝</span><span class="lbl">Connections</span></div>
|
||
<div class="qa" onclick="go('leaderboard')"><span class="ico">🏆</span><span class="lbl">Leaderboard</span></div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- Agenda -->
|
||
<section class="screen" id="screen-agenda">
|
||
<div class="row between">
|
||
<div>
|
||
<div class="h1">Agenda</div>
|
||
<div class="muted small">Wed 23 Oct · 09:00–17:00</div>
|
||
</div>
|
||
<span class="pill violet">6 slots · 3 tracks</span>
|
||
</div>
|
||
<div class="muted small" style="margin-top:-4px">Pick <b>one session per slot</b> — you can change until the slot starts.</div>
|
||
<div id="agenda-slots" style="display:flex;flex-direction:column;gap:12px"></div>
|
||
</section>
|
||
|
||
<!-- Scan / Check-in -->
|
||
<section class="screen" id="screen-scan">
|
||
<div class="row between">
|
||
<div>
|
||
<div class="h1" id="scan-title">Scan</div>
|
||
<div class="muted small" id="scan-sub">Scan a peer's lanyard to connect</div>
|
||
</div>
|
||
<div class="seg" style="width:170px">
|
||
<button id="role-att" onclick="setRole('attendee')">Attendee</button>
|
||
<button id="role-staff" onclick="setRole('staff')">Staff</button>
|
||
</div>
|
||
</div>
|
||
<div id="staff-pick" style="display:none">
|
||
<div class="muted small" style="margin-bottom:7px">Checking in to session</div>
|
||
<select class="input" id="staff-session" onchange="renderScan()"></select>
|
||
</div>
|
||
<div class="viewfinder">
|
||
<span class="vf-corner tl"></span><span class="vf-corner tr"></span>
|
||
<span class="vf-corner bl"></span><span class="vf-corner br"></span>
|
||
<div class="vf-qr" id="vf-qr2"></div>
|
||
<div class="vf-line"></div>
|
||
</div>
|
||
<div class="muted small" style="text-align:center" id="scan-hint">Point at a lanyard QR</div>
|
||
<button class="btn primary" onclick="doScan()">📷 Simulate scan</button>
|
||
</section>
|
||
|
||
<!-- Connections -->
|
||
<section class="screen" id="screen-connections">
|
||
<div class="h1">Connections</div>
|
||
<div class="seg">
|
||
<button id="ctab-mine" class="active" onclick="setConnTab('mine')">My connections</button>
|
||
<button id="ctab-req" onclick="setConnTab('req')">Requests <span id="req-count"></span></button>
|
||
</div>
|
||
<div id="conn-mine"></div>
|
||
<div id="conn-req" style="display:none"></div>
|
||
</section>
|
||
|
||
<!-- Feedback -->
|
||
<section class="screen no-tab" id="screen-feedback">
|
||
<button class="btn ghost small" style="align-self:flex-start" onclick="go('home')">← Back</button>
|
||
<div id="fb-form">
|
||
<div class="card" style="text-align:center">
|
||
<div class="muted small" id="fb-session-meta">Slot 1 · 09:00–09:45 · Room A</div>
|
||
<div class="h2" id="fb-session-title" style="margin-top:4px">Designing for Trust in AI Products</div>
|
||
<div class="h1" style="margin-top:18px; font-size:22px">How was it? ⭐</div>
|
||
<div class="stars" id="fb-stars"></div>
|
||
<div class="muted small" style="margin-bottom:10px" id="fb-rating-label">Tap a star</div>
|
||
<textarea class="input" id="fb-comment" placeholder="What did you think? (bonus points for details)"></textarea>
|
||
<div class="muted small" style="margin-top:10px; text-align:center">Rating: <b>+5 pts</b> · With comments: <b>+10 pts</b></div>
|
||
</div>
|
||
<button class="btn primary" id="fb-submit" onclick="submitFeedback()" disabled>Submit feedback</button>
|
||
</div>
|
||
<div id="fb-success" style="display:none">
|
||
<div class="card success-box">
|
||
<div class="emoji">🎉</div>
|
||
<h3 id="fb-success-title">+10 pts earned!</h3>
|
||
<p>Thanks for the feedback — it helps everyone pick better sessions.</p>
|
||
<button class="btn primary" style="margin-top:20px" onclick="go('home')">Back to Home</button>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- Leaderboard -->
|
||
<section class="screen" id="screen-leaderboard">
|
||
<div class="row between">
|
||
<div>
|
||
<div class="h1">Leaderboard</div>
|
||
<div class="muted small">All attendees · by points</div>
|
||
</div>
|
||
<span class="pill green">● Live</span>
|
||
</div>
|
||
<div id="lb-body"></div>
|
||
</section>
|
||
|
||
<!-- Profile -->
|
||
<section class="screen" id="screen-profile">
|
||
<div class="h1">Profile</div>
|
||
<div class="card" style="text-align:center">
|
||
<span class="avatar" id="pf-avatar" style="width:72px;height:72px;font-size:26px; margin:0 auto"></span>
|
||
<div class="h2" style="margin-top:10px" id="pf-name"></div>
|
||
<div class="muted small" id="pf-company"></div>
|
||
<div class="row" style="justify-content:center; margin-top:10px; gap:8px">
|
||
<span class="pill violet" id="pf-role"></span>
|
||
<span class="pill amber" id="pf-points"></span>
|
||
</div>
|
||
</div>
|
||
<div class="card qr-wrap">
|
||
<div class="h2">My QR code</div>
|
||
<div id="pf-qr"></div>
|
||
<div class="muted small" style="text-align:center">Show this to <b>staff</b> for session check-in<br>and to <b>peers</b> to make a connection.</div>
|
||
</div>
|
||
<div class="card">
|
||
<div class="h2" style="margin-bottom:6px">Points breakdown</div>
|
||
<div id="pf-breakdown"></div>
|
||
</div>
|
||
<button class="btn danger" onclick="doLogout()">Log out</button>
|
||
</section>
|
||
|
||
<!-- Session detail sheet -->
|
||
<div class="backdrop" id="sheet-session" onclick="if(event.target===this)closeSheet('sheet-session')">
|
||
<div class="sheet">
|
||
<div class="grab"></div>
|
||
<div class="row between">
|
||
<div>
|
||
<h3 id="sd-title"></h3>
|
||
<div class="sub" id="sd-meta"></div>
|
||
</div>
|
||
<button class="btn ghost small" onclick="closeSheet('sheet-session')">✕</button>
|
||
</div>
|
||
<div class="muted small" id="sd-desc" style="margin:12px 0; line-height:1.55"></div>
|
||
<div class="row" style="gap:8px; margin-bottom:14px" id="sd-pills"></div>
|
||
<div id="sd-actions"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Connect sheet -->
|
||
<div class="backdrop" id="sheet-connect" onclick="if(event.target===this)closeSheet('sheet-connect')">
|
||
<div class="sheet" style="text-align:center">
|
||
<div class="grab"></div>
|
||
<span class="avatar" id="cn-avatar" style="width:72px;height:72px;font-size:26px; margin:0 auto"></span>
|
||
<h3 style="margin-top:12px" id="cn-name"></h3>
|
||
<div class="sub" id="cn-company"></div>
|
||
<div id="cn-body" style="margin-top:16px"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Check-in sheet -->
|
||
<div class="backdrop" id="sheet-checkin" onclick="if(event.target===this)closeSheet('sheet-checkin')">
|
||
<div class="sheet" style="text-align:center">
|
||
<div class="grab"></div>
|
||
<span class="avatar" id="ck-avatar" style="width:72px;height:72px;font-size:26px; margin:0 auto"></span>
|
||
<h3 style="margin-top:12px" id="ck-name"></h3>
|
||
<div class="sub" id="ck-session"></div>
|
||
<div id="ck-body" style="margin-top:16px"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Tab bar -->
|
||
<nav class="tabbar" id="tabbar">
|
||
<button class="tab" data-screen="home"><span class="ico">🏠</span><span>Home</span></button>
|
||
<button class="tab" data-screen="agenda"><span class="ico">📅</span><span>Agenda</span></button>
|
||
<button class="tab tab-scan" data-screen="scan"><span class="scan-btn">📷</span><span id="tab-scan-label">Scan</span></button>
|
||
<button class="tab" data-screen="connections"><span class="ico">🤝</span><span>Connect</span></button>
|
||
<button class="tab" data-screen="profile"><span class="ico">👤</span><span>Profile</span></button>
|
||
</nav>
|
||
|
||
<div class="toast" id="toast"></div>
|
||
</div>
|
||
|
||
<!-- ================= SIDE PANEL ================= -->
|
||
<aside class="panel">
|
||
<h2>Convivo — Mockup</h2>
|
||
<div class="sub">Click through every flow. All data is fake.</div>
|
||
|
||
<h4>Screens</h4>
|
||
<div class="jump" id="jump-list"></div>
|
||
|
||
<h4>Demo controls</h4>
|
||
<div class="role-seg">
|
||
<button id="panel-role-att" class="active" onclick="setRole('attendee')">🙋 Attendee</button>
|
||
<button id="panel-role-staff" onclick="setRole('staff')">🧑💼 Staff</button>
|
||
</div>
|
||
<button class="btn small" style="margin-top:10px" onclick="location.reload()">↺ Reset demo</button>
|
||
|
||
<div class="note">
|
||
<b>Tip:</b> the Feedback screen is reached from a <b>finished</b> session (Slot 1) in the Agenda → session detail.
|
||
The simulated "now" is <b>10:20</b>, so Slot 1 is finished and Slot 2 is live.
|
||
Login demo email: <b>[email protected]</b>.
|
||
</div>
|
||
</aside>
|
||
</div>
|
||
|
||
<script>
|
||
/* ================= DATA ================= */
|
||
const NOW = '10:20'; // simulated current time on 23 Oct
|
||
|
||
const SLOTS = [
|
||
{ id:1, name:'Slot 1', start:'09:00', end:'09:45' },
|
||
{ id:2, name:'Slot 2', start:'10:00', end:'10:45' },
|
||
{ id:3, name:'Slot 3', start:'11:30', end:'12:15' },
|
||
{ id:4, name:'Slot 4', start:'13:15', end:'14:00' },
|
||
{ id:5, name:'Slot 5', start:'14:00', end:'14:45' },
|
||
{ id:6, name:'Slot 6', start:'15:00', end:'15:45' },
|
||
];
|
||
|
||
const SESSIONS = [
|
||
{ id:'s1', slot:1, title:'Opening Keynote: The Next Decade of AI', room:'Main Stage', speaker:'Dr. Elena Vasquez', cap:300, desc:'A wide-angle look at where AI is heading over the next ten years — and what it means for product teams.' },
|
||
{ id:'s2', slot:1, title:'Designing for Trust in AI Products', room:'Room A', speaker:'Marco Chen', cap:80, desc:'Practical patterns for making AI features transparent, explainable, and safe for your users.' },
|
||
{ id:'s3', slot:1, title:'From Hackathon to Product', room:'Room B', speaker:'Sofia Almeida', cap:60, desc:'How a weekend prototype became a product with 40k users — the messy middle included.' },
|
||
{ id:'s4', slot:2, title:'AI in Practice: Lessons from Production', room:'Main Stage', speaker:'Bruno Costa', cap:300, desc:'Lessons learned shipping LLM features to production: latency, cost, evals, and the surprises.' },
|
||
{ id:'s5', slot:2, title:"The Introvert's Guide to Networking", room:'Room A', speaker:'Rita Lopes', cap:80, desc:'Small, low-energy ways to have big conversations at any event. (Yes, this one is for you.)' },
|
||
{ id:'s6', slot:2, title:'Building with Dataverse: Beyond the Basics', room:'Room B', speaker:'Tomás Ribeiro', cap:60, desc:'Go beyond the basics: relationships, security roles, and automations that actually scale.' },
|
||
{ id:'s7', slot:3, title:'Scaling Teams at 10x', room:'Main Stage', speaker:'Julia Santos', cap:300, desc:'What breaks when you grow 10x in two years, and the rituals that kept us sane.' },
|
||
{ id:'s8', slot:3, title:'Security by Design', room:'Room A', speaker:'Pedro Nunes', cap:80, desc:'Baking security into the product from day one instead of bolting it on at the end.' },
|
||
{ id:'s9', slot:3, title:'Data Storytelling', room:'Room B', speaker:'Carla Mendes', cap:60, desc:'Turn dashboards into narratives your stakeholders actually remember.' },
|
||
{ id:'s10', slot:4, title:'The Future of Work', room:'Main Stage', speaker:'Dr. Elena Vasquez', cap:300, desc:'Hybrid, async, and AI-augmented: where work is going and how to prepare for it.' },
|
||
{ id:'s11', slot:4, title:'Prototyping with AI', room:'Room A', speaker:'Diego Ferreira', cap:80, desc:'From idea to clickable prototype in an afternoon — tools and workflows that work.' },
|
||
{ id:'s12', slot:4, title:'Pricing SaaS in 2026', room:'Room B', speaker:'Marina Costa', cap:60, desc:'Usage-based, seat-based, or hybrid? What is actually working right now.' },
|
||
{ id:'s13', slot:5, title:'Community-Led Growth', room:'Main Stage', speaker:'Lucas Oliveira', cap:300, desc:'Building a community that sells for you — case studies and playbooks.' },
|
||
{ id:'s14', slot:5, title:'Accessibility First', room:'Room A', speaker:'Carla Mendes', cap:80, desc:'Why accessible products are better products, and how to start this sprint.' },
|
||
{ id:'s15', slot:5, title:'The Art of the Demo', room:'Room B', speaker:'Pedro Nunes', cap:60, desc:'Structure, pacing, and the moments that make a demo land.' },
|
||
{ id:'s16', slot:6, title:"Closing Panel: What's Next", room:'Main Stage', speaker:'Elena · Bruno · Rita', cap:300, desc:'Founders, researchers, and builders on what comes next — with audience Q&A.' },
|
||
{ id:'s17', slot:6, title:'Open Space: Your Ideas', room:'Room A', speaker:'Facilitated by Ana Silva', cap:80, desc:'You bring the topic, we bring the room. 45 minutes of your ideas.' },
|
||
{ id:'s18', slot:6, title:'Lightning Talks', room:'Room B', speaker:'8 speakers', cap:60, desc:'Eight speakers, five minutes each. Fast, fun, and unpredictable.' },
|
||
];
|
||
|
||
const PEOPLE = {
|
||
ana: { name:'Ana Silva', company:'Nubank', points:40 },
|
||
bruno: { name:'Bruno Costa', company:'Acme Corp', points:140 },
|
||
rita: { name:'Rita Lopes', company:'Globant', points:95 },
|
||
tomas: { name:'Tomás Ribeiro', company:'Dataprev', points:88 },
|
||
sofia: { name:'Sofia Almeida', company:'Loop', points:76 },
|
||
marco: { name:'Marco Chen', company:'DeepMind', points:70 },
|
||
julia: { name:'Julia Santos', company:'iFood', points:64 },
|
||
pedro: { name:'Pedro Nunes', company:'Microsoft', points:58 },
|
||
carla: { name:'Carla Mendes', company:'QuintoEssencial', points:52 },
|
||
diego: { name:'Diego Ferreira', company:'Stone', points:35 },
|
||
marina: { name:'Marina Costa', company:'OLX', points:28 },
|
||
lucas: { name:'Lucas Oliveira', company:'USP', points:15 },
|
||
};
|
||
|
||
/* ================= STATE ================= */
|
||
const state = {
|
||
user: { id:'ana', role:'attendee' },
|
||
picks: { 1:'s2', 2:'s4', 3:'s9', 4:'s11', 5:'s13', 6:'s16' },
|
||
accepted: [
|
||
{ id:'bruno', at:'09:12' },
|
||
{ id:'rita', at:'09:31' },
|
||
],
|
||
incoming: [
|
||
{ id:'sofia', at:'10:05' },
|
||
{ id:'marco', at:'10:11' },
|
||
],
|
||
outgoing: [ { id:'julia', at:'10:15' } ],
|
||
checkins: ['s2','s4'],
|
||
feedback: { s2:{ rating:5, comment:'Great patterns, very practical. Wish it were longer!' } },
|
||
breakdown: { checkins:20, connections:10, feedback:10 },
|
||
fbSession: 's2',
|
||
fbRating: 0,
|
||
connTab: 'mine',
|
||
lbLoaded: false,
|
||
};
|
||
const me = () => PEOPLE[state.user.id];
|
||
const points = () => me().points;
|
||
|
||
/* ================= HELPERS ================= */
|
||
const $ = id => document.getElementById(id);
|
||
const sess = id => SESSIONS.find(s => s.id === id);
|
||
const slotOf = s => SLOTS.find(l => l.id === s.slot);
|
||
function slotStatus(l){
|
||
if (NOW >= l.end) return 'done';
|
||
if (NOW >= l.start) return 'now';
|
||
return 'next';
|
||
}
|
||
function initials(name){ return name.split(' ').map(w=>w[0]).slice(0,2).join('').toUpperCase(); }
|
||
const AV_COLORS = ['#d50000','#20b2aa','#e11d48','#0d9488','#f59e0b','#0ea5e9','#dc2626','#7c3aed','#16a34a','#ea580c','#0891b2','#db2777'];
|
||
function avColor(id){ let h=0; for(const c of id) h=(h*31+c.charCodeAt(0))>>>0; return AV_COLORS[h%AV_COLORS.length]; }
|
||
function avatarHTML(id, size, fs){
|
||
const p = PEOPLE[id];
|
||
return `<span class="avatar" style="width:${size}px;height:${size}px;font-size:${fs}px;background:${avColor(id)}">${initials(p.name)}</span>`;
|
||
}
|
||
let toastTimer;
|
||
function toast(msg, type){
|
||
const t = $('toast');
|
||
t.textContent = msg;
|
||
t.className = 'toast show ' + (type||'');
|
||
clearTimeout(toastTimer);
|
||
toastTimer = setTimeout(()=> t.className = 'toast', 2600);
|
||
}
|
||
function addPoints(n, bucket){
|
||
me().points += n;
|
||
if (bucket) state.breakdown[bucket] += n;
|
||
renderAll();
|
||
}
|
||
function qrHTML(seed, size){
|
||
const n = 21, cell = size/n;
|
||
let h = 2166136261;
|
||
for (let i=0;i<seed.length;i++){ h ^= seed.charCodeAt(i); h = Math.imul(h,16777619)>>>0; }
|
||
const rnd = () => { h^=h<<13; h^=h>>>17; h^=h<<5; h>>>=0; return h/4294967296; };
|
||
let cells = '';
|
||
const inFinder = (r,c) => (r<7&&c<7)||(r<7&&c>=n-7)||(r>=n-7&&c<7);
|
||
for (let r=0;r<n;r++) for (let c=0;c<n;c++){
|
||
if (inFinder(r,c)) continue;
|
||
if (rnd() > .52) cells += `<i style="left:${(c*cell).toFixed(1)}px;top:${(r*cell).toFixed(1)}px;width:${cell.toFixed(1)}px;height:${cell.toFixed(1)}px"></i>`;
|
||
}
|
||
const f = (7*cell).toFixed(1);
|
||
return `<div class="qr" style="width:${size}px;height:${size}px">${cells}
|
||
<b style="left:0;top:0;width:${f}px;height:${f}px"></b>
|
||
<b style="left:${size-f}px;top:0;width:${f}px;height:${f}px"></b>
|
||
<b style="left:0;top:${size-f}px;width:${f}px;height:${f}px"></b></div>`;
|
||
}
|
||
|
||
/* ================= NAVIGATION ================= */
|
||
const TAB_SCREENS = ['home','agenda','scan','connections','profile'];
|
||
function go(screen){
|
||
document.querySelectorAll('.screen').forEach(s => s.classList.remove('active'));
|
||
const el = $('screen-' + screen);
|
||
el.classList.add('active');
|
||
el.classList.toggle('no-tab', !TAB_SCREENS.includes(screen));
|
||
$('tabbar').classList.toggle('show', TAB_SCREENS.includes(screen));
|
||
document.querySelectorAll('.tab').forEach(t => t.classList.toggle('active', t.dataset.screen === screen));
|
||
if (screen === 'home') renderHome();
|
||
if (screen === 'agenda') renderAgenda();
|
||
if (screen === 'scan') renderScan();
|
||
if (screen === 'connections') renderConnections();
|
||
if (screen === 'leaderboard') renderLeaderboard();
|
||
if (screen === 'profile') renderProfile();
|
||
renderJump();
|
||
}
|
||
function closeSheet(id){ $(id).classList.remove('show'); }
|
||
function openSheet(id){ $(id).classList.add('show'); }
|
||
|
||
/* ================= HOME ================= */
|
||
function nowNextCard(l, label, cls){
|
||
const pick = sess(state.picks[l.id]);
|
||
const st = slotStatus(l);
|
||
const badge = st==='now' ? '<span class="pill cyan">● NOW</span>'
|
||
: st==='done' ? '<span class="pill">Finished</span>'
|
||
: '<span class="pill violet">UP NEXT</span>';
|
||
return `<div class="card ${cls||''}">
|
||
<div class="row between" style="margin-bottom:8px">
|
||
<span class="muted small" style="font-weight:800">${l.name} · ${l.start}–${l.end}</span>${badge}
|
||
</div>
|
||
${ pick
|
||
? `<div class="h2">${pick.title}</div>
|
||
<div class="muted small" style="margin-top:3px">📍 ${pick.room} · ${pick.speaker} ${st==='now'?'<span class="pill green" style="margin-left:6px">Your pick ✓</span>':''}</div>`
|
||
: `<div class="muted small">No pick yet — <a href="#" style="color:var(--accent)" onclick="event.preventDefault();go('agenda')">choose in the agenda</a></div>`
|
||
}
|
||
</div>`;
|
||
}
|
||
function renderHome(){
|
||
$('home-points').textContent = '⚡ ' + points();
|
||
const nowSlot = SLOTS.find(l => slotStatus(l)==='now') || SLOTS[1];
|
||
const nextSlot = SLOTS.find(l => l.start > nowSlot.end);
|
||
$('home-now').innerHTML = nowNextCard(nowSlot, 'now', 'now-card');
|
||
$('home-next').innerHTML = nextSlot ? nowNextCard(nextSlot, 'next') : '';
|
||
$('home-picks').innerHTML = SLOTS.map(l => {
|
||
const p = sess(state.picks[l.id]);
|
||
return `<button class="pick-chip" onclick="openSession('${p?p.id:''}')">
|
||
<span class="t">${l.start}</span>
|
||
<span class="grow" style="font-weight:600">${p ? p.title : '<span class="muted">No pick</span>'}</span>
|
||
<span>›</span>
|
||
</button>`;
|
||
}).join('');
|
||
}
|
||
|
||
/* ================= AGENDA ================= */
|
||
function renderAgenda(){
|
||
$('agenda-slots').innerHTML = SLOTS.map(l => {
|
||
const st = slotStatus(l);
|
||
const badge = st==='now' ? '<span class="pill cyan">● NOW</span>' : st==='done' ? '<span class="pill">Finished</span>' : '';
|
||
return `<div class="slot-card">
|
||
<div class="slot-head">
|
||
<span class="name">${l.name}</span><span class="time">${l.start}–${l.end}</span>
|
||
<span style="margin-left:auto">${badge}</span>
|
||
</div>
|
||
${SESSIONS.filter(s=>s.slot===l.id).map(s => `
|
||
<button class="sess ${state.picks[l.id]===s.id?'picked':''}" onclick="openSession('${s.id}')">
|
||
<div class="grow">
|
||
<div class="title">${s.title}</div>
|
||
<div class="meta">📍 ${s.room} · ${s.speaker}</div>
|
||
</div>
|
||
<span class="check">✓</span>
|
||
</button>`).join('')}
|
||
</div>`;
|
||
}).join('');
|
||
}
|
||
|
||
/* ================= SESSION DETAIL ================= */
|
||
let sdSession = null;
|
||
function openSession(id){
|
||
if (!id) return;
|
||
sdSession = sess(id);
|
||
const l = slotOf(sdSession);
|
||
const st = slotStatus(l);
|
||
$('sd-title').textContent = sdSession.title;
|
||
$('sd-meta').textContent = `${l.name} · ${l.start}–${l.end} · 📍 ${sdSession.room}`;
|
||
$('sd-desc').textContent = sdSession.desc;
|
||
$('sd-pills').innerHTML = `<span class="pill">🎤 ${sdSession.speaker}</span><span class="pill">👥 ${sdSession.cap} seats</span>`;
|
||
const isPick = state.picks[l.id] === sdSession.id;
|
||
let actions = '';
|
||
if (st === 'done'){
|
||
const fb = state.feedback[sdSession.id];
|
||
if (fb) actions = `<button class="btn" disabled>✓ You rated this ${'★'.repeat(fb.rating)}${fb.comment?' (with comments)':''}</button>`;
|
||
else if (state.checkins.includes(sdSession.id))
|
||
actions = `<button class="btn primary" onclick="startFeedback('${sdSession.id}')">⭐ Give feedback (+5 / +10 pts)</button>`;
|
||
else actions = `<div class="muted small" style="text-align:center">You weren't checked in for this session, so feedback isn't available.</div>`;
|
||
} else {
|
||
actions = isPick
|
||
? `<button class="btn" onclick="togglePick(${l.id},'${sdSession.id}')">✓ Your pick — tap to remove</button>`
|
||
: `<button class="btn primary" onclick="togglePick(${l.id},'${sdSession.id}')">Mark as my pick</button>`;
|
||
}
|
||
$('sd-actions').innerHTML = actions;
|
||
openSheet('sheet-session');
|
||
}
|
||
function togglePick(slotId, sessId){
|
||
if (slotStatus(SLOTS.find(l=>l.id===slotId)) === 'done'){ toast('This slot already finished','err'); return; }
|
||
if (state.picks[slotId] === sessId){ delete state.picks[slotId]; toast('Pick removed'); }
|
||
else { state.picks[slotId] = sessId; toast('✓ Marked as your pick for ' + SLOTS.find(l=>l.id===slotId).name, 'ok'); }
|
||
renderAgenda(); renderHome();
|
||
if (sdSession) openSession(sdSession.id);
|
||
}
|
||
|
||
/* ================= SCAN ================= */
|
||
const ATT_TARGETS = ['diego','bruno','julia']; // new → already connected → pending
|
||
const STAFF_TARGETS = ['bruno','ana','rita']; // new → already checked in → new
|
||
let attScans = 0, staffScans = 0;
|
||
function setRole(role){
|
||
state.user.role = role;
|
||
$('role-att').classList.toggle('active', role==='attendee');
|
||
$('role-staff').classList.toggle('active', role==='staff');
|
||
$('panel-role-att').classList.toggle('active', role==='attendee');
|
||
$('panel-role-staff').classList.toggle('active', role==='staff');
|
||
$('tab-scan-label').textContent = role==='staff' ? 'Check-in' : 'Scan';
|
||
$('qa-scan').textContent = role==='staff' ? 'Check-in' : 'Scan & connect';
|
||
renderScan();
|
||
}
|
||
function renderScan(){
|
||
const staff = state.user.role === 'staff';
|
||
$('scan-title').textContent = staff ? 'Check-in' : 'Scan';
|
||
$('scan-sub').textContent = staff ? 'Scan attendees to check them into a session' : "Scan a peer's lanyard to connect";
|
||
$('staff-pick').style.display = staff ? 'block' : 'none';
|
||
$('scan-hint').textContent = staff ? 'Point at an attendee lanyard' : 'Point at a lanyard QR';
|
||
if (staff){
|
||
const nowSlot = SLOTS.find(l => slotStatus(l)==='now') || SLOTS[1];
|
||
const opts = SESSIONS.filter(s=>s.slot===nowSlot.id);
|
||
$('staff-session').innerHTML = opts.map(s=>`<option value="${s.id}">${s.title} · ${s.room}</option>`).join('');
|
||
}
|
||
}
|
||
function doScan(){
|
||
if (state.user.role === 'staff'){ staffScans++; staffScan(); } else { attScans++; attendeeScan(); }
|
||
}
|
||
function attendeeScan(){
|
||
const target = ATT_TARGETS[(attScans-1) % ATT_TARGETS.length];
|
||
const p = PEOPLE[target];
|
||
$('cn-avatar').outerHTML = avatarHTML(target,72,26).replace('class="avatar"','class="avatar" id="cn-avatar"');
|
||
$('cn-name').textContent = p.name;
|
||
$('cn-company').textContent = p.company;
|
||
const body = $('cn-body');
|
||
if (state.accepted.some(c=>c.id===target)){
|
||
body.innerHTML = `<div class="pill green" style="font-size:14px; padding:10px 16px">✓ Already connected</div>
|
||
<div class="muted small" style="margin-top:10px">You met ${p.name.split(' ')[0]} earlier today.</div>
|
||
<button class="btn" style="margin-top:16px" onclick="closeSheet('sheet-connect')">Close</button>`;
|
||
} else if (state.outgoing.some(c=>c.id===target)){
|
||
body.innerHTML = `<div class="pill amber" style="font-size:14px; padding:10px 16px">⏳ Request pending</div>
|
||
<div class="muted small" style="margin-top:10px">You already asked ${p.name.split(' ')[0]} to connect.</div>
|
||
<button class="btn" style="margin-top:16px" onclick="closeSheet('sheet-connect')">Close</button>`;
|
||
} else {
|
||
body.innerHTML = `<div class="h2" style="margin-bottom:14px">Connect with ${p.name}? 🤝</div>
|
||
<div class="row" style="gap:10px">
|
||
<button class="btn" onclick="closeSheet('sheet-connect')">Cancel</button>
|
||
<button class="btn primary" onclick="sendConnect('${target}')">Connect</button>
|
||
</div>`;
|
||
}
|
||
openSheet('sheet-connect');
|
||
}
|
||
function sendConnect(target){
|
||
state.outgoing.push({ id:target, at:NOW });
|
||
closeSheet('sheet-connect');
|
||
toast('📨 Connection request sent to ' + PEOPLE[target].name.split(' ')[0], 'ok');
|
||
renderConnections();
|
||
}
|
||
function staffScan(){
|
||
const target = STAFF_TARGETS[(staffScans-1) % STAFF_TARGETS.length];
|
||
const sId = $('staff-session').value;
|
||
const s = sess(sId);
|
||
const p = PEOPLE[target];
|
||
$('ck-avatar').outerHTML = avatarHTML(target,72,26).replace('class="avatar"','class="avatar" id="ck-avatar"');
|
||
$('ck-name').textContent = p.name;
|
||
$('ck-session').textContent = s.title + ' · ' + s.room;
|
||
const already = target === 'ana' && state.checkins.includes(sId);
|
||
const body = $('ck-body');
|
||
if (already){
|
||
body.innerHTML = `<div class="pill amber" style="font-size:14px; padding:10px 16px">⚠️ Already checked in</div>
|
||
<button class="btn" style="margin-top:16px" onclick="closeSheet('sheet-checkin')">Close</button>`;
|
||
} else {
|
||
body.innerHTML = `<div class="h2" style="margin-bottom:14px">Check in ${p.name}? ✅</div>
|
||
<div class="muted small" style="margin-bottom:14px">They'll earn <b style="color:var(--amber)">+10 pts</b>.</div>
|
||
<div class="row" style="gap:10px">
|
||
<button class="btn" onclick="closeSheet('sheet-checkin')">Cancel</button>
|
||
<button class="btn primary" onclick="doCheckin('${target}','${sId}')">Check in</button>
|
||
</div>`;
|
||
}
|
||
openSheet('sheet-checkin');
|
||
}
|
||
function doCheckin(target, sId){
|
||
if (target === 'ana'){
|
||
state.checkins.push(sId);
|
||
addPoints(10, 'checkins');
|
||
}
|
||
closeSheet('sheet-checkin');
|
||
toast('✅ ' + PEOPLE[target].name.split(' ')[0] + ' checked in · +10 pts', 'ok');
|
||
}
|
||
|
||
/* ================= CONNECTIONS ================= */
|
||
function setConnTab(tab){
|
||
state.connTab = tab;
|
||
$('ctab-mine').classList.toggle('active', tab==='mine');
|
||
$('ctab-req').classList.toggle('active', tab==='req');
|
||
renderConnections();
|
||
}
|
||
function renderConnections(){
|
||
$('req-count').textContent = state.incoming.length ? `(${state.incoming.length})` : '';
|
||
$('conn-mine').style.display = state.connTab==='mine' ? 'block' : 'none';
|
||
$('conn-req').style.display = state.connTab==='req' ? 'block' : 'none';
|
||
$('conn-mine').innerHTML = state.accepted.length
|
||
? state.accepted.map(c => `
|
||
<div class="conn">${avatarHTML(c.id,44,15)}
|
||
<div class="grow"><div class="name">${PEOPLE[c.id].name}</div>
|
||
<div class="meta">${PEOPLE[c.id].company} · connected at ${c.at}</div></div>
|
||
<span class="pill green">✓</span>
|
||
</div>`).join('')
|
||
: `<div class="empty"><div class="big">🤝</div>No connections yet.<br>Scan a lanyard to meet someone!</div>`;
|
||
const inc = state.incoming.map(c => `
|
||
<div class="conn">${avatarHTML(c.id,44,15)}
|
||
<div class="grow"><div class="name">${PEOPLE[c.id].name}</div>
|
||
<div class="meta">${PEOPLE[c.id].company} · wants to connect · ${c.at}</div></div>
|
||
<button class="btn small primary" onclick="resolveConn('${c.id}',true)">Accept</button>
|
||
<button class="btn small danger" onclick="resolveConn('${c.id}',false)">Reject</button>
|
||
</div>`).join('');
|
||
const out = state.outgoing.map(c => `
|
||
<div class="conn">${avatarHTML(c.id,44,15)}
|
||
<div class="grow"><div class="name">${PEOPLE[c.id].name}</div>
|
||
<div class="meta">${PEOPLE[c.id].company} · you sent a request · ${c.at}</div></div>
|
||
<span class="pill amber">⏳ Pending</span>
|
||
</div>`).join('');
|
||
$('conn-req').innerHTML = (inc+out) || `<div class="empty"><div class="big">📭</div>No requests right now.</div>`;
|
||
}
|
||
function resolveConn(id, accept){
|
||
const i = state.incoming.findIndex(c=>c.id===id);
|
||
if (i < 0) return;
|
||
const [c] = state.incoming.splice(i,1);
|
||
if (accept){
|
||
state.accepted.push(c);
|
||
addPoints(5, 'connections');
|
||
toast('🤝 Connected with ' + PEOPLE[id].name.split(' ')[0] + ' · +5 pts', 'ok');
|
||
} else {
|
||
toast('Request declined');
|
||
}
|
||
renderConnections();
|
||
}
|
||
|
||
/* ================= FEEDBACK ================= */
|
||
function startFeedback(sId){
|
||
closeSheet('sheet-session');
|
||
state.fbSession = sId;
|
||
state.fbRating = 0;
|
||
$('fb-form').style.display = 'block';
|
||
$('fb-success').style.display = 'none';
|
||
$('fb-comment').value = '';
|
||
const s = sess(sId), l = slotOf(s);
|
||
$('fb-session-title').textContent = s.title;
|
||
$('fb-session-meta').textContent = `${l.name} · ${l.start}–${l.end} · ${s.room}`;
|
||
renderStars();
|
||
go('feedback');
|
||
}
|
||
function renderStars(){
|
||
$('fb-stars').innerHTML = [1,2,3,4,5].map(n =>
|
||
`<span class="star ${n<=state.fbRating?'on':''}" onclick="setStar(${n})">★</span>`).join('');
|
||
$('fb-rating-label').textContent = state.fbRating ? [ '','Not great','Meh','Good','Great','Amazing!'][state.fbRating] : 'Tap a star';
|
||
$('fb-submit').disabled = !state.fbRating;
|
||
}
|
||
function setStar(n){ state.fbRating = n; renderStars(); }
|
||
function submitFeedback(){
|
||
const comment = $('fb-comment').value.trim();
|
||
const pts = comment ? 10 : 5;
|
||
state.feedback[state.fbSession] = { rating:state.fbRating, comment };
|
||
addPoints(pts, 'feedback');
|
||
$('fb-form').style.display = 'none';
|
||
$('fb-success-title').textContent = `+${pts} pts earned!`;
|
||
$('fb-success').style.display = 'block';
|
||
}
|
||
|
||
/* ================= LEADERBOARD ================= */
|
||
function renderLeaderboard(){
|
||
const body = $('lb-body');
|
||
if (!state.lbLoaded){
|
||
state.lbLoaded = true;
|
||
body.innerHTML = Array.from({length:6}, ()=>'<div class="skeleton" style="margin-bottom:8px"></div>').join('');
|
||
setTimeout(renderLeaderboardReal, 700);
|
||
return;
|
||
}
|
||
renderLeaderboardReal();
|
||
}
|
||
function renderLeaderboardReal(){
|
||
const ranked = Object.entries(PEOPLE).sort((a,b)=> b[1].points - a[1].points || a[1].name.localeCompare(b[1].name));
|
||
const top3 = ranked.slice(0,3);
|
||
const order = [top3[1], top3[0], top3[2]]; // 2nd, 1st, 3rd (visual order)
|
||
const cls = { 0:'b2', 1:'b1', 2:'b3' }; // bar height by visual position
|
||
const medal = { 0:'🥈', 1:'🥇', 2:'🥉' }; // medal by visual position
|
||
const podium = `<div class="podium">${order.map((e,i)=>{
|
||
const [id,p] = e;
|
||
return `<div class="pod">
|
||
${avatarHTML(id,52,17)}
|
||
<div class="pname">${p.name.split(' ')[0]}${id===state.user.id?' (you)':''}</div>
|
||
<div class="ppoints">${p.points} pts</div>
|
||
<div class="bar ${cls[i]}">${medal[i]}</div>
|
||
</div>`;
|
||
}).join('')}</div>`;
|
||
const rows = ranked.map(([id,p],i) => `
|
||
<div class="lb-row ${id===state.user.id?'me':''}">
|
||
<span class="rank">${i+1}</span>
|
||
${avatarHTML(id,40,14)}
|
||
<div class="grow"><div class="name" style="font-weight:700;font-size:14px">${p.name}${id===state.user.id?' <span class="pill violet" style="font-size:10px;padding:2px 8px">You</span>':''}</div>
|
||
<div class="muted small">${p.company}</div></div>
|
||
<span class="pts">${p.points}</span>
|
||
</div>`).join('');
|
||
$('lb-body').innerHTML = podium + rows;
|
||
}
|
||
|
||
/* ================= PROFILE ================= */
|
||
function renderProfile(){
|
||
const p = me();
|
||
$('pf-avatar').outerHTML = `<span class="avatar" id="pf-avatar" style="width:72px;height:72px;font-size:26px;margin:0 auto;background:${avColor(state.user.id)}">${initials(p.name)}</span>`;
|
||
$('pf-name').textContent = p.name;
|
||
$('pf-company').textContent = p.company + ' · [email protected]';
|
||
$('pf-role').textContent = state.user.role === 'staff' ? '🧑💼 Staff' : '🙋 Attendee';
|
||
$('pf-points').textContent = '⚡ ' + points() + ' pts';
|
||
$('pf-qr').innerHTML = qrHTML('ik-qr-' + state.user.id, 150);
|
||
const b = state.breakdown;
|
||
$('pf-breakdown').innerHTML = `
|
||
<div class="break-row"><span>✅ Session check-ins <span class="muted small">(${state.checkins.length})</span></span><span class="v">+${b.checkins}</span></div>
|
||
<div class="break-row"><span>🤝 Connections <span class="muted small">(${state.accepted.length})</span></span><span class="v">+${b.connections}</span></div>
|
||
<div class="break-row"><span>⭐ Feedback <span class="muted small">(${Object.keys(state.feedback).length})</span></span><span class="v">+${b.feedback}</span></div>
|
||
<div class="break-row"><span class="h2">Total</span><span class="v" style="font-size:17px">${points()} pts</span></div>`;
|
||
}
|
||
function doLogout(){
|
||
toast('Logged out — see you at the event! 👋');
|
||
setTimeout(()=> go('login-scan'), 500);
|
||
}
|
||
|
||
/* ================= LOGIN ================= */
|
||
function doLoginScan(){
|
||
$('lc-avatar').outerHTML = `<span class="avatar" id="lc-avatar" style="width:64px;height:64px;font-size:22px;background:${avColor('ana')}">${initials(PEOPLE.ana.name)}</span>`;
|
||
$('lc-name').textContent = PEOPLE.ana.name;
|
||
$('lc-email').value = '';
|
||
go('login-confirm');
|
||
}
|
||
function doLoginConfirm(){
|
||
const email = $('lc-email').value.trim().toLowerCase();
|
||
if (email === '[email protected]'){
|
||
toast('Welcome back, Ana! 👋', 'ok');
|
||
go('home');
|
||
} else {
|
||
toast('This email doesn\'t match the lanyard. Try again.', 'err');
|
||
}
|
||
}
|
||
|
||
/* ================= SIDE PANEL ================= */
|
||
const JUMP = [
|
||
['splash','Splash'], ['login-scan','Login · Scan'], ['login-confirm','Login · Confirm'],
|
||
['home','Home'], ['agenda','Agenda'], ['scan','Scan / Check-in'],
|
||
['connections','Connections'], ['feedback','Feedback'], ['leaderboard','Leaderboard'], ['profile','Profile'],
|
||
];
|
||
function renderJump(){
|
||
const cur = document.querySelector('.screen.active').id.replace('screen-','');
|
||
$('jump-list').innerHTML = JUMP.map(([id,label]) =>
|
||
`<button class="${id===cur?'cur':''}" onclick="go('${id}')">${label}</button>`).join('');
|
||
}
|
||
function renderAll(){
|
||
renderHome(); renderAgenda(); renderConnections(); renderProfile();
|
||
if ($('screen-leaderboard').classList.contains('active')) renderLeaderboardReal();
|
||
}
|
||
|
||
/* ================= INIT ================= */
|
||
$('vf-qr').innerHTML = qrHTML('lanyard-ana', 120);
|
||
$('vf-qr2').innerHTML = qrHTML('lanyard-peer', 120);
|
||
renderStars();
|
||
document.querySelectorAll('.tab').forEach(t => t.addEventListener('click', ()=> go(t.dataset.screen)));
|
||
$('screen-splash').addEventListener('click', ()=> go('login-scan'));
|
||
setTimeout(()=>{ if ($('screen-splash').classList.contains('active')) go('login-scan'); }, 2200);
|
||
renderJump();
|
||
</script>
|
||
</body>
|
||
</html>
|