Show HMS banner

This commit is contained in:
Ben Visness 2022-10-17 20:13:58 -05:00
parent b5dac2f4d8
commit 968e859dde
3 changed files with 41 additions and 16 deletions

View File

@ -11,25 +11,37 @@ import (
"git.handmade.network/hmn/hmn/src/utils"
)
type Event struct {
StartTime, EndTime time.Time
}
type Jam struct {
Name string
Slug string
StartTime time.Time
EndTime time.Time
Event
Name string
Slug string
}
var WRJ2021 = Jam{
Name: "Wheel Reinvention Jam 2021",
Slug: "WRJ2021",
StartTime: time.Date(2021, 9, 27, 0, 0, 0, 0, time.UTC),
EndTime: time.Date(2021, 10, 4, 0, 0, 0, 0, time.UTC),
Event: Event{
StartTime: time.Date(2021, 9, 27, 0, 0, 0, 0, time.UTC),
EndTime: time.Date(2021, 10, 4, 0, 0, 0, 0, time.UTC),
},
Name: "Wheel Reinvention Jam 2021",
Slug: "WRJ2021",
}
var WRJ2022 = Jam{
Name: "Wheel Reinvention Jam 2022",
Slug: "WRJ2022",
StartTime: time.Date(2022, 8, 15, 0, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))),
EndTime: time.Date(2022, 8, 22, 8, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))),
Event: Event{
StartTime: time.Date(2022, 8, 15, 0, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))),
EndTime: time.Date(2022, 8, 22, 8, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))),
},
Name: "Wheel Reinvention Jam 2022",
Slug: "WRJ2022",
}
var HMS2022 = Event{
StartTime: time.Date(2022, 11, 16, 0, 0, 0, 0, time.UTC),
EndTime: time.Date(2022, 11, 18, 0, 0, 0, 0, time.UTC),
}
var AllJams = []Jam{WRJ2021, WRJ2022}

View File

@ -5,7 +5,6 @@
{{ end }}
{{ define "content" }}
{{/*
<div class="mb3 ph3 ph0-ns">
<style>
#hms-banner {
@ -91,17 +90,25 @@
<a id="hms-banner" class="pv3 ph3 ph4-l br3 flex flex-column flex-row-ns items-center" href="https://handmade-seattle.com/" target="_blank">
<div id="hms-title-container" class="flex flex-column pl3-m pl4-l pv3 pv0-ns z-1">
<h3 id="hms-title">Handmade Seattle</h3>
<div id="hms-details">November 11 - 12. In person and online.</div>
<div id="hms-details">November 16 - 18. In person and online.</div>
</div>
<div class="flex-grow-1"></div>
<div id="hms-learn-more" class="z-1">
Catch up
{{ if gt .HMSDaysUntilEnd 0 }}
{{ if eq .HMSDaysUntilStart 0 }}
Watch live
{{ else }}
Get tickets
{{ end }}
{{ else }}
Catch up
{{ end }}
<div class="dib svgicon">{{ svg "chevron-right" }}</div>
</div>
</a>
</div>
*/}}
{{/*
<div class="mb3 ph3 ph0-ns">
<style>
#jam-banner {
@ -168,6 +175,7 @@
</div>
</a>
</div>
*/}}
{{ if not .User }}
<div class="mb3 ph3 ph0-ns">

View File

@ -31,6 +31,8 @@ type LandingTemplateData struct {
JamUrl string
JamDaysUntilStart, JamDaysUntilEnd int
HMSDaysUntilStart, HMSDaysUntilEnd int
}
func Index(c *RequestContext) ResponseData {
@ -153,6 +155,9 @@ func Index(c *RequestContext) ResponseData {
JamUrl: hmnurl.BuildJamIndex(),
JamDaysUntilStart: daysUntil(hmndata.WRJ2022.StartTime),
JamDaysUntilEnd: daysUntil(hmndata.WRJ2022.EndTime),
HMSDaysUntilStart: daysUntil(hmndata.HMS2022.StartTime),
HMSDaysUntilEnd: daysUntil(hmndata.HMS2022.EndTime),
}, c.Perf)
if err != nil {
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to render landing page template"))