diff --git a/src/templates/mapping.go b/src/templates/mapping.go index 7dc9c7f3..69140b16 100644 --- a/src/templates/mapping.go +++ b/src/templates/mapping.go @@ -12,6 +12,7 @@ import ( "git.handmade.network/hmn/hmn/src/hmnurl" "git.handmade.network/hmn/hmn/src/links" "git.handmade.network/hmn/hmn/src/models" + "git.handmade.network/hmn/hmn/src/utils" ) func PostToTemplate(p *models.Post, author *models.User) Post { @@ -494,6 +495,17 @@ func CalendarEventToTemplate(ev *calendar.CalendarEvent) CalendarEvent { } } +func JamToBannerEvent(jam hmndata.Jam) BannerEvent { + return BannerEvent{ + Slug: jam.Slug, + DaysUntilStart: utils.DaysUntil(jam.StartTime), + DaysUntilEnd: utils.DaysUntil(jam.EndTime), + StartTimeUnix: jam.StartTime.Unix(), + EndTimeUnix: jam.EndTime.Unix(), + Url: hmnurl.BuildJamIndexAny(jam.UrlSlug), + } +} + func maybeString(s *string) string { if s == nil { return "" diff --git a/src/templates/src/include/header-2024.html b/src/templates/src/include/header-2024.html index a92ab908..d94fb2cc 100644 --- a/src/templates/src/include/header-2024.html +++ b/src/templates/src/include/header-2024.html @@ -56,6 +56,32 @@ {{ end }} +{{ if and .Header.BannerEvent (not .Header.SuppressBanners) }} + {{ with .Header.BannerEvent }} + {{ if eq .Slug "VJ2024" }} + + Visibility Jam. + July 19-21, 2024. + {{ if gt .DaysUntilEnd 0 }} + {{ if eq .DaysUntilStart 0 }} + Happening now. + {{ else if eq .DaysUntilStart 1 }} + Starting tomorrow. + {{ else }} + In {{ .DaysUntilStart }} days. + {{ end }} + {{ else }} + See the results. + {{ end }} + + {{ end }} + {{ end }} +{{ end }} +