From cad1c397c122f104ec68051bcf2f1662fabceb72 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Thu, 23 Sep 2021 16:13:12 -0500 Subject: [PATCH] Fix paste issue in editor, tweak jam page --- src/templates/src/editor.html | 5 +++-- src/templates/src/wheeljam_index.html | 13 +++++++++++-- src/website/jam.go | 21 ++++++++++++++++----- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/templates/src/editor.html b/src/templates/src/editor.html index b719d497..6bf59370 100644 --- a/src/templates/src/editor.html +++ b/src/templates/src/editor.html @@ -270,8 +270,9 @@ }); textField.addEventListener("paste", function(ev) { - if (ev.clipboardData && ev.clipboardData.files) { - importUserFiles(ev.clipboardData.files) + const files = ev.clipboardData?.files ?? []; + if (files.length > 0) { + importUserFiles(files) } }); diff --git a/src/templates/src/wheeljam_index.html b/src/templates/src/wheeljam_index.html index 9790d230..22c8e02d 100644 --- a/src/templates/src/wheeljam_index.html +++ b/src/templates/src/wheeljam_index.html @@ -228,9 +228,18 @@

September 27 - October 3

A one-week jam to bring a fresh perspective to old ideas. + + {{ if gt .DaysUntil 1 }} + Starting in {{ .DaysUntil }} days. + {{ else if eq .DaysUntil 1 }} + Starting tomorrow. + {{ else }} + Happening right now. + {{ end }} +
- Countdown + Register Join the Discord
@@ -301,7 +310,7 @@ Your submission post is required to have multiple screenshots of your software in action, and ideally should include a demo video. It doesn’t need to be fancy, but people should be able to see it without needing to run the actual program.

- We recommend ShareX for recording desktop video on Windows; on Mac, just press ⌘-Option-5 and record a video, or use QuickTime. + We recommend ShareX for recording desktop video on Windows. On Mac, just press ⌘-Option-5 and record a video, or use QuickTime.

  • Publishing your source code, or builds, is encouraged but not required.
  • diff --git a/src/website/jam.go b/src/website/jam.go index 6a715c55..ba18824c 100644 --- a/src/website/jam.go +++ b/src/website/jam.go @@ -1,6 +1,8 @@ package website import ( + "time" + "git.handmade.network/hmn/hmn/src/hmnurl" "git.handmade.network/hmn/hmn/src/templates" ) @@ -8,10 +10,11 @@ import ( func JamIndex(c *RequestContext) ResponseData { var res ResponseData - /* - ogimagepath = '%swheeljam/opengraph.png' % (settings.STATIC_URL) - ogimageurl = urljoin(current_site_host(), ogimagepath) - */ + jamStartTime := time.Date(2021, 9, 27, 0, 0, 0, 0, time.UTC) + daysUntil := jamStartTime.YearDay() - time.Now().UTC().YearDay() + if daysUntil < 0 { + daysUntil = 0 + } baseData := getBaseDataAutocrumb(c, "Wheel Reinvention Jam") baseData.OpenGraphItems = []templates.OpenGraphItem{ @@ -22,6 +25,14 @@ func JamIndex(c *RequestContext) ResponseData { {Property: "og:url", Value: hmnurl.BuildJamIndex()}, } - res.MustWriteTemplate("wheeljam_index.html", baseData, c.Perf) + type JamPageData struct { + templates.BaseData + DaysUntil int + } + + res.MustWriteTemplate("wheeljam_index.html", JamPageData{ + BaseData: baseData, + DaysUntil: daysUntil, + }, c.Perf) return res }