Skip to content

Commit 239dcbe

Browse files
authored
Merge pull request #26 from Szedann/main
View Schedule button
2 parents 67f6904 + 8f4f012 commit 239dcbe

File tree

3 files changed

+58
-43
lines changed

3 files changed

+58
-43
lines changed

components/Schedule.tsx

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Fragment } from "preact/jsx-runtime";
21
import FormattedDateTime from "../islands/DateTime.tsx";
32
import { ScheduleEntryData, User } from "../lib/types.d.tsx";
43
import UserLink from "./UserLink.tsx";
@@ -8,47 +7,49 @@ export function Schedule(
87
) {
98
return (
109
<div class="card">
11-
<h1>Event Schedule</h1>
10+
<h1 id="schedule">Event Schedule</h1>
1211
<div>
1312
{props.schedule.map((entry) => {
1413
return (
1514
<div key={entry.id} class="py-4">
1615
<h3 id={`event-${entry.id}`}>{entry.title}</h3>
1716
<table class="w-full">
18-
<tr>
19-
<td>Type</td>
20-
<td>
21-
{entry.type?.split(" ").map((word) =>
22-
word.slice(0, 1).toUpperCase() + word.slice(1)
23-
).join(" ") ?? "-"}
24-
</td>
25-
</tr>
26-
<tr>
27-
<td>Time</td>
28-
<td>
29-
{entry.start
30-
? <FormattedDateTime time={entry.start} />
31-
: "-"} - {entry.end
32-
? <FormattedDateTime time={entry.end} timeOnly />
33-
: "-"}
34-
</td>
35-
</tr>
36-
<tr>
37-
<td>Location</td>
38-
<td>
39-
{entry.location ?? "-"}
40-
</td>
41-
</tr>
42-
<tr>
43-
<td>Hosts</td>
44-
<td>
45-
<Authors authors={entry.authors} users={props.users} />
46-
</td>
47-
</tr>
48-
<tr>
49-
<td>Description</td>
50-
<td class="w-full">{entry.description ?? "-"}</td>
51-
</tr>
17+
<tbody>
18+
<tr>
19+
<td>Type</td>
20+
<td>
21+
{entry.type?.split(" ").map((word) =>
22+
word.slice(0, 1).toUpperCase() + word.slice(1)
23+
).join(" ") ?? "-"}
24+
</td>
25+
</tr>
26+
<tr>
27+
<td>Time</td>
28+
<td>
29+
{entry.start
30+
? <FormattedDateTime time={entry.start} />
31+
: "-"} - {entry.end
32+
? <FormattedDateTime time={entry.end} timeOnly />
33+
: "-"}
34+
</td>
35+
</tr>
36+
<tr>
37+
<td>Location</td>
38+
<td>
39+
{entry.location ?? "-"}
40+
</td>
41+
</tr>
42+
<tr>
43+
<td>Hosts</td>
44+
<td>
45+
<Authors authors={entry.authors} users={props.users} />
46+
</td>
47+
</tr>
48+
<tr>
49+
<td>Description</td>
50+
<td class="w-full">{entry.description ?? "-"}</td>
51+
</tr>
52+
</tbody>
5253
</table>
5354
</div>
5455
);

routes/vanity/bc25.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { RouteConfig, RouteContext } from "$fresh/server.ts";
22

3-
import { fetchEvent, fetchEventSchedule, fetchEventSubmissions, fetchUser } from "../../lib/platform-api.tsx";
3+
import {
4+
fetchEvent,
5+
fetchEventSchedule,
6+
fetchEventSubmissions,
7+
fetchUser,
8+
} from "../../lib/platform-api.tsx";
49
import { asset, Head } from "$fresh/runtime.ts";
510
import { getPagesMarkdown } from "../../lib/helpers.tsx";
611
import { MarkdownBlocks } from "../../components/MarkdownBlocks.tsx";
@@ -20,12 +25,12 @@ export default async function Event(_req: Request, ctx: RouteContext) {
2025

2126
const submissions = await fetchEventSubmissions(fetch, eventId);
2227
const schedule = await fetchEventSchedule(fetch, eventId);
23-
schedule.sort((a, b) => (a.start ?? "") > (b.start ?? "") ? 1 : -1)
28+
schedule.sort((a, b) => (a.start ?? "") > (b.start ?? "") ? 1 : -1);
2429
const users = await Promise.all(
25-
[...new Set(schedule.flatMap((s) => s.authors))].map((author) =>
26-
fetchUser(fetch, author)
27-
),
28-
)
30+
[...new Set(schedule.flatMap((s) => s.authors))].map((author) =>
31+
fetchUser(fetch, author)
32+
),
33+
);
2934
const content = await getPagesMarkdown(`event/${eventId}`);
3035
return (
3136
<div className="bg-[#86dbfe]">
@@ -177,6 +182,11 @@ export default async function Event(_req: Request, ctx: RouteContext) {
177182
View Submissions
178183
</a>
179184
)}
185+
{!!schedule && schedule.length > 0 && (
186+
<a href="#schedule" class="button">
187+
View Schedule
188+
</a>
189+
)}
180190
</div>
181191
</div>
182192
<div className="bg-[#185090] bg-repeat bg-[auto_96px] bg-[center_top_48px] pixelated -mb-20">
@@ -210,7 +220,9 @@ export default async function Event(_req: Request, ctx: RouteContext) {
210220
</div>
211221
</article>
212222
<MarkdownBlocks content={content} />
213-
{schedule && schedule.length > 0 ? <Schedule schedule={schedule} users={users}></Schedule> : null}
223+
{schedule && schedule.length > 0
224+
? <Schedule schedule={schedule} users={users}></Schedule>
225+
: null}
214226
</div>
215227
</div>
216228
</div>

static/assets/vanity/bc25/main.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@layer components {
77
* {
88
border-radius: 0 !important;
9+
scroll-behavior: smooth;
10+
scroll-margin-top: 1em;
911
}
1012
h1, h2, h3 {
1113
font-family: pixel;

0 commit comments

Comments
 (0)