Learning jam final design phase 1
This commit is contained in:
parent
f085858e9e
commit
ee491c7696
|
@ -0,0 +1,11 @@
|
|||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="dib c--theme-gradient-light">What is a Learning Jam?</h2>
|
||||
<div class="post-content">
|
||||
<p>
|
||||
The <b class="c--theme-gradient-light">Learning Jam</b> is a cool good time.
|
||||
</p>
|
||||
<p>
|
||||
TODO
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,41 @@
|
|||
{{ range . }}
|
||||
<div class="flex flex-column g3 bg--rich-gray pa3">
|
||||
<div class="flex flex-row g3 items-start">
|
||||
{{ if .OwnerAvatarUrl }}
|
||||
<a class="flex flex-shrink-0 br-100 square items-center justify-center overflow-hidden bg--gray" href="{{ .OwnerUrl }}">
|
||||
<img class="w2-5" src="{{ .OwnerAvatarUrl }}" />
|
||||
</a>
|
||||
{{ end }}
|
||||
<div class="flex flex-column">
|
||||
<div class="">
|
||||
<a title="{{ (index .Projects 0).Blurb }}" href="{{ (index .Projects 0).Url }}" class="link--white fw6">{{ (index .Projects 0).Name }}</a>
|
||||
by
|
||||
<a href="{{ .OwnerUrl }}" class="link--white fw6">{{ .OwnerName }}</a>
|
||||
<span class="f7 c--gray nowrap">{{ timehtml (relativedate .Date) .Date }}</span>
|
||||
</div>
|
||||
<div>{{ trim .Description }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ range .EmbedMedia }}
|
||||
<div class="flex flex-column {{ if eq .Type mediaembed }}wide-screen{{ end }} justify-stretch iframe-fill">
|
||||
{{ if eq .Type mediaimage }}
|
||||
<img src="{{ .AssetUrl }}">
|
||||
{{ else if eq .Type mediavideo }}
|
||||
{{ if .ThumbnailUrl }}
|
||||
<video src="{{ .AssetUrl }}" poster="{{ .ThumbnailUrl }}" preload="none" controls>
|
||||
{{ else }}
|
||||
<video src="{{ .AssetUrl }}" preload="metadata" controls>
|
||||
{{ end }}
|
||||
{{ else if eq .Type mediaaudio }}
|
||||
<audio src="{{ .AssetUrl }}" controls>
|
||||
{{ else if eq .Type mediaembed }}
|
||||
{{ .EmbedHTML }}
|
||||
{{ else }}
|
||||
<div class="">
|
||||
<a href="{{ .AssetUrl }}" target="_blank">💾{{ .Filename }} ({{ filesize .FileSize }})</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
|
@ -0,0 +1,100 @@
|
|||
<style>
|
||||
.lightbulb-icon {
|
||||
--mask-url: url("{{ static "learningjam2024/lightbulb.svg" }}");
|
||||
}
|
||||
.books-icon {
|
||||
--mask-url: url("{{ static "learningjam2024/books.svg" }}");
|
||||
}
|
||||
.presentation-icon {
|
||||
--mask-url: url("{{ static "learningjam2024/presentation.svg" }}");
|
||||
}
|
||||
</style>
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="dib c--theme-gradient-light">What is a Learning Jam?</h2>
|
||||
<div class="post-content">
|
||||
<p>
|
||||
The <b class="c--theme-gradient-light">Learning Jam</b> is an opportunity for you to learn something new.
|
||||
</p>
|
||||
<p>
|
||||
Unlike traditional game jams, and unlike our previous programming jams, the goal of the <b class="c--theme-gradient-light">Learning Jam</b> is <em>knowledge</em>. It's an opportunity to throw yourself at a topic and learn everything you can about it—and then, to turn around and share that knowledge with others.
|
||||
</p>
|
||||
<p>
|
||||
The jam takes place over <b>two weekends</b>. On the first weekend, you'll learn as much as you can about your topic of choice. On the second, you'll share what you learned in whatever form you like—writeup, video, Minecraft mod, whatever.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="mb3 dib c--theme-gradient-light">How to participate</h2>
|
||||
<div class="flex flex-column g2">
|
||||
<div class="pa3 flex flex-column flex-row-ns g3 items-center bg--rich-gray">
|
||||
<div class="flex-shrink-0 w4 flex justify-center items-center">
|
||||
<div class="flex svg-mask lightbulb-icon bg--theme-gradient-light" style="width: 5.2rem">
|
||||
<img class="invisible" src="{{ static "learningjam2024/lightbulb.svg" }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<h3 class="f4">Choose a topic.</h3>
|
||||
<p>
|
||||
Decide what you'll spend your weekend learning about. Maybe there's an area of programming you've been meaning to dig into, or maybe there's a specialization in your field that you've been curious about. Maybe you just need a reason to read papers for a weekend.
|
||||
</p>
|
||||
<p>
|
||||
You're welcome to work in teams or work solo.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pa3 flex flex-column flex-row-ns g3 items-center bg--rich-gray">
|
||||
<div class="flex-shrink-0 w4 flex justify-center items-center">
|
||||
<div class="flex flex-shrink-0 svg-mask books-icon bg--theme-gradient-light" style="width: 3.6rem">
|
||||
<img class="invisible" src="{{ static "learningjam2024/books.svg" }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<h3 class="f4">Mar 15-17: Learn!</h3>
|
||||
<p>
|
||||
{{ if eq .DaysUntilStart 0 }}
|
||||
<a href="{{ .NewProjectUrl }}">Create a Handmade Network project</a>
|
||||
{{ else }}
|
||||
Create a Handmade Network project
|
||||
{{ end }}
|
||||
to track your progress. Then go down the rabbit hole. Absorb as much information as you can in a weekend.
|
||||
</p>
|
||||
<p>
|
||||
As you learn, we encourage you to share updates on Discord using the <b>!til</b> command. These updates will be published as part of your submission.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pa3 flex flex-column flex-row-ns g3 items-center bg--rich-gray">
|
||||
<div class="flex-shrink-0 w4 flex justify-center items-center">
|
||||
<div class="flex flex-shrink-0 svg-mask presentation-icon bg--theme-gradient-light" style="width: 5rem">
|
||||
<img class="invisible" src="{{ static "learningjam2024/presentation.svg" }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<h3 class="f4">Mar 22-24: Share!</h3>
|
||||
<p>
|
||||
Share what you learned with the rest of the community. You can present the information in any form you like—whatever helps you communicate most effectively.
|
||||
</p>
|
||||
<p>
|
||||
Your post doesn't have to be the authoritative resource on a subject. It doesn't even have to do much "teaching" at all. The point is just to share what you learned, what surprised you, what you found interesting, and where you want to go from here.
|
||||
</p>
|
||||
<p>
|
||||
Your Handmade Network project is your final submission. Make sure the description gives adequate context, and either attach or link to your final presentation.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="dib c--theme-gradient-light">Why?</h2>
|
||||
<div class="post-content">
|
||||
<p>
|
||||
The Handmade Network's goal is to change the software industry by building back up from new foundations. But in order to do that, we need to understand those foundations.
|
||||
</p>
|
||||
<p>
|
||||
Our other programming jams are great opportunities to try building new things. But what should those new things be? We want to give the community a chance to focus just on learning and research, to gather information and share it with others, to boost the entire community's knowledge on a topic.
|
||||
</p>
|
||||
<p>
|
||||
We hope that the results of the <b class="c--theme-gradient-light">Learning Jam</b> inspire new ideas for the community to explore in the Visibility and Wheel Reinvention jams later in the year. There is so much bad software out in the world, and this is the first step toward reinventing it.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,24 @@
|
|||
{{ if .Projects }}
|
||||
<div class="flex flex-row flex-wrap g2">
|
||||
{{ range .Projects }}
|
||||
<div class="flex-basis-40-ns flex-grow-1 flex-shrink-1 bg--rich-gray pa3 flex flex-column g1">
|
||||
<div class="f3">
|
||||
<a href="{{ .Url }}" class="fw6">{{ .Name }}</a>
|
||||
</div>
|
||||
<div class="flex-grow-1">{{ .Blurb }}</div>
|
||||
<div class="f7">
|
||||
by
|
||||
{{ $owners := .Owners }}
|
||||
{{ range $idx, $owner := .Owners }}
|
||||
<a href="{{ $owner.ProfileUrl }}" class="fw6 link--white">{{ $owner.Name }}</a>{{ if not (lastidx $idx (len $owners)) }},{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if isodd (len .Projects) }}
|
||||
<div class="flex-basis-40-ns flex-grow-1 flex-shrink-1"></div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
No projects have been created yet. <a href="{{ .NewProjectUrl }}">Be the first!</a>
|
||||
{{ end }}
|
|
@ -35,79 +35,16 @@
|
|||
<div class="mw7 margin-center flex flex-column">
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="c--theme-gradient-light">Projects</h2>
|
||||
<div class="flex flex-row flex-wrap g2">
|
||||
{{ if .Projects }}
|
||||
{{ range .Projects }}
|
||||
<div class="flex-basis-40-ns flex-grow-1 flex-shrink-1 bg--rich-gray pa3 flex flex-column g1">
|
||||
<div class="f3">
|
||||
<a href="{{ .Url }}" class="fw6">{{ .Name }}</a>
|
||||
{{ template "jam_2024_lj_projects.html" .Projects }}
|
||||
</div>
|
||||
<div class="flex-grow-1">{{ .Blurb }}</div>
|
||||
<div class="f7">
|
||||
by
|
||||
{{ $owners := .Owners }}
|
||||
{{ range $idx, $owner := .Owners }}
|
||||
<a href="{{ $owner.ProfileUrl }}" class="fw6 link--white">{{ $owner.Name }}</a>{{ if not (lastidx $idx (len $owners)) }},{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if isodd (len .Projects) }}
|
||||
<div class="flex-basis-40-ns flex-grow-1 flex-shrink-1"></div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="c--theme-gradient-light">Recent activity</h2>
|
||||
<div class="flex flex-column g2">
|
||||
{{ if .TimelineItems }}
|
||||
{{ range .TimelineItems }}
|
||||
<div class="flex flex-column g3 bg--rich-gray pa3">
|
||||
<div class="flex flex-row g3 items-start">
|
||||
{{ if .OwnerAvatarUrl }}
|
||||
<a class="flex flex-shrink-0 br-100 square items-center justify-center overflow-hidden bg--gray" href="{{ .OwnerUrl }}">
|
||||
<img class="w2-5" src="{{ .OwnerAvatarUrl }}" />
|
||||
</a>
|
||||
{{ end }}
|
||||
<div class="flex flex-column">
|
||||
<div class="">
|
||||
<a title="{{ (index .Projects 0).Blurb }}" href="{{ (index .Projects 0).Url }}" class="link--white fw6">{{ (index .Projects 0).Name }}</a>
|
||||
by
|
||||
<a href="{{ .OwnerUrl }}" class="link--white fw6">{{ .OwnerName }}</a>
|
||||
<span class="f7 c--gray nowrap">{{ timehtml (relativedate .Date) .Date }}</span>
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="c--theme-gradient-light">Recent Updates</h2>
|
||||
<div class="flex flex-column g2">
|
||||
{{ template "jam_2024_lj_feeditems.html" .TimelineItems }}
|
||||
</div>
|
||||
<div>{{ trim .Description }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ range .EmbedMedia }}
|
||||
<div class="flex flex-column {{ if eq .Type mediaembed }}wide-screen{{ end }} justify-stretch iframe-fill">
|
||||
{{ if eq .Type mediaimage }}
|
||||
<img src="{{ .AssetUrl }}">
|
||||
{{ else if eq .Type mediavideo }}
|
||||
{{ if .ThumbnailUrl }}
|
||||
<video src="{{ .AssetUrl }}" poster="{{ .ThumbnailUrl }}" preload="none" controls>
|
||||
{{ else }}
|
||||
<video src="{{ .AssetUrl }}" preload="metadata" controls>
|
||||
{{ end }}
|
||||
{{ else if eq .Type mediaaudio }}
|
||||
<audio src="{{ .AssetUrl }}" controls>
|
||||
{{ else if eq .Type mediaembed }}
|
||||
{{ .EmbedHTML }}
|
||||
{{ else }}
|
||||
<div class="">
|
||||
<a href="{{ .AssetUrl }}" target="_blank">💾{{ .Filename }} ({{ filesize .FileSize }})</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
Be the first!
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="mv5 h3 fill-current link--white">
|
||||
<a href="{{ .Header.HMNHomepageUrl }}">{{ svg "hmn_circuit" }}</a>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
{{ if .SubmittedProjectUrl }}
|
||||
<a class="btn--jam" href="{{ .SubmittedProjectUrl }}">Share your progress</a>
|
||||
{{ else }}
|
||||
<a class="btn--jam" href="{{ .ProjectSubmissionUrl }}">Create your project</a>
|
||||
<a class="btn--jam" href="{{ .NewProjectUrl }}">Create your project</a>
|
||||
{{ end }}
|
||||
<a class="btn--jam" href="{{ .JamFeedUrl }}">Recent activity</a>
|
||||
{{ else }}
|
||||
|
@ -37,106 +37,62 @@
|
|||
{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<style>
|
||||
.lightbulb-icon {
|
||||
--mask-url: url("{{ static "learningjam2024/lightbulb.svg" }}");
|
||||
}
|
||||
.books-icon {
|
||||
--mask-url: url("{{ static "learningjam2024/books.svg" }}");
|
||||
}
|
||||
.presentation-icon {
|
||||
--mask-url: url("{{ static "learningjam2024/presentation.svg" }}");
|
||||
}
|
||||
</style>
|
||||
<div class="mw7 margin-center flex flex-column">
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="dib c--theme-gradient-light">What is a Learning Jam?</h2>
|
||||
<div class="post-content">
|
||||
<p>
|
||||
The <b class="c--theme-gradient-light">Learning Jam</b> is an opportunity for you to learn something new.
|
||||
</p>
|
||||
<p>
|
||||
Unlike traditional game jams, and unlike our previous programming jams, the goal of the <b class="c--theme-gradient-light">Learning Jam</b> is <em>knowledge</em>. It's an opportunity to throw yourself at a topic and learn everything you can about it—and then, to turn around and share that knowledge with others.
|
||||
</p>
|
||||
<p>
|
||||
The jam takes place over <b>two weekends</b>. On the first weekend, you'll learn as much as you can about your topic of choice. On the second, you'll share what you learned in whatever form you like—writeup, video, Minecraft mod, whatever.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="mb3 dib c--theme-gradient-light">How to participate</h2>
|
||||
<div class="flex flex-column g2">
|
||||
<div class="pa3 flex flex-column flex-row-ns g3 items-center bg--rich-gray">
|
||||
<div class="flex-shrink-0 w4 flex justify-center items-center">
|
||||
<div class="flex svg-mask lightbulb-icon bg--theme-gradient-light" style="width: 5.2rem">
|
||||
<img class="invisible" src="{{ static "learningjam2024/lightbulb.svg" }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<h3 class="f4">Choose a topic.</h3>
|
||||
<p>
|
||||
Decide what you'll spend your weekend learning about. Maybe there's an area of programming you've been meaning to dig into, or maybe there's a specialization in your field that you've been curious about. Maybe you just need a reason to read papers for a weekend.
|
||||
</p>
|
||||
<p>
|
||||
You're welcome to work in teams or work solo.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pa3 flex flex-column flex-row-ns g3 items-center bg--rich-gray">
|
||||
<div class="flex-shrink-0 w4 flex justify-center items-center">
|
||||
<div class="flex flex-shrink-0 svg-mask books-icon bg--theme-gradient-light" style="width: 3.6rem">
|
||||
<img class="invisible" src="{{ static "learningjam2024/books.svg" }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<h3 class="f4">Mar 15-17: Learn!</h3>
|
||||
<p>
|
||||
Create a Handmade Network project to track your progress. Then go down the rabbit hole. Absorb as much information as you can in a weekend.
|
||||
</p>
|
||||
<p>
|
||||
As you learn, we encourage you to share updates on Discord using the <b>!til</b> command. These updates will be published as part of your submission.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pa3 flex flex-column flex-row-ns g3 items-center bg--rich-gray">
|
||||
<div class="flex-shrink-0 w4 flex justify-center items-center">
|
||||
<div class="flex flex-shrink-0 svg-mask presentation-icon bg--theme-gradient-light" style="width: 5rem">
|
||||
<img class="invisible" src="{{ static "learningjam2024/presentation.svg" }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<h3 class="f4">Mar 22-24: Share!</h3>
|
||||
<p>
|
||||
Share what you learned with the rest of the community. You can present the information in any form you like—whatever helps you communicate most effectively.
|
||||
</p>
|
||||
<p>
|
||||
Your post doesn't have to be the authoritative resource on a subject. It doesn't even have to do much "teaching" at all. The point is just to share what you learned, what surprised you, what you found interesting, and where you want to go from here.
|
||||
</p>
|
||||
<p>
|
||||
Your Handmade Network project is your final submission. Make sure the description gives adequate context, and either attach or link to your final presentation.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="dib c--theme-gradient-light">Why?</h2>
|
||||
<div class="post-content">
|
||||
<p>
|
||||
The Handmade Network's goal is to change the software industry by building back up from new foundations. But in order to do that, we need to understand those foundations.
|
||||
</p>
|
||||
<p>
|
||||
Our other programming jams are great opportunities to try building new things. But what should those new things be? We want to give the community a chance to focus just on learning and research, to gather information and share it with others, to boost the entire community's knowledge on a topic.
|
||||
</p>
|
||||
<p>
|
||||
We hope that the results of the <b class="c--theme-gradient-light">Learning Jam</b> inspire new ideas for the community to explore in the Visibility and Wheel Reinvention jams later in the year. There is so much bad software out in the world, and this is the first step toward reinventing it.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{ if gt .DaysUntilStart 0 }}
|
||||
{{ template "before-jam" . }}
|
||||
{{ else if gt .DaysUntilEnd 0 }}
|
||||
{{ template "during-jam" . }}
|
||||
{{ else }}
|
||||
{{ template "after-jam" . }}
|
||||
{{ end }}
|
||||
|
||||
<div>
|
||||
<div class="mv5 h3 fill-current">
|
||||
<div class="mv5 h3 fill-current link--white">
|
||||
<a href="{{ .Header.HMNHomepageUrl }}">{{ svg "hmn_circuit" }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "before-jam" }}
|
||||
{{ template "jam_2024_lj_guidelines.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "during-jam" }}
|
||||
{{ if .Projects.Projects }}
|
||||
{{ template "jam_2024_lj_description.html" . }}
|
||||
{{ if .TimelineItems }}
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="c--theme-gradient-light">Recent Updates</h2>
|
||||
<div class="flex flex-column g2">
|
||||
{{ template "jam_2024_lj_feeditems.html" .TimelineItems }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="c--theme-gradient-light">Projects</h2>
|
||||
{{ template "jam_2024_lj_projects.html" .Projects }}
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ template "jam_2024_lj_guidelines.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "after-jam" }}
|
||||
{{ template "jam_2024_lj_description.html" . }}
|
||||
{{ with .TwitchEmbedUrl }}
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="dib c--theme-gradient-light">Recap Show</h2>
|
||||
<p>
|
||||
Watch the livestream celebrating all the submissions:
|
||||
</p>
|
||||
<div class="mt3" style="aspect-ratio: 16 / 9;">
|
||||
<iframe src="{{ . }}" allowfullscreen width="100%" height="100%" frameborder="0"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="ph3 pv4 bb b--rich-gray">
|
||||
<h2 class="c--theme-gradient-light">Projects</h2>
|
||||
{{ template "jam_2024_lj_projects.html" .Projects }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -66,27 +66,17 @@ func JamIndex2024_Learning(c *RequestContext) ResponseData {
|
|||
UserAvatarUrl string
|
||||
DaysUntilStart, DaysUntilEnd int
|
||||
TwitchEmbedUrl string
|
||||
ProjectSubmissionUrl string
|
||||
NewProjectUrl string
|
||||
SubmittedProjectUrl string
|
||||
JamFeedUrl string
|
||||
|
||||
Projects JamProjectDataLJ2024
|
||||
TimelineItems []templates.TimelineItem
|
||||
}
|
||||
|
||||
twitchEmbedUrl := ""
|
||||
twitchStatus, err := db.QueryOne[models.TwitchLatestStatus](c, c.Conn,
|
||||
`
|
||||
SELECT $columns
|
||||
FROM twitch_latest_status
|
||||
WHERE twitch_login = $1
|
||||
`,
|
||||
"handmadenetwork",
|
||||
)
|
||||
if err == nil {
|
||||
if twitchStatus.Live {
|
||||
hmnUrl, err := url.Parse(config.Config.BaseUrl)
|
||||
if err == nil {
|
||||
twitchEmbedUrl = fmt.Sprintf("https://player.twitch.tv/?channel=%s&parent=%s", twitchStatus.TwitchLogin, hmnUrl.Hostname())
|
||||
}
|
||||
}
|
||||
feedData, err := getLJ2024FeedData(c, 5)
|
||||
if err != nil {
|
||||
return c.ErrorResponse(http.StatusInternalServerError, err)
|
||||
}
|
||||
|
||||
tmpl := JamPageData{
|
||||
|
@ -94,10 +84,13 @@ func JamIndex2024_Learning(c *RequestContext) ResponseData {
|
|||
UserAvatarUrl: templates.UserAvatarDefaultUrl("dark"),
|
||||
DaysUntilStart: daysUntilStart,
|
||||
DaysUntilEnd: daysUntilEnd,
|
||||
ProjectSubmissionUrl: hmnurl.BuildProjectNewJam(),
|
||||
TwitchEmbedUrl: getTwitchEmbedUrl(c),
|
||||
NewProjectUrl: hmnurl.BuildProjectNewJam(),
|
||||
SubmittedProjectUrl: "",
|
||||
JamFeedUrl: hmnurl.BuildJamFeed2024_Learning(),
|
||||
TwitchEmbedUrl: twitchEmbedUrl,
|
||||
|
||||
Projects: feedData.Projects,
|
||||
TimelineItems: feedData.TimelineItems,
|
||||
}
|
||||
|
||||
if c.CurrentUser != nil {
|
||||
|
@ -140,66 +133,16 @@ func JamFeed2024_Learning(c *RequestContext) ResponseData {
|
|||
templates.BaseData
|
||||
UserAvatarUrl string
|
||||
DaysUntilStart, DaysUntilEnd int
|
||||
TwitchEmbedUrl string
|
||||
ProjectSubmissionUrl string
|
||||
SubmittedProjectUrl string
|
||||
|
||||
Projects []templates.Project
|
||||
Projects JamProjectDataLJ2024
|
||||
TimelineItems []templates.TimelineItem
|
||||
}
|
||||
|
||||
twitchEmbedUrl := ""
|
||||
twitchStatus, err := db.QueryOne[models.TwitchLatestStatus](c, c.Conn,
|
||||
`
|
||||
SELECT $columns
|
||||
FROM twitch_latest_status
|
||||
WHERE twitch_login = $1
|
||||
`,
|
||||
"handmadenetwork",
|
||||
)
|
||||
if err == nil {
|
||||
if twitchStatus.Live {
|
||||
hmnUrl, err := url.Parse(config.Config.BaseUrl)
|
||||
if err == nil {
|
||||
twitchEmbedUrl = fmt.Sprintf("https://player.twitch.tv/?channel=%s&parent=%s", twitchStatus.TwitchLogin, hmnUrl.Hostname())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jamProjects, err := hmndata.FetchProjects(c, c.Conn, c.CurrentUser, hmndata.ProjectsQuery{
|
||||
JamSlugs: []string{hmndata.LJ2024.Slug},
|
||||
})
|
||||
feedData, err := getLJ2024FeedData(c, 0)
|
||||
if err != nil {
|
||||
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch jam projects for current user"))
|
||||
}
|
||||
|
||||
projectIds := make([]int, 0, len(jamProjects))
|
||||
for _, jp := range jamProjects {
|
||||
projectIds = append(projectIds, jp.Project.ID)
|
||||
}
|
||||
|
||||
var timelineItems []templates.TimelineItem
|
||||
if len(projectIds) > 0 {
|
||||
snippets, err := hmndata.FetchSnippets(c, c.Conn, c.CurrentUser, hmndata.SnippetQuery{
|
||||
ProjectIDs: projectIds,
|
||||
})
|
||||
if err != nil {
|
||||
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch snippets for jam showcase"))
|
||||
}
|
||||
|
||||
timelineItems = 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)
|
||||
timelineItem.SmallInfo = true
|
||||
timelineItems = append(timelineItems, timelineItem)
|
||||
}
|
||||
}
|
||||
|
||||
projects := make([]templates.Project, 0, len(jamProjects))
|
||||
for _, jp := range jamProjects {
|
||||
urlContext := hmndata.UrlContextForProject(&jp.Project)
|
||||
projectUrl := urlContext.BuildHomepage()
|
||||
projects = append(projects, templates.ProjectAndStuffToTemplate(&jp, projectUrl, c.Theme))
|
||||
return c.ErrorResponse(http.StatusInternalServerError, err)
|
||||
}
|
||||
|
||||
tmpl := JamFeedData{
|
||||
|
@ -207,11 +150,10 @@ func JamFeed2024_Learning(c *RequestContext) ResponseData {
|
|||
UserAvatarUrl: templates.UserAvatarDefaultUrl("dark"),
|
||||
DaysUntilStart: daysUntilStart,
|
||||
DaysUntilEnd: daysUntilEnd,
|
||||
TwitchEmbedUrl: twitchEmbedUrl,
|
||||
ProjectSubmissionUrl: hmnurl.BuildProjectNewJam(),
|
||||
SubmittedProjectUrl: "",
|
||||
Projects: projects,
|
||||
TimelineItems: timelineItems,
|
||||
Projects: feedData.Projects,
|
||||
TimelineItems: feedData.TimelineItems,
|
||||
}
|
||||
|
||||
if c.CurrentUser != nil {
|
||||
|
@ -235,6 +177,90 @@ func JamFeed2024_Learning(c *RequestContext) ResponseData {
|
|||
return res
|
||||
}
|
||||
|
||||
type JamProjectDataLJ2024 struct {
|
||||
Projects []templates.Project
|
||||
NewProjectUrl string
|
||||
}
|
||||
|
||||
type JamFeedDataLJ2024 struct {
|
||||
Projects JamProjectDataLJ2024
|
||||
TimelineItems []templates.TimelineItem
|
||||
|
||||
projects []hmndata.ProjectAndStuff
|
||||
}
|
||||
|
||||
// 0 for no limit on timeline items.
|
||||
func getLJ2024FeedData(c *RequestContext, maxTimelineItems int) (JamFeedDataLJ2024, error) {
|
||||
jamProjects, err := hmndata.FetchProjects(c, c.Conn, c.CurrentUser, hmndata.ProjectsQuery{
|
||||
JamSlugs: []string{hmndata.LJ2024.Slug},
|
||||
})
|
||||
if err != nil {
|
||||
return JamFeedDataLJ2024{}, oops.New(err, "failed to fetch jam projects for current user")
|
||||
}
|
||||
|
||||
projects := make([]templates.Project, 0, len(jamProjects))
|
||||
for _, jp := range jamProjects {
|
||||
urlContext := hmndata.UrlContextForProject(&jp.Project)
|
||||
projectUrl := urlContext.BuildHomepage()
|
||||
projects = append(projects, templates.ProjectAndStuffToTemplate(&jp, projectUrl, c.Theme))
|
||||
}
|
||||
|
||||
projectIds := make([]int, 0, len(jamProjects))
|
||||
for _, jp := range jamProjects {
|
||||
projectIds = append(projectIds, jp.Project.ID)
|
||||
}
|
||||
|
||||
var timelineItems []templates.TimelineItem
|
||||
if len(projectIds) > 0 {
|
||||
snippets, err := hmndata.FetchSnippets(c, c.Conn, c.CurrentUser, hmndata.SnippetQuery{
|
||||
ProjectIDs: projectIds,
|
||||
Limit: maxTimelineItems,
|
||||
})
|
||||
if err != nil {
|
||||
return JamFeedDataLJ2024{}, oops.New(err, "failed to fetch snippets for jam showcase")
|
||||
}
|
||||
|
||||
timelineItems = 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)
|
||||
timelineItem.SmallInfo = true
|
||||
timelineItems = append(timelineItems, timelineItem)
|
||||
}
|
||||
}
|
||||
|
||||
return JamFeedDataLJ2024{
|
||||
Projects: JamProjectDataLJ2024{
|
||||
Projects: projects,
|
||||
NewProjectUrl: hmnurl.BuildProjectNewJam(),
|
||||
},
|
||||
TimelineItems: timelineItems,
|
||||
|
||||
projects: jamProjects,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func getTwitchEmbedUrl(c *RequestContext) string {
|
||||
twitchEmbedUrl := ""
|
||||
twitchStatus, err := db.QueryOne[models.TwitchLatestStatus](c, c.Conn,
|
||||
`
|
||||
SELECT $columns
|
||||
FROM twitch_latest_status
|
||||
WHERE twitch_login = $1
|
||||
`,
|
||||
"carlsagan42",
|
||||
)
|
||||
if err != nil {
|
||||
c.Logger.Warn().Err(err).Msg("failed to query Twitch status for the HMN account")
|
||||
} else if twitchStatus.Live {
|
||||
hmnUrl, err := url.Parse(config.Config.BaseUrl)
|
||||
if err == nil {
|
||||
twitchEmbedUrl = fmt.Sprintf("https://player.twitch.tv/?channel=%s&parent=%s", twitchStatus.TwitchLogin, hmnUrl.Hostname())
|
||||
}
|
||||
}
|
||||
|
||||
return twitchEmbedUrl
|
||||
}
|
||||
|
||||
func JamIndex2023(c *RequestContext) ResponseData {
|
||||
var res ResponseData
|
||||
|
||||
|
|
Loading…
Reference in New Issue