From 526a588a193421dcab5adf72aba1e8f7ab1f5f6f Mon Sep 17 00:00:00 2001 From: Jake Mason Date: Sat, 4 Mar 2023 23:52:03 -0500 Subject: [PATCH] Visualization Jam 2023 template --- public/visualjam2023/logo.svg | 22 + src/hmndata/jams.go | 9 + src/hmnurl/urls.go | 7 + .../layouts/visualization_jam_2023_base.html | 356 ++++++++++++++ src/templates/src/visualization_jam_2023.html | 446 ++++++++++++++++++ src/website/routes.go | 1 + src/website/visualization-jam.go | 118 +++++ 7 files changed, 959 insertions(+) create mode 100644 public/visualjam2023/logo.svg create mode 100644 src/templates/src/layouts/visualization_jam_2023_base.html create mode 100644 src/templates/src/visualization_jam_2023.html create mode 100644 src/website/visualization-jam.go diff --git a/public/visualjam2023/logo.svg b/public/visualjam2023/logo.svg new file mode 100644 index 0000000..740e1a5 --- /dev/null +++ b/public/visualjam2023/logo.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/hmndata/jams.go b/src/hmndata/jams.go index c8a717b..63d12bc 100644 --- a/src/hmndata/jams.go +++ b/src/hmndata/jams.go @@ -39,6 +39,15 @@ var WRJ2022 = Jam{ Slug: "WRJ2022", } +var VJ2023 = Jam{ + Event: Event{ + StartTime: time.Date(2023, 4, 14, 0, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))), + EndTime: time.Date(2023, 4, 16, 8, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))), + }, + Name: "Visualization Jam 2023", + Slug: "VJ2023", +} + var HMS2022 = Event{ StartTime: time.Date(2022, 11, 16, 0, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))), EndTime: time.Date(2022, 11, 18, 0, 0, 0, 0, utils.Must1(time.LoadLocation("America/Los_Angeles"))), diff --git a/src/hmnurl/urls.go b/src/hmnurl/urls.go index 416053d..c8a550e 100644 --- a/src/hmnurl/urls.go +++ b/src/hmnurl/urls.go @@ -70,6 +70,13 @@ func BuildJamIndex2022() string { return Url("/jam/2022", nil) } +var RegexVisualizationJamIndex2023 = regexp.MustCompile("^/visualization-jam/2023$") + +func BuildVisualizationJamIndex2023() string { + defer CatchPanic() + return Url("/visualization-jam/2023", nil) +} + var RegexJamFeed2022 = regexp.MustCompile("^/jam/2022/feed$") func BuildJamFeed2022() string { diff --git a/src/templates/src/layouts/visualization_jam_2023_base.html b/src/templates/src/layouts/visualization_jam_2023_base.html new file mode 100644 index 0000000..1ebf1c9 --- /dev/null +++ b/src/templates/src/layouts/visualization_jam_2023_base.html @@ -0,0 +1,356 @@ +{{/* + This is a copy-paste from base.html because we want to preserve the unique + style of this page no matter what future changes we make to the base. +*/}} + + + + + + + + + + {{ if .CanonicalLink }}{{ end }} + {{ range .OpenGraphItems }} + {{ if .Property }} + + {{ else }} + + {{ end }} + {{ end }} + {{ if .Title }} + {{ .Title }} | Handmade Network + {{ else }} + Handmade Network + {{ end }} + + + + + + + + + + + + + + + +
+
+ {{ template "header.html" . }} +
+ + {{ block "content" . }}{{ end }} + +
+ {{ template "footer.html" . }} +
+
+ + + diff --git a/src/templates/src/visualization_jam_2023.html b/src/templates/src/visualization_jam_2023.html new file mode 100644 index 0000000..418e87a --- /dev/null +++ b/src/templates/src/visualization_jam_2023.html @@ -0,0 +1,446 @@ +{{ template "visualization_jam_2023_base.html" . }} {{ define "content" }} {{ +$discordInviteURL := "https://discord.gg/hmn" }} + + + +
+ +

Visualization Jam

+

April 14 - 16, 2O23

+
+ A one-week jam to change the status quo. {{ if gt .DaysUntilEnd 0 }} {{ if + eq .DaysUntilStart 0 }} + Happening now. + {{ else if eq .DaysUntilStart 1 }} + Starting tomorrow. + {{ else }} + In {{ .DaysUntilStart }} days. + {{ end }} {{ end }} +
+
+ {{ if gt .DaysUntilStart 0 }} + Find a project + {{ else if gt .DaysUntilEnd 0 }} {{ if .SubmittedProjectUrl }} + Share your progress + {{ else }} + Create your project + {{ end }} {{ else }} + See the results + {{ end }} + Join the Discord +
+
+ +
+

+ TODO: Needs copy -- guessing we'll use some of the images that Ben has + marked as TODO TODO TODO in the copy doc. +

+
+ +{{ if eq .DaysUntilEnd 0 }} +
+
+

Submitted projects

+
+ {{ range .JamProjects }} {{ template "project_card.html" projectcarddata . + "" }} {{ end }} +
+ +
+
+{{ else if and (eq .DaysUntilStart 0) (not (eq .ShowcaseJson "[]")) }} +
+
+ {{ if gt .DaysUntilEnd 0 }} +

Recent updates

+

+ These screenshots and videos were shared by jam participants in + #project-showcase on our + Discord. Join us and + share what you're working on! + See all ➜ +

+ {{ else }} +

Community showcase

+

+ These screenshots and videos were shared by jam participants in + #project-showcase on our + Discord during the + jam. Join us and chat about your favorites! +

+ {{ end }} +
+
+ See all +
+
+
+ +{{ template "showcase_templates.html" }} + + +{{ end }} + +
+
+

How to participate

+

+ The jam takes place from Friday, April 14 through Sunday, April 16. Here's + how you can participate: +

+ +
+

Pick a project and form a team.

+

+ Pick something to visualize! Maybe it’s some weird data structure you + want to debug. Maybe it’s a map of your codebase. Maybe it’s your sleep + schedule. Whatever it is, make a Handmade Network project for it +

+
+ +
+

Jam.

+

+ {{ if and (eq .DaysUntilStart 0) (not .SubmittedProjectUrl) }} + Create a Handmade Network project + {{ else }} After the jam starts, create a Handmade Network project {{ + end }} to track your work. Then, build your program! Share your work in + progress in #project-showcase on Discord, or directly from your project + page. Chat with other jammers in #jam too. +

+
+ +
+

Submit your work!

+

+ Your Handmade Network project is your submission. Fill out the + project description, making sure to explain the goals of the project and + how it improves on what came before. Also consider posting an update + with video of your program in action! +

+ {{ if and (eq .DaysUntilStart 0) (gt .DaysUntilEnd 0) }} +

+ Submissions close + . +

+ {{ else if eq .DaysUntilEnd 0 }} +

+ Submissions are now closed. +

+ {{ end }} +
+
+
+ +
+
+

Rules

+
    +
  • + Any tech is allowed, but we encourage you to use only use what you + really need. If you want some lightweight templates to get you started, + check out our + app templates. +
  • +
  • + You may work solo or in a team. (But we encourage you to work with a + team!) +
  • +
  • Submit your work by the end of the day on April 16.
  • +
+

+ There are no explicit winners, but we will be selecting a few of our + favorite projects to highlight in a recap stream following the jam. +

+ +

Submission rules

+

+ {{ with .SubmittedProjectUrl }} + Your Handmade Network project + {{ else }} Your Handmade Network project {{ end }} is your + submission. + We will be looking at the project's description and any extra updates you + share toward the end of the jam. +

+
    +
  • + Explain the project's goals and how it improves on what came before. + Also share some closing thoughts - did it turn out how you hoped? What + did you learn? If you continue the project, what will you do + differently? +
  • +
  • + Your description must contain multiple screenshots of your software + in action. + You should ideally also share a project update with a demo video. We + recommend Mārtiņš Možeiko's + wcap for + recording desktop video on Windows. On Mac, just press ⌘-Option-5 and + record a video, or use QuickTime. +
  • +
  • + If at all possible, please provide a way for people to either build or + download your program. +
  • +
+
+
+ +
+
+
+

Make it by hand.

+

+ The Handmade ethos and Handmade community are software development + superpowers. Don't be afraid to question your foundations and rebuild + what needs rebuilding. The community is here to help you take on those + challenges and do what others might consider impossible. +

+

+ Of course, this is a jam, so focus on what matters to your project. + There are many excellent libraries in the community that can save you + time and help you focus on your core ideas. Don't be afraid to use them. + But don't be afraid to do your own thing if they're holding you back. +

+
+
+

Don't just rebuild. Reinvent.

+

+ This is a chance to build something truly new. Learn from + previous work, but don't settle for “the same, but better”. It would be + a huge shame to spend a week building nothing more than a clone of the + same broken software we use today. +

+

+ This is where working with a team can really help. Bounce ideas off each + other, do some research, and brainstorm before the jam starts. The + software you end up building might be pretty different from your + original ideas. +

+

In the end, this is a jam. Get weird and try something different.

+
+
+
+ + + + +{{ end }} diff --git a/src/website/routes.go b/src/website/routes.go index 7231013..54f45a9 100644 --- a/src/website/routes.go +++ b/src/website/routes.go @@ -59,6 +59,7 @@ func NewWebsiteRoutes(conn *pgxpool.Pool) http.Handler { hmnOnly.GET(hmnurl.RegexJamIndex2021, JamIndex2021) hmnOnly.GET(hmnurl.RegexJamIndex2022, JamIndex2022) hmnOnly.GET(hmnurl.RegexJamFeed2022, JamFeed2022) + hmnOnly.GET(hmnurl.RegexVisualizationJamIndex2023, VisualizationIndex2023) hmnOnly.GET(hmnurl.RegexStaffRolesIndex, StaffRolesIndex) hmnOnly.GET(hmnurl.RegexStaffRole, StaffRole) diff --git a/src/website/visualization-jam.go b/src/website/visualization-jam.go new file mode 100644 index 0000000..41d59f9 --- /dev/null +++ b/src/website/visualization-jam.go @@ -0,0 +1,118 @@ +package website + +import ( + "net/http" + // "time" + + "git.handmade.network/hmn/hmn/src/hmndata" + "git.handmade.network/hmn/hmn/src/hmnurl" + "git.handmade.network/hmn/hmn/src/oops" + "git.handmade.network/hmn/hmn/src/templates" + // "git.handmade.network/hmn/hmn/src/utils" +) + +func VisualizationIndex2023(c *RequestContext) ResponseData { + var res ResponseData + + daysUntilStart := daysUntil(hmndata.VJ2023.StartTime) + daysUntilEnd := daysUntil(hmndata.VJ2023.EndTime) + + baseData := getBaseDataAutocrumb(c, hmndata.VJ2023.Name) + baseData.OpenGraphItems = []templates.OpenGraphItem{ + {Property: "og:site_name", Value: "Handmade.Network"}, + {Property: "og:type", Value: "website"}, + // TODO: + {Property: "og:image", Value: hmnurl.BuildPublic("wheeljam2022/opengraph.png", true)}, + {Property: "og:description", Value: "See things in a new way. April 14 - 16."}, + {Property: "og:url", Value: hmnurl.BuildJamIndex()}, + } + + type JamPageData struct { + templates.BaseData + DaysUntilStart, DaysUntilEnd int + StartTimeUnix, EndTimeUnix int64 + + SubmittedProjectUrl string + ProjectSubmissionUrl string + ShowcaseFeedUrl string + ShowcaseJson string + + JamProjects []templates.Project + } + + var showcaseItems []templates.TimelineItem + submittedProjectUrl := "" + + if c.CurrentUser != nil { + projects, err := hmndata.FetchProjects(c, c.Conn, c.CurrentUser, hmndata.ProjectsQuery{ + OwnerIDs: []int{c.CurrentUser.ID}, + JamSlugs: []string{hmndata.VJ2023.Slug}, + Limit: 1, + }) + if err != nil { + return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch jam projects for current user")) + } + if len(projects) > 0 { + urlContext := hmndata.UrlContextForProject(&projects[0].Project) + submittedProjectUrl = urlContext.BuildHomepage() + } + } + + jamProjects, err := hmndata.FetchProjects(c, c.Conn, c.CurrentUser, hmndata.ProjectsQuery{ + JamSlugs: []string{hmndata.VJ2023.Slug}, + }) + if err != nil { + return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch jam projects for current user")) + } + + pageProjects := make([]templates.Project, 0, len(jamProjects)) + for _, p := range jamProjects { + pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + } + + projectIds := make([]int, 0, len(jamProjects)) + for _, jp := range jamProjects { + projectIds = append(projectIds, jp.Project.ID) + } + + if len(projectIds) > 0 { + snippets, err := hmndata.FetchSnippets(c, c.Conn, c.CurrentUser, hmndata.SnippetQuery{ + ProjectIDs: projectIds, + Limit: 12, + }) + if err != nil { + return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch snippets for jam showcase")) + } + showcaseItems = make([]templates.TimelineItem, 0, len(snippets)) + for _, s := range snippets { + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + if timelineItem.CanShowcase { + showcaseItems = append(showcaseItems, timelineItem) + } + } + } + + showcaseJson := templates.TimelineItemsToJSON(showcaseItems) + + res.MustWriteTemplate("visualization_jam_2023.html", JamPageData{ + BaseData: baseData, + DaysUntilStart: daysUntilStart, + DaysUntilEnd: daysUntilEnd, + StartTimeUnix: hmndata.VJ2023.StartTime.Unix(), + EndTimeUnix: hmndata.VJ2023.EndTime.Unix(), + ProjectSubmissionUrl: hmnurl.BuildProjectNewJam(), + SubmittedProjectUrl: submittedProjectUrl, + ShowcaseFeedUrl: hmnurl.BuildJamFeed2022(), + ShowcaseJson: showcaseJson, + JamProjects: pageProjects, + }, c.Perf) + return res +} + +// func daysUntil(t time.Time) int { +// d := t.Sub(time.Now()) +// if d < 0 { +// d = 0 +// } +// return int(utils.DurationRoundUp(d, 24*time.Hour) / (24 * time.Hour)) +// }