Announcement card doubles as a notice

Today's webinar was cancelled and the card had no way to say so: it required a
flyer to render at all, and it always drew a Join Google Meet button and the
calendar buttons, so the only shape it could take was an invitation.

It now renders without an image, and with no meetUrl it draws no Join button and
no calendar row. Never invite someone to a meeting that is not happening.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-24 12:45:19 -05:00
parent 3b35afa944
commit 9ac2384e87
+16 -10
View File
@@ -9,7 +9,9 @@
}
function start(EV) {
if (!EV || !EV.enabled || !EV.id || !EV.img) return false;
// A cancellation has no flyer and no meet link, so neither is required any more: the
// same card doubles as a plain notice (Marty, 2026-09-24).
if (!EV || !EV.enabled || !EV.id) return false;
if (EV.expiresUTC) { var exp = Date.parse(EV.expiresUTC); if (exp && Date.now() > exp) return false; }
var KEY = 'rmc-announce-' + EV.id;
try { if (localStorage.getItem(KEY) === 'done') return false; } catch (e) {}
@@ -51,10 +53,12 @@
eyebrow.textContent = EV.eyebrow || '';
eyebrow.style.cssText = 'text-align:center;letter-spacing:2px;text-transform:uppercase;font-size:11px;font-weight:700;color:#d4af37;padding:14px 44px 10px;';
var img = document.createElement('img');
img.src = EV.img;
img.alt = EV.eyebrow || 'Event flyer';
img.style.cssText = 'display:block;width:100%;height:auto;';
var img = EV.img ? document.createElement('img') : null;
if (img) {
img.src = EV.img;
img.alt = EV.eyebrow || 'Event flyer';
img.style.cssText = 'display:block;width:100%;height:auto;';
}
var foot = document.createElement('div');
foot.style.cssText = 'padding:16px 20px 20px;';
@@ -82,15 +86,17 @@
foot.appendChild(grid);
}
var join = document.createElement('a');
join.href = EV.meetUrl || '#'; join.target = '_blank'; join.rel = 'noopener';
var join = EV.meetUrl ? document.createElement('a') : null;
if (join) {
join.href = EV.meetUrl; join.target = '_blank'; join.rel = 'noopener';
join.textContent = 'Join Google Meet →';
join.style.cssText = 'display:block;text-align:center;text-decoration:none;background:linear-gradient(180deg,#e9c249,#d4af37);' +
'color:#0a1119;font-size:18px;font-weight:800;padding:15px;border-radius:12px;box-shadow:0 8px 22px rgba(212,175,55,.35);';
join.addEventListener('click', done);
foot.appendChild(join);
}
var st = EV.startUTC ? Date.parse(EV.startUTC) : 0;
var st = (EV.meetUrl && EV.startUTC) ? Date.parse(EV.startUTC) : 0;
if (st) {
var en = st + (Number(EV.durationMin) || 60) * 60000;
var f = function (ms) { return new Date(ms).toISOString().replace(/[-:]|\.\d{3}/g, ''); };
@@ -132,7 +138,7 @@
later.addEventListener('click', dismiss);
foot.appendChild(later);
card.appendChild(x); card.appendChild(eyebrow); card.appendChild(img); card.appendChild(foot);
card.appendChild(x); card.appendChild(eyebrow); if (img) card.appendChild(img); card.appendChild(foot);
back.appendChild(card); document.body.appendChild(back);
document.addEventListener('keydown', onKey);
requestAnimationFrame(function () { back.style.opacity = '1'; });
@@ -183,7 +189,7 @@
later.textContent = 'Not now'; later.style.cssText = 'display:block;margin:10px auto 0;background:none;border:none;color:#7d8ea0;font-size:13px;cursor:pointer;text-decoration:underline;';
later.addEventListener('click', close);
foot.appendChild(cta); foot.appendChild(later);
card.appendChild(x); card.appendChild(img); card.appendChild(foot);
card.appendChild(x); if (img) card.appendChild(img); card.appendChild(foot);
back.appendChild(card); document.body.appendChild(back);
document.addEventListener('keydown', onKey);
requestAnimationFrame(function () { back.style.opacity = '1'; });