Skip to content

Commit 1106a7f

Browse files
committed
feat: event list page
Refactors event listings to use a shared layout and logic. This commit introduces a shared layout for event listings, centralizing the logic for sorting and displaying past events. It also adds a partial for getting past events. The contributor page is also refactored to use Hugo's intersect function.
1 parent 26b944d commit 1106a7f

File tree

8 files changed

+100
-111
lines changed

8 files changed

+100
-111
lines changed

assets/scss/buttons.scss

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,12 @@
5656
border-color: color-mix(in srgb, var(--color-primary-new) 85%, black);
5757
}
5858
}
59-
// No specific dark mode override for .btn-primary if var(--color-primary-new) and white text
60-
// provide sufficient contrast on dark backgrounds. If a different dark mode appearance
61-
// for this specific button is needed, it can be added like:
62-
// .dark .btn-primary {
63-
// background-color: var(--some-dark-mode-primary-variant);
64-
// color: var(--some-dark-mode-text-for-primary-button);
65-
// }
6659

6760
// Standard .btn-outline-primary (redefined to match .btn-new-outline for consistency)
6861
// Used by some components like event-card's "Learn More".
6962
.btn-outline-primary {
70-
@apply border-2 font-semibold py-3 px-6 rounded-lg transition-all duration-300 ease-in-out inline-block text-center;
71-
color: var(--color-primary-new);
72-
border-color: var(--color-primary-new);
73-
background-color: transparent;
74-
&:hover {
75-
background-color: var(--color-primary-new);
76-
@apply text-white;
77-
}
63+
@extend .btn-new-outline;
7864
}
79-
// Dark mode for .btn-outline-primary can also be specified here if needed,
80-
// similar to .btn-primary. For now, relies on var(--color-primary-new).
8165

8266
// Utility button style
8367
.btn-details-mini {

assets/scss/components/_hardware-card-wide.scss

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,15 @@
44
text-decoration: none !important;
55

66
// Apply a subtle transition to the card for transform and shadow changes.
7-
// This addresses the "gradual and subtle" hover effect.
87
@apply transition-all duration-300 ease-in-out;
98

109
// On hover, lift the card slightly and increase its shadow for a modern feel.
1110
&:hover {
1211
@apply transform shadow-lg;
1312
}
1413

15-
// Target the h3 title specifically.
14+
// Target the h3 title specifically and apply the consistent link styling.
1615
h3 {
17-
// Apply the site's default underline style.
18-
text-decoration-line: underline;
19-
text-decoration-color: #d7c7e3; // Initial underline color
20-
text-decoration-thickness: 0.115em;
21-
text-underline-offset: 2.6px;
22-
23-
// Animate ONLY the underline color for a smooth transition.
24-
transition: text-decoration-color 0.3s ease-in-out;
25-
}
26-
27-
// When the card is hovered, change the h3's underline color.
28-
&:hover h3 {
29-
text-decoration-color: #200435; // Hover underline color
30-
}
31-
}
32-
33-
// Dark mode styles for the card's hover state.
34-
.dark .hardware-card-wide-link {
35-
// On hover in dark mode...
36-
&:hover h3 {
37-
text-decoration-color: #bcfbff !important; // Dark mode hover underline color
38-
}
39-
40-
// Define the base underline color for the title in dark mode.
41-
h3 {
42-
text-decoration-color: #288b8c;
16+
@include styled-link(#d7c7e3, #200435, #288b8c, #bcfbff);
4317
}
4418
}

config/_default/menus.en.toml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,6 @@ weight = 7
7575
icon = "fas fa-chalkboard-user"
7676
description = "Expert-led workshops on key neuromorphic topics."
7777

78-
[[main]]
79-
parent = "explore-resources" # Add this new entry
80-
name = "Contributors"
81-
url = "/contributors/"
82-
weight = 8
83-
[main.params]
84-
icon = "fas fa-user-group"
85-
description = "Meet the people building the Open Neuromorphic community."
86-
87-
88-
[[main]]
89-
parent = "explore-resources" # Add this new entry
90-
name = "Contributors"
91-
url = "/contributors/"
92-
weight = 8
93-
[main.params]
94-
icon = "fas fa-user-group"
95-
description = "Meet the people building the Open Neuromorphic community."
96-
97-
9878
[[main]]
9979
parent = "explore-resources" # Add this new entry
10080
name = "Contributors"

layouts/contributors/single.html

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ <h2 class="text-3xl font-bold text-center mb-3">{{ .Title }}</h2>
3636
<h2 class="text-3xl font-semibold mb-8 text-center lg:text-left">Contributions</h2>
3737

3838
{{ $contributorName := .Title }}
39-
{{ $authoredPages := slice }}
40-
{{ range where site.RegularPages "Params.author" "!=" nil }}
41-
{{ if in .Params.author $contributorName }}
42-
{{ $authoredPages = $authoredPages | append . }}
43-
{{ end }}
44-
{{ end }}
39+
{{ $authoredPages := where site.RegularPages "Params.author" "intersect" (slice $contributorName) }}
4540

4641
{{/* Section 1: Initiatives */}}
4742
{{ $initiatives_unsorted := where $authoredPages "Type" "eq" "initiatives" }}
@@ -59,21 +54,28 @@ <h3 class="text-2xl font-semibold mb-5 border-b-2 border-primary dark:border-dar
5954
</div>
6055
{{ end }}
6156

62-
{{/* Section 2: Combined Timeline of Other Contributions */}}
63-
{{ $otherContributions := $authoredPages | complement $initiatives }}
57+
{{/* Section 2: Combined Timeline of Other Contributions - CORRECTED LOGIC */}}
58+
{{ $otherContributions := slice }}
59+
{{ range $authoredPages }}
60+
{{ if not (in $initiatives .) }}
61+
{{ $otherContributions = $otherContributions | append . }}
62+
{{ end }}
63+
{{ end }}
6464
{{ $sortedTimelineItems := sort $otherContributions "Date" "desc" }}
65-
{{ $groupedByYear := $sortedTimelineItems.GroupByDate "2006" }}
66-
{{ $sortedGroups := sort $groupedByYear ".Key" "desc" }}
6765

6866
{{ if $sortedTimelineItems }}
6967
<div class="mb-10">
7068
<h3 class="text-2xl font-semibold mb-6 {{ if $initiatives }}border-t-2 border-border dark:border-darkmode-border pt-8{{ end }}">Activity Timeline</h3>
7169
<div class="contributor-timeline">
72-
{{ range $group := $sortedGroups }}
70+
{{ $currentYear := "" }}
71+
{{ range $item := $sortedTimelineItems }}
72+
{{ $itemYear := $item.Date.Format "2006" }}
73+
{{ if ne $itemYear $currentYear }}
7374
<div class="timeline-year">
74-
<span>{{ .Key }}</span>
75+
<span>{{ $itemYear }}</span>
7576
</div>
76-
{{ range .Pages }}
77+
{{ $currentYear = $itemYear }}
78+
{{ end }}
7779
<div class="timeline-item">
7880
<div class="timeline-item-content">
7981
<div class="flex justify-between items-start gap-4">
@@ -88,16 +90,15 @@ <h4 class="text-xl font-semibold mb-1">
8890
</div>
8991
{{/* Right side: Badge */}}
9092
<span class="timeline-item-badge flex-shrink-0">
91-
{{ .Type | default .Section | humanize | title }}
92-
</span>
93+
{{ .Type | default .Section | humanize | title }}
94+
</span>
9395
</div>
9496
{{ if .Description }}
9597
<p class="text-gray-600 dark:text-gray-400 mt-3 text-sm">{{ .Description }}</p>
9698
{{ end }}
9799
</div>
98100
</div>
99101
{{ end }}
100-
{{ end }}
101102
</div>
102103
</div>
103104
{{ end }}

layouts/neuromorphic-computing/list.html

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{{ define "main" }}
22
{{ partial "page-header" . }}
33

4-
54
<section class="section pt-6 mt-0 pb-16">
65
<div class="container">
76

@@ -40,13 +39,7 @@
4039
{{/* --- New Modern Recent Events Sections --- */}}
4140
{{/* Recent Workshops Section */}}
4241
{{ $workshops_all := where site.RegularPages "Section" "workshops" }}
43-
{{ $workshops_past_valid_date := slice }}
44-
{{ range $workshops_all }}
45-
{{ if and (ne .Params.upcoming true) (.Date) (not .Date.IsZero) }}
46-
{{ $workshops_past_valid_date = $workshops_past_valid_date | append . }}
47-
{{ end }}
48-
{{ end }}
49-
{{ $workshops_sorted := sort $workshops_past_valid_date "Date" "desc" }}
42+
{{ $workshops_sorted := partial "logic/get_past_events.html" $workshops_all }}
5043
{{ partial "custom/modern-recent-events-section.html" (dict
5144
"section_title" "Workshops"
5245
"section_subtitle" "Catch up on our latest expert-led sessions and community discussions."
@@ -59,13 +52,7 @@
5952

6053
{{/* Recent Hacking Hours Section */}}
6154
{{ $hacking_hours_all := where site.RegularPages "Type" "hacking-hours" }}
62-
{{ $hacking_hours_past_valid_date := slice }}
63-
{{ range $hacking_hours_all }}
64-
{{ if and (ne .Params.upcoming true) (.Date) (not .Date.IsZero) }}
65-
{{ $hacking_hours_past_valid_date = $hacking_hours_past_valid_date | append . }}
66-
{{ end }}
67-
{{ end }}
68-
{{ $hacking_hours_sorted := sort $hacking_hours_past_valid_date "Date" "desc" }}
55+
{{ $hacking_hours_sorted := partial "logic/get_past_events.html" $hacking_hours_all }}
6956
{{ partial "custom/modern-recent-events-section.html" (dict
7057
"section_title" "Hacking Hours"
7158
"section_subtitle" "Review our latest live coding explorations into neuromorphic software and tools."
@@ -78,13 +65,7 @@
7865

7966
{{/* Recent Student Talks Section */}}
8067
{{ $student_talks_all := where site.RegularPages "Type" "student-talks" }}
81-
{{ $student_talks_past_valid_date := slice }}
82-
{{ range $student_talks_all }}
83-
{{ if and (ne .Params.upcoming true) (.Date) (not .Date.IsZero) }}
84-
{{ $student_talks_past_valid_date = $student_talks_past_valid_date | append . }}
85-
{{ end }}
86-
{{ end }}
87-
{{ $student_talks_sorted := sort $student_talks_past_valid_date "Date" "desc" }}
68+
{{ $student_talks_sorted := partial "logic/get_past_events.html" $student_talks_all }}
8869
{{ partial "custom/modern-recent-events-section.html" (dict
8970
"section_title" "Student Talks"
9071
"section_subtitle" "Insights from students and early-career researchers in neuromorphic computing."
@@ -115,4 +96,3 @@ <h3 class="section-title text-3xl font-semibold mb-3">Blog</h3>
11596
</div>
11697
</section>
11798
{{ end }}
118-

layouts/partials/custom/hacking-hours-software-promo.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
{{ $allPastHH := where site.RegularPages "Type" "hacking-hours" }}
2-
{{ $validDatePastHH := slice }}
3-
{{ range $allPastHH }}
4-
{{ if and (ne .Params.upcoming true) (.Date) (not .Date.IsZero) }}
5-
{{ $validDatePastHH = $validDatePastHH | append . }}
6-
{{ end }}
7-
{{ end }}
8-
{{ $sortedPastHH := sort $validDatePastHH "Date" "Desc" }}
2+
{{ $sortedPastHH := partial "logic/get_past_events.html" $allPastHH }}
93
{{ $mostRecentPastHH := "" }}
104
{{ if $sortedPastHH }}{{ $mostRecentPastHH = index $sortedPastHH 0 }}{{ end }}
115

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ $pages_to_filter := . }}
2+
{{ $valid_past_events := slice }}
3+
{{ range $pages_to_filter }}
4+
{{ if and (ne .Params.upcoming true) .Date (not .Date.IsZero) }}
5+
{{ $valid_past_events = $valid_past_events | append . }}
6+
{{ end }}
7+
{{ end }}
8+
{{ $sorted_past_events := sort $valid_past_events "Date" "desc" }}
9+
{{ return $sorted_past_events }}

layouts/shared/event-list-page.html

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{{ $page_context := .context }}
2+
{{ $sidebar_content_partial := .sidebar }}
3+
4+
{{/*
5+
Use the reusable partial to get all sorted past events.
6+
*/}}
7+
{{ $all_past_events_sorted := partial "logic/get_past_events.html" $page_context.RegularPages }}
8+
9+
10+
{{/* 4. Separate the most recent event to feature it. */}}
11+
{{ $featured_event := "" }}
12+
{{ if gt (len $all_past_events_sorted) 0 }}
13+
{{ $featured_event = index $all_past_events_sorted 0 }}
14+
{{ end }}
15+
16+
{{/* 5. Create a list of the remaining events for the other layouts. */}}
17+
{{ $events_after_featured := slice }}
18+
{{ if gt (len $all_past_events_sorted) 1 }}
19+
{{ $events_after_featured = after 1 $all_past_events_sorted }}
20+
{{ end }}
21+
22+
{{ $wide_card_events := first 4 $events_after_featured }}
23+
{{ $grid_card_events := after 4 $events_after_featured }}
24+
25+
{{ partial "page-header" $page_context }}
26+
27+
<section class="section pt-6">
28+
<div class="container">
29+
<div class="row">
30+
{{ with $featured_event }}
31+
<div class="lg:col-8 md:col-12 mb-8">
32+
{{ partial "components/event-card.html" (dict "Context" . "variant" "featured") }}
33+
</div>
34+
{{ else }}
35+
<div class="lg:col-8 md:col-12 mb-8">
36+
<p class="p-4 bg-gray-100 dark:bg-gray-700 rounded">No past events to display.</p>
37+
</div>
38+
{{ end }}
39+
<div class="lg:col-4 md:col-12 mb-14">
40+
{{ partial $sidebar_content_partial $page_context }}
41+
</div>
42+
</div>
43+
<div class="row">
44+
{{ range $wide_card_events }}
45+
<div class="col-12 mb-14">
46+
{{ partial "components/event-card.html" (dict "Context" . "variant" "wide") }}
47+
</div>
48+
{{ end }}
49+
50+
{{ range $grid_card_events }}
51+
<div class="lg:col-4 mb-14">
52+
{{ partial "components/event-card.html" (dict "Context" . "variant" "grid") }}
53+
</div>
54+
{{ end }}
55+
</div>
56+
57+
<div class="mt-8">
58+
{{ partial "components/content-contribute-cta.html" (dict
59+
"icon" "solid chalkboard-user"
60+
"title" "Inspired? <span class=\"gradient-text\">Host an event.</span>"
61+
"description" "Share your expertise with the community by hosting a workshop, student talk, or hacking hour. It's a great way to get feedback and help others learn."
62+
"link" "/getting-involved/share-your-work/"
63+
"link_text" "Learn How to Host"
64+
) }}
65+
</div>
66+
</div>
67+
</section>

0 commit comments

Comments
 (0)