Skip to content

Commit 943c17d

Browse files
committed
Refactor: Update sidebars to display upcoming events
This commit refactors the workshop and student talk sidebars to display upcoming events. The hacking hours sidebar has also been updated with minor formatting changes. The old upcoming events component was removed.
1 parent 4e37cdb commit 943c17d

File tree

4 files changed

+127
-100
lines changed

4 files changed

+127
-100
lines changed

layouts/partials/components/upcoming-events.html

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 51 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,64 @@
1-
<div class="pb-4 text-center">~ Share this Site ~
2-
{{ partial "override-social-share" (dict "Context" . "Class" "share-icons" "Whatsapp" true "Telegram" false) }}
1+
<div class="pb-4">
2+
{{ partial "components/og-preview.html" . }}
33
</div>
44
<div class="px-7 pt-7 content-panel">
5-
<h3 class="pb-5 text-xl">Next Hacking Hour</h3>
5+
<h3 class="pb-5 pt-5 text-xl">Next Hacking Hour</h3>
66
{{ $recurringEventData := site.Data.recurring_events.events }}
77
{{ $hackingHourEvent := "" }}
88
{{ range $recurringEventData }}
9-
{{ if and (eq .id "hacking-hours") .active }}
10-
{{ $hackingHourEvent = . }}
11-
{{ end }}
9+
{{ if and (eq .id "hacking-hours") .active }}
10+
{{ $hackingHourEvent = . }}
11+
{{ end }}
1212
{{ end }}
1313

1414
{{ if $hackingHourEvent }}
15-
{{ $now := now }}
16-
{{ $daysMap := dict "Sunday" 0 "Monday" 1 "Tuesday" 2 "Wednesday" 3 "Thursday" 4 "Friday" 5 "Saturday" 6 }}
17-
18-
{{/* Ensure day_of_week is valid, default to Monday if not found in map to prevent sub error */}}
19-
{{ $targetDayKey := $hackingHourEvent.day_of_week | default "Monday" }}
20-
{{ $targetDayIndex := index $daysMap $targetDayKey }}
21-
{{ if eq $targetDayIndex nil }}{{ $targetDayIndex = 1 }}{{ warnf "Invalid day_of_week '%s' in recurring_events.toml for Hacking Hours. Defaulting to Monday." $hackingHourEvent.day_of_week }}{{ end }}
22-
23-
{{ $currentDayIndex := int $now.Weekday }}
24-
25-
{{ $daysToAdd := sub (int $targetDayIndex) (int $currentDayIndex) }}
26-
27-
{{ if lt $daysToAdd 0 }}
28-
{{ $daysToAdd = add $daysToAdd 7 }}
29-
{{ else if eq $daysToAdd 0 }}
30-
{{ $eventStartHour := int (substr $hackingHourEvent.start_time 0 2) }}
31-
{{ $eventStartMinute := int (substr $hackingHourEvent.start_time 3 2) }}
32-
{{ $nowHour := $now.Hour }}
33-
{{ $nowMinute := $now.Minute }}
34-
35-
{{ if or (gt $nowHour $eventStartHour) (and (eq $nowHour $eventStartHour) (ge $nowMinute $eventStartMinute)) }}
36-
{{ $daysToAdd = 7 }}
37-
{{ end }}
38-
{{ end }}
39-
40-
{{ $nextOccurrenceDate := $now.AddDate 0 0 (int $daysToAdd) }}
41-
42-
<div class="mb-4 pb-6">
43-
<div>
44-
<h4 class="font-semibold text-lg">{{ $hackingHourEvent.title }}</h4>
45-
{{ if $hackingHourEvent.host }}
46-
<p class="text-sm text-gray-600 dark:text-gray-400">
47-
Hosted by: {{ $hackingHourEvent.host }}
48-
</p>
15+
{{ $now := now }}
16+
{{ $daysMap := dict "Sunday" 0 "Monday" 1 "Tuesday" 2 "Wednesday" 3 "Thursday" 4 "Friday" 5 "Saturday" 6 }}
17+
{{ $targetDayKey := $hackingHourEvent.day_of_week | default "Monday" }}
18+
{{ $targetDayIndex := index $daysMap $targetDayKey | default 1 }}
19+
{{ $currentDayIndex := int $now.Weekday }}
20+
{{ $daysToAdd := sub $targetDayIndex $currentDayIndex }}
21+
{{ if lt $daysToAdd 0 }}{{ $daysToAdd = add $daysToAdd 7 }}{{ end }}
22+
{{ if eq $daysToAdd 0 }}
23+
{{ $eventStartHour := int (substr $hackingHourEvent.start_time 0 2) }}
24+
{{ $eventStartMinute := int (substr $hackingHourEvent.start_time 3 2) }}
25+
{{ $nowHour := $now.Hour }}
26+
{{ $nowMinute := $now.Minute }}
27+
{{ if or (gt $nowHour $eventStartHour) (and (eq $nowHour $eventStartHour) (ge $nowMinute $eventStartMinute)) }}
28+
{{ $daysToAdd = 7 }}
4929
{{ end }}
50-
<p class="text-sm mt-1 flex items-center">
51-
{{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}Next: {{ $nextOccurrenceDate.Format "Mon, Jan 2, 2006" }}
52-
</p>
53-
<p class="text-sm flex items-center">
54-
{{ partial "icon.html" (dict "style" "regular" "name" "clock" "class" "mr-2") }}{{ $hackingHourEvent.start_time }} - {{ $hackingHourEvent.end_time }} {{ $hackingHourEvent.time_zone }}
55-
</p>
56-
<p class="text-sm mt-2">
57-
{{ $hackingHourEvent.description }}
58-
</p>
59-
<p class="mt-3">
60-
<a href="{{ $hackingHourEvent.location_url }}" target="_blank" class="btn btn-sm btn-new-primary">Join on Discord</a>
61-
</p>
30+
{{ end }}
31+
{{ $nextOccurrenceDate := $now.AddDate 0 0 (int $daysToAdd) }}
32+
33+
<div class="mb-4 pb-6">
34+
<div>
35+
<h4 class="font-semibold text-lg">{{ $hackingHourEvent.title }}</h4>
36+
{{ if $hackingHourEvent.host }}
37+
<p class="text-sm text-gray-600 dark:text-gray-400">
38+
Hosted by: {{ $hackingHourEvent.host }}
39+
</p>
40+
{{ end }}
41+
<p class="text-sm mt-1 flex items-center">
42+
{{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}Next: {{ $nextOccurrenceDate.Format "Mon, Jan 2, 2006" }}
43+
</p>
44+
<p class="text-sm flex items-center">
45+
{{ partial "icon.html" (dict "style" "regular" "name" "clock" "class" "mr-2") }}{{ $hackingHourEvent.start_time }} - {{ $hackingHourEvent.end_time }} {{ $hackingHourEvent.time_zone }}
46+
</p>
47+
<div class="text-sm mt-2">
48+
{{ $hackingHourEvent.description | markdownify }}
49+
</div>
50+
</div>
6251
</div>
63-
</div>
6452
{{ else }}
65-
<p>No active Hacking Hours scheduled in `data/recurring_events.toml`.</p>
53+
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">
54+
Hacking Hours are currently on a break. Check back soon for the new schedule!
55+
</p>
56+
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">
57+
In the meantime, join our Discord to connect with the community and see what others are working on.
58+
</p>
6659
{{ end }}
60+
61+
<div class="text-right pb-5 pt-5">
62+
<a href="{{ $hackingHourEvent.location_url | default "https://discord.gg/C9bzWgNmqk" }}" target="_blank" class="btn btn-new-primary btn-sm">Join on Discord</a>
63+
</div>
6764
</div>
Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
1-
<div class="pb-4 text-center">~ Share this Site ~
2-
{{ partial "override-social-share" (dict "Context" . "Class" "share-icons" "Whatsapp" true "Telegram" false) }}
1+
<div class="pb-4">
2+
{{ partial "components/og-preview.html" . }}
33
</div>
44
<div class="px-7 pt-7 content-panel">
5-
<div class="text-right pb-5">
6-
<a href="/getting-involved/host-an-event" class="btn btn-new-primary btn-sm">Present your work</a>
5+
<h3 class="pb-5 pt-5 text-xl">Upcoming Student Talks</h3>
6+
7+
{{ $upcoming_talks := where (where .Site.RegularPages "Type" "student-talks") ".Params.upcoming" true }}
8+
9+
{{ if gt (len $upcoming_talks) 0 }}
10+
{{ range sort $upcoming_talks ".Date" }}
11+
<div class="mb-4">
12+
<a href="{{ .Permalink }}" class="block font-semibold hover:text-primary dark:hover:text-darkmode-primary">{{ .Title }}</a>
13+
<div class="text-sm text-gray-600 dark:text-gray-400 mt-1">
14+
{{ if .Params.author }}
15+
<div class="flex items-center">
16+
{{ partial "icon.html" (dict "style" "regular" "name" "circle-user" "class" "mr-2") }}
17+
<span>{{ delimit .Params.author ", " }}</span>
18+
</div>
19+
{{ end }}
20+
<div class="flex items-center mt-1">
21+
{{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}
22+
<span>{{ dateFormat "Jan 2, 2006" .Date }}</span>
23+
</div>
24+
<div class="flex items-center mt-1">
25+
{{ partial "icon.html" (dict "style" "regular" "name" "clock" "class" "mr-2") }}
26+
<span>{{ .Params.start_time }} - {{ .Params.end_time}} {{ .Params.time_zone }}</span>
27+
</div>
28+
</div>
29+
</div>
30+
{{ end }}
31+
{{ else }}
32+
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">
33+
There are no student talks scheduled at the moment.
34+
</p>
35+
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">
36+
If you are a student or early-career researcher, this is a great platform to present your work, share your findings, and get valuable feedback from the community.
37+
</p>
38+
{{ end }}
39+
40+
<div class="text-right pb-5 pt-5">
41+
<a href="/getting-involved/host-an-event" class="btn btn-new-primary btn-sm">Present Your Work</a>
742
</div>
843
</div>
Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,43 @@
1-
<div class="pb-4 text-center">~ Share this Site ~
2-
{{ partial "override-social-share" (dict "Context" . "Class" "share-icons" "Whatsapp" true "Telegram" false) }}
1+
<div class="pb-4">
2+
{{ partial "components/og-preview.html" . }}
33
</div>
44
<div class="px-7 pt-7 content-panel">
55
<h3 class="pb-5 pt-5 text-xl">Upcoming Workshops</h3>
6-
{{ partial "components/upcoming-events" . }}
6+
7+
{{ $upcoming_workshops := where (where .Site.RegularPages "Section" "workshops") ".Params.upcoming" true }}
8+
9+
{{ if gt (len $upcoming_workshops) 0 }}
10+
{{ range sort $upcoming_workshops ".Date" }}
11+
<div class="mb-4">
12+
<a href="{{ .Permalink }}" class="block font-semibold hover:text-primary dark:hover:text-darkmode-primary">{{ .Title }}</a>
13+
<div class="text-sm text-gray-600 dark:text-gray-400 mt-1">
14+
{{ if .Params.author }}
15+
<div class="flex items-center">
16+
{{ partial "icon.html" (dict "style" "regular" "name" "circle-user" "class" "mr-2") }}
17+
<span>{{ delimit .Params.author ", " }}</span>
18+
</div>
19+
{{ end }}
20+
<div class="flex items-center mt-1">
21+
{{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}
22+
<span>{{ dateFormat "Jan 2, 2006" .Date }}</span>
23+
</div>
24+
<div class="flex items-center mt-1">
25+
{{ partial "icon.html" (dict "style" "regular" "name" "clock" "class" "mr-2") }}
26+
<span>{{ .Params.start_time }} - {{ .Params.end_time}} {{ .Params.time_zone }}</span>
27+
</div>
28+
</div>
29+
</div>
30+
{{ end }}
31+
{{ else }}
32+
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">
33+
No workshops are currently scheduled. Check back soon for new events!
34+
</p>
35+
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">
36+
Are you an expert in a neuromorphic topic? We invite you to share your knowledge with our community. Hosting a workshop is a great way to engage with peers and share your work.
37+
</p>
38+
{{ end }}
39+
740
<div class="text-right pb-5 pt-5">
8-
<a href="/getting-involved/host-an-event" class="btn btn-new-primary btn-sm">Host a workshop</a>
41+
<a href="/getting-involved/host-an-event" class="btn btn-new-primary btn-sm">Host a Workshop</a>
942
</div>
1043
</div>

0 commit comments

Comments
 (0)