Skip to content

Commit 82d889f

Browse files
committed
Fresh look based one schedule from 2024.
1 parent 2986d4c commit 82d889f

File tree

9 files changed

+209
-32
lines changed

9 files changed

+209
-32
lines changed

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
EP_SESSIONS_API="https://static.europython.eu/programme/ep2025/releases/current/sessions.json"
22
EP_SPEAKERS_API="https://static.europython.eu/programme/ep2025/releases/current/speakers.json"
3+
EP_SCHEDULE_API="https://gist.githubusercontent.com/nikoshell/55ab27b228a31130134f689429e93bf5/raw/a1542efb298366645ad44ae9087772671646d51b/schedule.json"

src/components/schedule/break.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ const { time, title, style }: Props = Astro.props;
1919
color: var(--color-text);
2020
display: flex;
2121
align-items: center;
22-
font-weight: bold;
22+
text-align: center;
23+
justify-items: center;
24+
/*font-weight: bold;*/
2325
padding-left: 8px;
26+
font-size:1rem;
27+
background-color: #FCFBFA;
2428
}
2529
</style>

src/components/schedule/session.astro

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const hasFooter = hasRoom || hasSpeakers;
2525
---
2626

2727
<div class:list={["session", session.level, session.sessionType]} style={style}>
28+
<!--
2829
<header>
2930
{
3031
session.sessionType === "poster" && (
@@ -42,9 +43,10 @@ const hasFooter = hasRoom || hasSpeakers;
4243
</>
4344
)
4445
}
45-
</header>
46+
</header>
47+
-->
4648

47-
<div class="time">
49+
<!-- <div class="time">
4850
<span class="sr-only">Session start:</span>
4951
<time>
5052
{formatInTimeZone(session.start, "Europe/Prague", "HH:mm")}
@@ -54,6 +56,7 @@ const hasFooter = hasRoom || hasSpeakers;
5456
<span class="sr-only">Session end:</span>
5557
<time>{formatInTimeZone(session.end, "Europe/Prague", "HH:mm")}</time>
5658
</div>
59+
-->
5760

5861
<h2>{session.title}</h2>
5962

@@ -86,7 +89,13 @@ const hasFooter = hasRoom || hasSpeakers;
8689
font-weight: bold;
8790
display: grid;
8891
flex-direction: column;
89-
background-color: var(--color-body-background);
92+
/*background-color: var(--color-body-background);*/
93+
94+
background-color: color-mix(
95+
in srgb,
96+
var(--color-body-background),
97+
white 30%
98+
);
9099
position: relative;
91100

92101
grid-template-areas:
@@ -120,6 +129,7 @@ const hasFooter = hasRoom || hasSpeakers;
120129
bottom: 0;
121130
left: 0;
122131
z-index: 1;
132+
123133
}
124134

125135
footer :global(a) {
@@ -135,7 +145,7 @@ const hasFooter = hasRoom || hasSpeakers;
135145
display: flex;
136146
flex-direction: column;
137147
align-items: center;
138-
border-right: 1px solid var(--color-text);
148+
/*border-right: 1px solid var(--color-text);*/
139149
gap: 4px;
140150

141151
& .minus {
@@ -169,7 +179,7 @@ const hasFooter = hasRoom || hasSpeakers;
169179
background-color: color-mix(
170180
in srgb,
171181
var(--color-body-background),
172-
white 40%
182+
white 50%
173183
);
174184
}
175185

@@ -190,13 +200,13 @@ const hasFooter = hasRoom || hasSpeakers;
190200
}
191201

192202
footer.has-speakers {
193-
border-top: 1px solid var(--color-text);
203+
/*border-top: 1px solid var(--color-text);*/
194204
margin-top: auto;
195205
}
196206

197207
header {
198208
background-color: var(--color-primary);
199-
border-bottom: 2px solid var(--color-primary);
209+
/*border-bottom: 2px solid var(--color-primary);*/
200210
color: black;
201211
text-transform: capitalize;
202212
font-size: 0.8em;

src/content/config.ts

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineCollection, reference, z } from "astro:content";
2-
import { loadData } from "../utils/dataLoader";
2+
import { loadData } from "@utils/dataLoader";
33

44
const mode = import.meta.env.MODE;
55
console.log(`\x1b[35m[EP]\x1b[0m Current MODE: \x1b[1m\x1b[34m${mode}\x1b[0m`);
@@ -158,18 +158,59 @@ const sessions = defineCollection({
158158
}),
159159
});
160160

161+
//const days = defineCollection({
162+
// type: "data",
163+
// schema: z.object({
164+
// rooms: z.array(z.string()),
165+
// events: z.array(
166+
// z.object({
167+
// rooms: z.array(z.string()),
168+
// event_type: z.string(),
169+
// code: z.string().optional(),
170+
// title: z.string(),
171+
// slug: z.string().optional(),
172+
// session_type: z.string().optional(), // why?
173+
// speakers: z
174+
// .array(
175+
// z.object({
176+
// code: z.string(),
177+
// name: z.string(),
178+
// website_url: z.string(),
179+
// })
180+
// )
181+
// .optional(),
182+
// tweet: z.string().optional().nullable(),
183+
// level: z.string().optional().nullable(),
184+
// start: z.string(),
185+
// website_url: z.string().optional().nullable(),
186+
// duration: z.number(),
187+
// })
188+
// ),
189+
// }),
190+
//});
191+
161192
const days = defineCollection({
162-
type: "data",
193+
loader: async (): Promise<any[]> => {
194+
const rawSchedule = await loadData(import.meta.env.EP_SCHEDULE_API);
195+
const schedule = rawSchedule.default ?? rawSchedule;
196+
197+
return Object.entries(schedule.days).map(([date, data]: [string, any]) => ({
198+
id: date,
199+
...data,
200+
}));
201+
},
163202
schema: z.object({
164-
rooms: z.array(z.string()),
203+
id: z.string(), // the date, like "2024-07-08"
204+
rooms: z.array(z.string()).optional(),
165205
events: z.array(
166206
z.object({
167-
rooms: z.array(z.string()),
168-
event_type: z.string(),
169207
code: z.string().optional(),
170-
title: z.string(),
208+
duration: z.number(),
209+
event_type: z.string(),
210+
level: z.string().optional().nullable(),
211+
rooms: z.array(z.string()),
212+
session_type: z.string().optional(),
171213
slug: z.string().optional(),
172-
session_type: z.string().optional(), // why?
173214
speakers: z
174215
.array(
175216
z.object({
@@ -179,11 +220,11 @@ const days = defineCollection({
179220
})
180221
)
181222
.optional(),
182-
tweet: z.string().optional().nullable(),
183-
level: z.string().optional().nullable(),
184223
start: z.string(),
224+
title: z.string(),
225+
track: z.string().optional().nullable(),
226+
tweet: z.string().optional().nullable(),
185227
website_url: z.string().optional().nullable(),
186-
duration: z.number(),
187228
})
188229
),
189230
}),

src/layouts/Layout.astro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ const { title, description } = Astro.props;
1515
<html lang="en">
1616
<head>
1717
<BaseHead title={title} description={description} />
18+
<link rel="preconnect" href="https://fonts.googleapis.com">
19+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
20+
21+
<link href="https://fonts.googleapis.com/css2?family=Red+Hat+Display:ital,wght@0,300..900;1,300..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Sofia+Sans+Condensed:ital,wght@0,1..1000;1,1..1000&display=swap" rel="stylesheet">
22+
23+
<link href="https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,100..900;1,100..900&family=Red+Hat+Display:ital,wght@0,300..900;1,300..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Sofia+Sans+Condensed:ital,wght@0,1..1000;1,1..1000&display=swap" rel="stylesheet">
24+
1825
</head>
1926

2027
<div class="flex flex-col items-stretch min-h-screen">

src/layouts/ScheduleLayout.astro

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
import Header from "../components/header/header.astro";
3+
import Footer from "../components/footer.astro";
4+
import BaseHead from "../components/BaseHead.astro";
5+
6+
export interface Props {
7+
title: string;
8+
description: string;
9+
}
10+
11+
const { title, description } = Astro.props;
12+
---
13+
14+
<!doctype html>
15+
<html lang="en">
16+
<head>
17+
<BaseHead title={title} description={description} />
18+
</head>
19+
20+
<div class="flex flex-col items-stretch min-h-screen">
21+
<a href="#main-content" class="sr-only"> Skip to main content</a>
22+
23+
<Header />
24+
25+
<main id="main-content" class="layout-wrapper2 overflow-x-clip">
26+
<slot />
27+
</main>
28+
29+
<div class="mt-auto">
30+
<Footer />
31+
</div>
32+
</div>
33+
</html>
34+
35+
<style>
36+
.layout-wrapper2 {
37+
max-width: 800px;
38+
margin:auto;
39+
display: grid;
40+
grid-template-columns: 1fr (770px, 100%) 1fr !important;
41+
}
42+
43+
.layout-wrapper2 > * {
44+
grid-column: 2;
45+
}
46+
47+
</style>

src/pages/schedule.astro

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
import { getCollection } from "astro:content";
3+
4+
const days = await getCollection("days");
5+
6+
const availableDays = days.map((day) => new Date(day.id));
7+
---
8+
9+
<script type="module" define:vars={{ availableDays }}>
10+
// Return timestamp of date without time
11+
function normalizeDate(date) {
12+
date = new Date(date);
13+
return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
14+
}
15+
16+
const currentDate = normalizeDate(new Date());
17+
18+
let closestDate = availableDays[0];
19+
let minDiff = Math.abs(normalizeDate(closestDate) - currentDate);
20+
21+
for (let i = 1; i < availableDays.length; i++) {
22+
const normalizedDate = normalizeDate(availableDays[i]);
23+
const diff = Math.abs(normalizedDate - currentDate);
24+
25+
if (diff < minDiff) {
26+
closestDate = availableDays[i];
27+
minDiff = diff;
28+
}
29+
}
30+
31+
const redirectUrl = `/schedule/${new Date(closestDate).toISOString().slice(0, 10)}`;
32+
window.location.href = redirectUrl;
33+
</script>
34+
35+
<noscript>
36+
<!-- Fallback for users with JavaScript disabled, what a shame :D -->
37+
<meta http-equiv="refresh" content="0;url=/schedule/2024-07-08">
38+
</noscript>

0 commit comments

Comments
 (0)