Updating Feed for VJ 2023
This commit is contained in:
parent
f9f0e1b119
commit
45b5c7f4d4
|
@ -77,6 +77,13 @@ func BuildJamIndex2023_Visibility() string {
|
||||||
return Url("/jam/visibility-2023", nil)
|
return Url("/jam/visibility-2023", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var RegexJamFeed2023_Visibility = regexp.MustCompile("^/jam/visibility-2023/feed$")
|
||||||
|
|
||||||
|
func BuildJamFeed2023_Visibility() string {
|
||||||
|
defer CatchPanic()
|
||||||
|
return Url("/jam/visibility-2023/feed", nil)
|
||||||
|
}
|
||||||
|
|
||||||
var RegexJamFeed2022 = regexp.MustCompile("^/jam/2022/feed$")
|
var RegexJamFeed2022 = regexp.MustCompile("^/jam/2022/feed$")
|
||||||
|
|
||||||
func BuildJamFeed2022() string {
|
func BuildJamFeed2022() string {
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
{{ template "jam_2023_visibility_base.html" . }} {{ define "content" }}
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--theme-color: white;
|
||||||
|
--theme-color-dimmer: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#title {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div id="top-container" class="flex flex-column items-center ph3">
|
||||||
|
<h1 id="title">Visibility Jam</h1>
|
||||||
|
<h2 id="dates">April 14 - 16, 2023</h2>
|
||||||
|
<div id="tagline" class="center">See things in a new way.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section bg-black-20 pt4 pb3 pb4-ns">
|
||||||
|
<div class="mw8 margin-center ph3 ph4-l flex flex-column flex-row-ns g3">
|
||||||
|
<div class="flex-grow-1 overflow-hidden">
|
||||||
|
{{ if eq .DaysUntilEnd 0 }}
|
||||||
|
<h3 class="mt0 mb3">Project updates</h3>
|
||||||
|
{{ else }}
|
||||||
|
<h3 class="mt0 mb3">Recent updates</h3>
|
||||||
|
{{ end }}
|
||||||
|
<div class="timeline">
|
||||||
|
{{ range .TimelineItems }} {{ template "timeline_item.html" . }} {{ end
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="w-40-ns flex-shrink-0">
|
||||||
|
<h3 class="mt0 mb3">Projects</h3>
|
||||||
|
<div class="projects flex flex-column g3 back-to-normal">
|
||||||
|
{{ range .JamProjects }} {{ template "project_card.html" projectcarddata
|
||||||
|
. "" }} {{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
|
@ -111,6 +111,76 @@ func JamIndex2023_Visibility(c *RequestContext) ResponseData {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func JamFeed2023_Visibility(c *RequestContext) ResponseData {
|
||||||
|
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"))
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pageProjects := make([]templates.Project, 0, len(jamProjects))
|
||||||
|
for _, p := range jamProjects {
|
||||||
|
pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme))
|
||||||
|
}
|
||||||
|
|
||||||
|
type JamFeedData struct {
|
||||||
|
templates.BaseData
|
||||||
|
DaysUntilStart, DaysUntilEnd int
|
||||||
|
|
||||||
|
JamProjects []templates.Project
|
||||||
|
TimelineItems []templates.TimelineItem
|
||||||
|
}
|
||||||
|
|
||||||
|
daysUntilStart := daysUntil(hmndata.VJ2023.StartTime)
|
||||||
|
daysUntilEnd := daysUntil(hmndata.VJ2023.EndTime)
|
||||||
|
|
||||||
|
baseData := getBaseDataAutocrumb(c, hmndata.VJ2023.Name)
|
||||||
|
|
||||||
|
baseData.OpenGraphItems = []templates.OpenGraphItem{
|
||||||
|
{Property: "og:title", Value: "Visibility Jam"},
|
||||||
|
{Property: "og:site_name", Value: "Handmade Network"},
|
||||||
|
{Property: "og:type", Value: "website"},
|
||||||
|
{Property: "og:image", Value: hmnurl.BuildPublic("visjam2023/opengraph.png", true)},
|
||||||
|
{Property: "og:description", Value: "See things in a new way. April 14 - 16."},
|
||||||
|
{Property: "og:url", Value: hmnurl.BuildJamIndex()},
|
||||||
|
{Name: "twitter:card", Value: "summary_large_image"},
|
||||||
|
{Name: "twitter:image", Value: hmnurl.BuildPublic("visjam2023/TwitterCard.png", true)},
|
||||||
|
}
|
||||||
|
|
||||||
|
var res ResponseData
|
||||||
|
res.MustWriteTemplate("jam_2023_vj_feed.html", JamFeedData{
|
||||||
|
BaseData: baseData,
|
||||||
|
DaysUntilStart: daysUntilStart,
|
||||||
|
DaysUntilEnd: daysUntilEnd,
|
||||||
|
JamProjects: pageProjects,
|
||||||
|
TimelineItems: timelineItems,
|
||||||
|
}, c.Perf)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
func JamIndex2022(c *RequestContext) ResponseData {
|
func JamIndex2022(c *RequestContext) ResponseData {
|
||||||
var res ResponseData
|
var res ResponseData
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ func NewWebsiteRoutes(conn *pgxpool.Pool) http.Handler {
|
||||||
hmnOnly.GET(hmnurl.RegexJamIndex2022, JamIndex2022)
|
hmnOnly.GET(hmnurl.RegexJamIndex2022, JamIndex2022)
|
||||||
hmnOnly.GET(hmnurl.RegexJamFeed2022, JamFeed2022)
|
hmnOnly.GET(hmnurl.RegexJamFeed2022, JamFeed2022)
|
||||||
hmnOnly.GET(hmnurl.RegexJamIndex2023_Visibility, JamIndex2023_Visibility)
|
hmnOnly.GET(hmnurl.RegexJamIndex2023_Visibility, JamIndex2023_Visibility)
|
||||||
|
hmnOnly.GET(hmnurl.RegexJamFeed2023_Visibility, JamFeed2023_Visibility)
|
||||||
|
|
||||||
hmnOnly.GET(hmnurl.RegexStaffRolesIndex, StaffRolesIndex)
|
hmnOnly.GET(hmnurl.RegexStaffRolesIndex, StaffRolesIndex)
|
||||||
hmnOnly.GET(hmnurl.RegexStaffRole, StaffRole)
|
hmnOnly.GET(hmnurl.RegexStaffRole, StaffRole)
|
||||||
|
|
Loading…
Reference in New Issue