diff --git a/public/style.css b/public/style.css
index f1bff694..38a063ab 100644
--- a/public/style.css
+++ b/public/style.css
@@ -7412,6 +7412,15 @@ pre,
.f8 {
font-size: 0.65rem;
}
+.w6 {
+ width: var(--width-6);
+}
+.w7 {
+ width: var(--width-7);
+}
+.w8 {
+ width: var(--width-8);
+}
.mw-site {
max-width: var(--site-width);
}
@@ -7557,6 +7566,15 @@ pre,
cursor: grabbing;
}
@media screen and (min-width: 35em) {
+ .w6-ns {
+ width: var(--width-6);
+ }
+ .w7-ns {
+ width: var(--width-7);
+ }
+ .w8-ns {
+ width: var(--width-8);
+ }
.bi-avoid-ns {
break-inside: avoid;
}
@@ -7613,6 +7631,15 @@ pre,
}
}
@media screen and (min-width: 35em) and (max-width: 60em) {
+ .w6-m {
+ width: var(--width-6);
+ }
+ .w7-m {
+ width: var(--width-7);
+ }
+ .w8-m {
+ width: var(--width-8);
+ }
.bi-avoid-m {
break-inside: avoid;
}
@@ -7666,6 +7693,15 @@ pre,
}
}
@media screen and (min-width: 60em) {
+ .w6-l {
+ width: var(--width-6);
+ }
+ .w7-l {
+ width: var(--width-7);
+ }
+ .w8-l {
+ width: var(--width-8);
+ }
.bi-avoid-l {
break-inside: avoid;
}
diff --git a/src/models/thread.go b/src/models/thread.go
index 36f327a9..8d561d21 100644
--- a/src/models/thread.go
+++ b/src/models/thread.go
@@ -12,6 +12,12 @@ const (
ThreadTypePersonalBlogPost
)
+var ValidThreadTypes = []ThreadType{
+ ThreadTypeProjectBlogPost,
+ ThreadTypeForumPost,
+ ThreadTypePersonalBlogPost,
+}
+
type Thread struct {
ID int `db:"id"`
diff --git a/src/rawdata/scss/core.css b/src/rawdata/scss/core.css
index 186e2de3..b41e34a0 100644
--- a/src/rawdata/scss/core.css
+++ b/src/rawdata/scss/core.css
@@ -229,6 +229,18 @@ pre,
font-size: 0.65rem;
}
+.w6 {
+ width: var(--width-6);
+}
+
+.w7 {
+ width: var(--width-7);
+}
+
+.w8 {
+ width: var(--width-8);
+}
+
.mw-site {
max-width: var(--site-width);
}
@@ -422,6 +434,18 @@ pre,
}
@media screen and (min-width: 35em) {
+ .w6-ns {
+ width: var(--width-6);
+ }
+
+ .w7-ns {
+ width: var(--width-7);
+ }
+
+ .w8-ns {
+ width: var(--width-8);
+ }
+
.bi-avoid-ns {
break-inside: avoid;
}
@@ -496,6 +520,18 @@ pre,
}
@media screen and (min-width: 35em) and (max-width: 60em) {
+ .w6-m {
+ width: var(--width-6);
+ }
+
+ .w7-m {
+ width: var(--width-7);
+ }
+
+ .w8-m {
+ width: var(--width-8);
+ }
+
.bi-avoid-m {
break-inside: avoid;
}
@@ -566,6 +602,18 @@ pre,
}
@media screen and (min-width: 60em) {
+ .w6-l {
+ width: var(--width-6);
+ }
+
+ .w7-l {
+ width: var(--width-7);
+ }
+
+ .w8-l {
+ width: var(--width-8);
+ }
+
.bi-avoid-l {
break-inside: avoid;
}
diff --git a/src/templates/src/landing.html b/src/templates/src/landing.html
index b28977b8..fcde34c1 100644
--- a/src/templates/src/landing.html
+++ b/src/templates/src/landing.html
@@ -81,6 +81,40 @@
-->
{{ end }}
-wowoaohaoh
+
+
+
+
+
+
+ Your projects
+ {{ svg "chevron-down" }}
+
+
+ You have not created any projects.
+
+
+
+
+ Following
+ {{ svg "chevron-down" }}
+
+
+ You are not following anything yet.
+
+
+
+
+
+
+
+ {{ range .RecentItems }}
+ {{ template "timeline_item.html" . }}
+ {{ end }}
+ TODO: READ MORE LINK
+
+
+
+
{{ end }}
diff --git a/src/website/landing.go b/src/website/landing.go
index d2ebda90..6044b0c5 100644
--- a/src/website/landing.go
+++ b/src/website/landing.go
@@ -11,58 +11,30 @@ import (
"git.handmade.network/hmn/hmn/src/templates"
)
-type LandingTemplateData struct {
- templates.BaseData
-
- NewsPost *templates.TimelineItem
- FollowingItems []templates.TimelineItem
- FeaturedItems []templates.TimelineItem
- RecentItems []templates.TimelineItem
- NewsItems []templates.TimelineItem
-
- ManifestoUrl string
- PodcastUrl string
- AtomFeedUrl string
- MarkAllReadUrl string
-
- JamUrl string
- JamDaysUntilStart, JamDaysUntilEnd int
-
- HMSDaysUntilStart, HMSDaysUntilEnd int
- HMBostonDaysUntilStart, HMBostonDaysUntilEnd int
-}
-
func Index(c *RequestContext) ResponseData {
c.Perf.StartBlock("SQL", "Fetch subforum tree")
subforumTree := models.GetFullSubforumTree(c, c.Conn)
lineageBuilder := models.MakeSubforumLineageBuilder(subforumTree)
c.Perf.EndBlock()
- var timelineItems []templates.TimelineItem
+ var err error
+ var followingItems []templates.TimelineItem
+ var featuredItems []templates.TimelineItem
+ var recentItems []templates.TimelineItem
+ var newsItems []templates.TimelineItem
- FetchFollowTimelineForUser(c, c.Conn, c.CurrentUser)
+ if c.CurrentUser != nil {
+ followingItems, err = FetchFollowTimelineForUser(c, c.Conn, c.CurrentUser)
+ if err != nil {
+ c.Logger.Warn().Err(err).Msg("failed to fetch following feed")
+ }
+ }
- // This is essentially an alternate for feed page 1.
- posts, err := hmndata.FetchPosts(c, c.Conn, c.CurrentUser, hmndata.PostsQuery{
- ThreadTypes: feedThreadTypes,
- Limit: feedPostsPerPage,
- SortDescending: true,
+ recentItems, err = FetchTimeline(c, c.Conn, c.CurrentUser, TimelineQuery{
+ Limit: 100,
})
if err != nil {
- c.Logger.Warn().Err(err).Msg("failed to fetch latest posts")
- }
- for _, p := range posts {
- if p.Project.IsHMN() {
- continue // ignore news posts et. al.
- }
-
- item := PostToTimelineItem(hmndata.UrlContextForProject(&p.Project), lineageBuilder, &p.Post, &p.Thread, p.Author)
- if p.Thread.Type == models.ThreadTypeProjectBlogPost && p.Post.ID == p.Thread.FirstID {
- // blog post
- item.Description = template.HTML(p.CurrentVersion.TextParsed)
- item.TruncateDescription = true
- }
- timelineItems = append(timelineItems, item)
+ c.Logger.Warn().Err(err).Msg("failed to fetch recent feed")
}
c.Perf.StartBlock("SQL", "Get news")
@@ -87,6 +59,27 @@ func Index(c *RequestContext) ResponseData {
}
c.Perf.EndBlock()
+ type LandingTemplateData struct {
+ templates.BaseData
+
+ NewsPost *templates.TimelineItem
+ FollowingItems []templates.TimelineItem
+ FeaturedItems []templates.TimelineItem
+ RecentItems []templates.TimelineItem
+ NewsItems []templates.TimelineItem
+
+ ManifestoUrl string
+ PodcastUrl string
+ AtomFeedUrl string
+ MarkAllReadUrl string
+
+ JamUrl string
+ JamDaysUntilStart, JamDaysUntilEnd int
+
+ HMSDaysUntilStart, HMSDaysUntilEnd int
+ HMBostonDaysUntilStart, HMBostonDaysUntilEnd int
+ }
+
baseData := getBaseData(c, "", nil)
baseData.OpenGraphItems = append(baseData.OpenGraphItems, templates.OpenGraphItem{
Property: "og:description",
@@ -98,7 +91,10 @@ func Index(c *RequestContext) ResponseData {
BaseData: baseData,
NewsPost: newsPostItem,
- FollowingItems: timelineItems,
+ FollowingItems: followingItems,
+ FeaturedItems: featuredItems,
+ RecentItems: recentItems,
+ NewsItems: newsItems,
ManifestoUrl: hmnurl.BuildManifesto(),
PodcastUrl: hmnurl.BuildPodcast(),
diff --git a/src/website/timeline_helper.go b/src/website/timeline_helper.go
index 21b088de..eab29bf2 100644
--- a/src/website/timeline_helper.go
+++ b/src/website/timeline_helper.go
@@ -62,6 +62,8 @@ func FetchFollowTimelineForUser(ctx context.Context, conn db.ConnOrTx, user *mod
type TimelineQuery struct {
UserIDs []int
ProjectIDs []int
+
+ Limit int
}
func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.User, q TimelineQuery) ([]templates.TimelineItem, error) {