|
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" . }} |
3 | 3 | </div>
|
4 | 4 | <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> |
6 | 6 | {{ $recurringEventData := site.Data.recurring_events.events }}
|
7 | 7 | {{ $hackingHourEvent := "" }}
|
8 | 8 | {{ 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 }} |
12 | 12 | {{ end }}
|
13 | 13 |
|
14 | 14 | {{ 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 }} |
49 | 29 | {{ 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> |
62 | 51 | </div>
|
63 |
| - </div> |
64 | 52 | {{ 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> |
66 | 59 | {{ 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> |
67 | 64 | </div>
|
0 commit comments