● Zion Boggan
repos/Stepping App/apps/web/src/app/tickets/page.tsx
zionboggan.com ↗
67 lines · tsx
History for this file →
1
import Link from "next/link";
2
import { SiteFooter } from "@/components/site-footer";
3
import { serverCaller } from "@/lib/trpc/server";
4
 
5
export const dynamic = "force-dynamic";
6
export const metadata = { title: "My Tickets · Stepping" };
7
 
8
function fmt(d: Date | null) {
9
  if (!d) return "DATE TBD";
10
  return new Date(d)
11
    .toLocaleString("en-US", {
12
      weekday: "short",
13
      month: "short",
14
      day: "numeric",
15
      hour: "numeric",
16
      minute: "2-digit",
17
    })
18
    .toUpperCase();
19
}
20
 
21
export default async function TicketsPage() {
22
  const tickets = await serverCaller().ticket.mine();
23
 
24
  return (
25
    <main className="mx-auto w-full max-w-3xl px-5 py-16 sm:px-8">
26
      <Link href="/" className="kicker hover:text-gold">
27
        ← Chicago Stepping
28
      </Link>
29
 
30
      <p className="kicker mt-10 text-ash">Your passes</p>
31
      <h1 className="display mt-3 text-6xl sm:text-7xl">My Tickets</h1>
32
 
33
      {tickets.length === 0 ? (
34
        <p className="serif mt-8 text-xl text-ash">
35
          No tickets yet. Reserve a set or weekender and it shows up here, ready
36
          at the door.
37
        </p>
38
      ) : (
39
        <ul className="mt-10 flex flex-col gap-5">
40
          {tickets.map((t) => (
41
            <li
42
              key={t.id}
43
              className="flex items-stretch overflow-hidden border border-[var(--line)]"
44
            >
45
              <div className="flex-1 p-5">
46
                <p className="kicker text-gold">{(t.typeName ?? "TICKET").toUpperCase()}</p>
47
                <p className="display mt-1 text-2xl">{t.eventTitle}</p>
48
                <p className="kicker mt-2 text-ash">{fmt(t.startsAt)}</p>
49
              </div>
50
              <div className="flex w-40 flex-col items-center justify-center gap-1 border-l border-dashed border-[var(--line)] bg-gold/5 p-4">
51
                <span className="kicker text-ash">{t.status.toUpperCase()}</span>
52
                <span
53
                  className="text-center text-lg font-bold tracking-widest text-gold"
54
                  style={{ fontFamily: "var(--font-space-mono), monospace" }}
55
                >
56
                  {t.code}
57
                </span>
58
                <span className="kicker text-ash">Show at door</span>
59
              </div>
60
            </li>
61
          ))}
62
        </ul>
63
      )}
64
      <SiteFooter />
65
    </main>
66
  );
67
}