Skip to content

Commit

Permalink
add welcome page, edit routing, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Aug 28, 2024
1 parent df057ef commit 9416e2f
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 8 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=litter-go
APP_VERSION=0.38.9
APP_VERSION=0.39.0
GOLANG_VERSION=1.23
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ Successfully copied 3.07kB to /home/user/litter-go/run_data/
+ [...]

### roadmap to v0.39
+ implement Esc key to close toasts and modals
+ welcome page
+ ~~implement Esc key to close toasts and modals + Ctrl-Enter for other inputs~~
+ ~~welcome page~~

### roadmap to v0.38
+ ~~add minor UI fixes (dialog buttons colouring)~~
Expand Down
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/litter-go/blob/master/LICENSE"
},
"version": "0.38.9"
"version": "0.39.0"
},
"host": "littr.eu",
"basePath": "/api/v1",
Expand Down
2 changes: 1 addition & 1 deletion cmd/littr/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func initClient() {
app.Route("/", &fe.LoginPage{})
app.Route("/", &fe.WelcomePage{})
app.Route("/flow", &fe.FlowPage{})
app.RouteWithRegexp("/flow/post/\\d+", &fe.FlowPage{})
app.RouteWithRegexp("/flow/hashtag/\\w+", &fe.FlowPage{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/littr/wasm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func initClient() {
app.Route("/", &fe.LoginPage{})
app.Route("/", &fe.WelcomePage{})
app.Route("/flow", &fe.FlowPage{})
app.RouteWithRegexp("/flow/post/\\d+", &fe.FlowPage{})
app.RouteWithRegexp("/flow/hashtag/\\w+", &fe.FlowPage{})
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 litter-go
// @version 0.38.9
// @version 0.39.0
// @description nanoblogging platform as PWA built on go-app framework
// @termsOfService https://littr.eu/tos

Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/navbars.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (h *header) OnMount(ctx app.Context) {

// redirect client to the unauthorized zone
path := ctx.Page().URL().Path
if !authGranted && path != "/login" && path != "/register" && !strings.Contains(path, "/reset") && path != "/tos" {
if !authGranted && path != "/" && path != "/login" && path != "/register" && !strings.Contains(path, "/reset") && path != "/tos" {
ctx.Navigate("/login")
return
}
Expand Down
79 changes: 79 additions & 0 deletions pkg/frontend/welcome.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package frontend

import (
"github.com/maxence-charriere/go-app/v9/pkg/app"
)

type WelcomePage struct {
app.Compo

mode string
}

type welcomeContent struct {
app.Compo
}

func (p *WelcomePage) Render() app.UI {
return app.Div().Body(
&header{},
&footer{},
&welcomeContent{},
)
}

func (p *WelcomePage) OnNav(ctx app.Context) {
ctx.Page().SetTitle("welcome / littr")
}

func (c *welcomeContent) OnMount(ctx app.Context) {
}

func (c *welcomeContent) OnNav(ctx app.Context) {
}

func (c *welcomeContent) Render() app.UI {
return app.Main().Class("responsive").Body(
app.Article().Class("").Style("border-radius", "8px").Body(
app.Div().Class("row center-align").Body(
app.Img().Src("/web/android-chrome-192x192.png"),
app.H4().Body(
app.Span().Body(
app.Text("littr"),
),
),
),
app.Div().Class("space"),
app.H6().Class("margin-bottom center-align").Body(
app.Span().Body(
app.Text("a simple nanoblogging platform"),
),
),
),

app.Article().Style("z-index", "5").Style("border-radius", "8px").Class("medium no-padding transparent center-align").Body(
app.Img().Class("no-padding absolute center middle lazy").Src("https://krusty.space/littr_flow_new_post_live_v0.30.17.jpg").Style("max-width", "100%").Style("max-height", "100%").Attr("loading", "lazy"),
),

app.Article().Class("row large-padding").Body(
app.I().Text("lightbulb").Class("amber-text"),
app.P().Class("max").Body(
app.Span().Class("deep-orange-text").Text("welcome to littr! "),
app.Span().Text("this site acts as a simple platform for anyone who likes to post short notes, messages, daydreaming ideas and more! you can use it as a personal journal charting your journey through life that can be shared with other accounts"),
app.Div().Class("small-space"),

app.Span().Text("the very main page of this platform is called"),
app.Span().Class("deep-orange-text").Text(" flow "),
app.Span().Text("(shown above); this page lists all your posts in reverse chronological order (newest to oldest) plus posts from other folks/accounts that you have added to your flow"),
app.Div().Class("small-space"),

app.Span().Text("to navigate to the login page (where the link to registration sits as well) use the icon/button in the upper right corner: "),
app.I().Class("large").Class("deep-orange-text").Body(
app.Text("login"),
),
),
),

app.Div().Class("medium-space"),
)
}

0 comments on commit 9416e2f

Please sign in to comment.