founders-break/views/flyer.ejs

139 lines
6.1 KiB
Text

<%
/* /flyer - the link you send someone so they can grab the poster and pass it
on. Same next-occurrence rule as the home page so the date on this page is
never stale. */
const TZ = site.timezone || "America/New_York";
const V = site.venue;
const now = new Date();
const todayISO = new Intl.DateTimeFormat("en-CA", {
timeZone: TZ, year: "numeric", month: "2-digit", day: "2-digit",
}).format(now);
const hourET = Number(
new Intl.DateTimeFormat("en-US", { timeZone: TZ, hour: "2-digit", hourCycle: "h23" }).format(now)
) % 24;
const toDate = (iso) => { const [y, m, d] = iso.split("-").map(Number); return new Date(Date.UTC(y, m - 1, d)); };
const isoOf = (dt) => dt.toISOString().slice(0, 10);
let next = toDate(todayISO);
const first = toDate(site.firstEvent);
if (next < first) next = first;
while (next.getUTCDay() !== site.weekday) next.setUTCDate(next.getUTCDate() + 1);
if (isoOf(next) === todayISO && hourET >= (site.endHour24 || 21)) next.setUTCDate(next.getUTCDate() + 7);
(site.cancelled || []).length && (function () {
while ((site.cancelled || []).includes(isoOf(next))) next.setUTCDate(next.getUTCDate() + 7);
})();
const nextLong = new Intl.DateTimeFormat("en-US", {
timeZone: "UTC", weekday: "long", month: "long", day: "numeric",
}).format(next);
const weekdayName = new Intl.DateTimeFormat("en-US", { timeZone: "UTC", weekday: "long" }).format(next);
const pdf = "/assets/founders-break-flyer.pdf";
const shareText = `${site.name}: a free pool social for people building things in ${V.city}. Every ${weekdayName}, ${site.startTime} to ${site.endTime} at ${V.name}, ${V.street}. 18+, no cover.`;
%><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Share <%= site.name %> | Printable flyer</title>
<meta name="description" content="<%= site.description %>">
<meta name="theme-color" content="#06060b">
<meta property="og:type" content="website">
<meta property="og:title" content="<%= site.name %> | Every <%= weekdayName %> at <%= V.name %>">
<meta property="og:description" content="<%= site.description %>">
<meta property="og:image" content="<%= site.images.share %>">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:url" content="<%= site.url %>/flyer">
<meta name="twitter:card" content="summary_large_image">
<link rel="icon" href="/images/favicon.svg" type="image/svg+xml">
<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=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/style.css">
<script>document.documentElement.className += " js";</script>
</head>
<body>
<a class="skip" href="#main">Skip to content</a>
<header class="nav" id="nav">
<a class="brand" href="/">
<img class="brand-mark" src="/images/onetouch-studio.svg" alt="" width="26" height="26">
<span class="brand-name"><%= site.name %></span>
</a>
<nav class="nav-right" aria-label="Primary">
<a class="nav-link" href="/#details">Details</a>
<a class="nav-link" href="/#venue">The venue</a>
<a class="nav-cta" href="/#rsvp">RSVP</a>
</nav>
</header>
<main id="main" class="share-page">
<div class="share-grid">
<figure class="flyer-shot">
<a href="<%= pdf %>" download data-track="flyer-open-preview">
<img src="/images/flyer-preview.png" width="1632" height="2112"
alt="The printable flyer: The Founder's Break, every Thursday 7 to 9 PM at Silver Q, 225 W University Ave.">
</a>
</figure>
<div class="share-copy">
<p class="eyebrow">Printable flyer</p>
<h1>Put this up somewhere.</h1>
<p class="share-sub">One page, US Letter, prints fine in black and white. The code on it goes straight to the RSVP. The next Break is <%= nextLong %>.</p>
<div class="share-actions">
<a class="btn btn-primary" href="<%= pdf %>" download data-track="flyer-download">Download the PDF</a>
<button class="btn btn-ghost" type="button" id="share-native" hidden data-track="share-native">Share</button>
</div>
<div class="share-channels">
<p class="channels-label">Or send it directly</p>
<ul>
<li><a id="share-sms" href="#" data-track="share-sms">Text message</a></li>
<li><a id="share-email" href="#" data-track="share-email">Email</a></li>
<li><a id="share-whatsapp" href="#" target="_blank" rel="noopener" data-track="share-whatsapp">WhatsApp</a></li>
<li><a id="share-x" href="#" target="_blank" rel="noopener" data-track="share-x">X</a></li>
<li><a id="share-linkedin" href="#" target="_blank" rel="noopener" data-track="share-linkedin">LinkedIn</a></li>
<li><a id="share-facebook" href="#" target="_blank" rel="noopener" data-track="share-facebook">Facebook</a></li>
</ul>
<button class="copy-link" type="button" id="copy-link" data-track="share-copy">
<span id="copy-label">Copy the link</span>
<span class="copy-url"><%= site.url.replace(/^https:\/\//, "") %></span>
</button>
</div>
</div>
</div>
</main>
<footer class="foot">
<p class="foot-line">Bring your ideas and a valid ID.</p>
<div class="foot-meta">
<a class="foot-host" href="<%= site.host.url %>" target="_blank" rel="noopener">
<img src="/images/onetouch-studio.svg" alt="" width="20" height="20">
<span>Hosted by <%= site.host.name %></span>
</a>
<a href="/#rsvp">RSVP</a>
<a href="<%= V.mapUrl %>" target="_blank" rel="noopener"><%= V.name %>, <%= V.street %></a>
</div>
</footer>
<script>
window.__fbShare = {
url: <%- JSON.stringify(site.url) %>,
pdf: <%- JSON.stringify(site.url + pdf) %>,
text: <%- JSON.stringify(shareText) %>,
title: <%- JSON.stringify(site.name) %>,
siteId: <%- JSON.stringify(tenant.id) %>
};
</script>
<script src="/js/share.js" defer></script>
</body>
</html>