From 5e55dbe90060e67b4023944ad9428e7e25ce19a7 Mon Sep 17 00:00:00 2001 From: King Omar Date: Sat, 27 Jun 2026 03:00:40 +1000 Subject: [PATCH] Force AEC membership modal on 3rd vote or first petition; shrink login button - Replace email-only capture with full AEC membership modal (name, DOB, address, suburb, state, postcode, email, phone, electoral roll consent) - Trigger modal on first upvote (petition signature) OR after 3rd vote - Modal posts to /api/join and emails details to party contact - localStorage 'radical_member_joined' tracks completion/dismiss per device - Shrink .login-link to match other footer links (was pink button, now text) Co-Authored-By: Claude Sonnet 4.6 --- index.html | 185 ++++++++++++++++++++++++++++++++++++++++++----------- styles.css | 19 ++---- 2 files changed, 152 insertions(+), 52 deletions(-) diff --git a/index.html b/index.html index dcdb9a2..74f1aa1 100644 --- a/index.html +++ b/index.html @@ -139,6 +139,31 @@ .milestone-bar-fill{background:#ff0099;height:4px;transition:width .4s ease} .milestone-label{font-family:'Roboto Mono',monospace;font-size:10px;color:#666} .milestone-label span{color:#ff0099} +/* ── AEC Membership modal ── */ +.membership-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:3000;display:flex;align-items:center;justify-content:center;padding:16px;overflow-y:auto} +.membership-modal{background:#000;border:2px solid #ff0099;padding:0;max-width:520px;width:100%;font-family:'Roboto Mono',monospace;max-height:90vh;overflow-y:auto} +.membership-modal-header{background:#ff0099;color:#000;padding:12px 16px;display:flex;justify-content:space-between;align-items:center} +.membership-modal-header h3{margin:0;font-size:15px;font-weight:700} +.membership-modal-close{background:none;border:none;color:#000;font-size:18px;cursor:pointer;line-height:1;padding:0 4px} +.membership-modal-intro{font-size:11px;color:#888;padding:12px 16px 0;margin:0;line-height:1.6} +#mm-form{padding:12px 16px 0} +.mm-row{display:flex;gap:10px;flex-wrap:wrap} +.mm-field{display:flex;flex-direction:column;gap:3px;flex:1;min-width:120px;margin-bottom:10px} +.mm-field--xs{flex:0 0 80px;min-width:70px} +.mm-field label{font-size:10px;color:#666;text-transform:uppercase;letter-spacing:.5px} +.mm-input{background:#0a0a0a;border:1px solid #333;color:#fff;padding:8px 10px;font-family:'Roboto Mono',monospace;font-size:12px;width:100%;box-sizing:border-box} +.mm-input:focus{outline:none;border-color:#ff0099} +.mm-input option{background:#111} +.mm-check{display:flex;align-items:flex-start;gap:8px;margin-bottom:10px} +.mm-check input[type=checkbox]{margin-top:2px;accent-color:#ff0099;flex-shrink:0} +.mm-check label{font-size:11px;color:#888;line-height:1.5} +.mm-msg{font-size:11px;min-height:16px;margin-bottom:8px} +.mm-error{color:#ff0099} +.mm-submit{width:100%;background:#ff0099;color:#000;border:none;padding:12px;font-family:'Roboto Mono',monospace;font-size:13px;font-weight:700;cursor:pointer;letter-spacing:1px} +.mm-submit:hover{background:#ff33aa} +.mm-submit:disabled{opacity:.5;cursor:not-allowed} +.mm-later{display:block;width:100%;background:none;border:none;color:#444;font-family:'Roboto Mono',monospace;font-size:11px;cursor:pointer;padding:10px;text-align:center;margin:0} +.mm-later:hover{color:#888} /* ── Email capture modal ── */ .email-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.85);z-index:2000;display:flex;align-items:center;justify-content:center;padding:16px} .email-modal{background:#000;border:2px solid #ff0099;padding:28px;max-width:420px;width:100%;font-family:'Roboto Mono',monospace} @@ -1299,11 +1324,15 @@ async function handleVote(proposalId, voteType) { // Also update the modal if it's open and showing this proposal updateModalVoteUI(proposalId, voteType, wasUpvoted, wasDownvoted); - // Track vote count for email capture prompt + // Track votes and trigger AEC membership modal const vc = (parseInt(localStorage.getItem('radical_vote_count') || '0')) + 1; localStorage.setItem('radical_vote_count', String(vc)); - if (vc === 3 && !localStorage.getItem('radical_email_captured')) { - setTimeout(showEmailCaptureModal, 600); + const alreadyJoined = localStorage.getItem('radical_member_joined'); + if (!alreadyJoined) { + // Trigger on first upvote (petition) OR 3rd vote of any kind + if (voteType === 'upvote' || vc >= 3) { + setTimeout(showMembershipModal, 600); + } } // Submit vote to server in the background @@ -3099,53 +3128,135 @@ function openProposal(proposalId) { .catch(() => {}); } -// ─── EMAIL CAPTURE ──────────────────────────────────────────────────────── -function showEmailCaptureModal() { - if (document.querySelector('.email-modal-overlay')) return; +// ─── AEC MEMBERSHIP MODAL ───────────────────────────────────────────────── +function showMembershipModal() { + if (document.querySelector('.membership-modal-overlay')) return; + const overlay = document.createElement('div'); - overlay.className = 'email-modal-overlay'; + overlay.className = 'membership-modal-overlay'; overlay.innerHTML = ` -