import { useEffect, useState } from 'preact/hooks'; type EntryBody = { err: boolean; referral: string; key: string; } export const Home = () => { const [referral, setReferral] = useState(''); const [entryBody, setEntryBody] = useState({ err: true, referral: '', key: '' }); const [timeLeft, setTimeLeft] = useState('...'); useEffect(() => { console.log('Referral:', referral); }, [referral]); const entry = async () => { let res = await fetch("http://localhost:8080/entry", { method: 'GET', headers: { referral } }) if (!res.ok) { console.error('Error:', res.status); return } let body: EntryBody = await res.json(); if (body.err) { console.error('Error:', body.referral); window.location.href = '/error'; return } console.log('Entry:', body); setEntryBody(body); setReferral(''); } const eventDateCET = new Date('2025-01-01T00:00:00Z'); const userTime = new Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', timeZoneName: 'short' }).format(eventDateCET); const getTimeLeft = (date: Date) => { const now = new Date(); const diff = date.getTime() - now.getTime(); const days = Math.floor(diff / (1000 * 60 * 60 * 24)); const hours = Math.floor(diff / (1000 * 60 * 60) % 24); const minutes = Math.floor(diff / (1000 * 60) % 60); const seconds = Math.floor(diff / 1000 % 60); let s = ""; if (days > 0) s += days + "d "; if (hours > 0) s += hours + "h "; if (minutes > 0) s += minutes + "m "; if (seconds > 0) s += seconds + "s"; if (s === "") s = "the time is upon us."; else s += " remaining."; return s; } useEffect(() => { const interval = setInterval(() => { setTimeLeft(getTimeLeft(eventDateCET)); }, 1000); return () => clearInterval(interval); }, []); return (

???

{timeLeft}

Referral:

setReferral(e.currentTarget.value)} class="bg-black text-green-500 border-green-500 border-2 px-2 hover:bg-green-500 hover:text-black active:bg-green-500 active:text-black transition-colors" />
{ !entryBody.err ? (

tip: click to copy.

navigator.clipboard.writeText(entryBody?.key)}>Key: {entryBody?.key}

navigator.clipboard.writeText(entryBody?.referral)}>Referral: {entryBody?.referral}

good luck. keep note of these, if you lose them, you can't reroll.

) : (
What is this?

At exactly {userTime} (00:00 CET on 1 Jan), the system will choose a random entry. Their referral key shall be publicly displayed on this page. The person associated with this referral key shall contact us with their private key. They shall win a little prize. To have one's entry weigh more than the rest, one shall have to spread their referral key amongst people. Every referral shall increase their chance of getting selected.

How does one enter?

One needs a referral key to enter.

) }
) };