Skip to content

Commit

Permalink
reverse posts' order when singlePost mode is on
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Sep 11, 2024
1 parent 0163498 commit a9aba45
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#

APP_NAME=littr
APP_VERSION=0.40.0
APP_VERSION=0.40.1
GOLANG_VERSION=1.23
2 changes: 1 addition & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "MIT",
"url": "https://github.com/krustowski/littr/blob/master/LICENSE"
},
"version": "0.40.0"
"version": "0.40.1"
},
"host": "www.littr.eu",
"basePath": "/api/v1",
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/router.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @title littr
// @version 0.40.0
// @version 0.40.1
// @description a simple nanoblogging platform as PWA built on go-app framework
// @termsOfService https://littr.eu/tos

Expand Down
8 changes: 6 additions & 2 deletions pkg/frontend/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,10 @@ func (c *flowContent) Render() app.UI {

// order posts by timestamp DESC
sort.SliceStable(sortedPosts, func(i, j int) bool {
if c.singlePostID != "" {
return sortedPosts[i].Timestamp.Before(sortedPosts[j].Timestamp)
}

return sortedPosts[i].Timestamp.After(sortedPosts[j].Timestamp)
})

Expand Down Expand Up @@ -1578,10 +1582,10 @@ func (c *flowContent) Render() app.UI {
app.Details().Class("max").Body(
app.Summary().Text(previousDetailsSummary).Style("word-break", "break-word").Style("hyphens", "auto").Class("italic"),
app.Div().Class("space"),
app.Span().Class("italic").Text(previousContent).Style("word-break", "break-word").Style("hyphens", "auto").Style("white-space", "pre-line"),
app.Span().Class("bold").Text(previousContent).Style("word-break", "break-word").Style("hyphens", "auto").Style("white-space", "pre-line"),
),
).Else(
app.Span().Class("max italic").Text(previousContent).Style("word-break", "break-word").Style("hyphens", "auto").Style("white-space", "pre-line"),
app.Span().Class("max bold").Text(previousContent).Style("word-break", "break-word").Style("hyphens", "auto").Style("white-space", "pre-line"),
),

app.Button().Title("link to original post").ID(post.ReplyToID).Class("transparent circle").OnClick(c.onClickLink).Disabled(c.buttonDisabled).Body(
Expand Down

0 comments on commit a9aba45

Please sign in to comment.