diff --git a/.drone.yml b/.drone.yml index dd9ef4a..0b52942 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,7 +17,7 @@ steps: from_secret: docker_password repo: dutchellie/proper-website-2 build_args: - - APIURL=https://api.nicecock.eu/api/testingcomment + - APIURL=https://api.nicecock.eu/api/testing tags: - dev - ${DRONE_COMMIT_SHA:0:8} @@ -65,7 +65,7 @@ steps: from_secret: docker_password repo: dutchellie/proper-website-2 build_args: - - APIURL=https://api.nicecock.eu/api/comment + - APIURL=https://api.nicecock.eu/api tags: - latest - ${DRONE_COMMIT_SHA:0:8} diff --git a/src/bloglinks.go b/src/bloglinks.go new file mode 100644 index 0000000..e69de29 diff --git a/src/blogpage.go b/src/blogpage.go new file mode 100644 index 0000000..cc65a70 --- /dev/null +++ b/src/blogpage.go @@ -0,0 +1,28 @@ +package main + +import "github.com/maxence-charriere/go-app/v9/pkg/app" + +type BlogPage struct { + app.Compo +} + +// TODO: write the backend API for this +// TODO: Find a proper way of rendering blog posts in markdown +// Backend ideas: In the DB, create an entry for each post and a link to where the html file is located! +// That way, I don't have to parse and render markdown!! + +// Layout, the leftbar contains the blogpost links and the mainbar contains the post itself! +// Function: After pressing a link for a blog post, that blog post ID gets put in the state instead of the URL + +func NewBlogPage() *BlogPage { + return &BlogPage{} +} + +func (b *BlogPage) Render() app.UI { + return newPage(). + Title("Blog"). + LeftBar( + newHTMLBlock(). + Class("left leftbarblock"), + ) +} diff --git a/src/guestbook.go b/src/guestbook.go index b82a538..8a2febd 100644 --- a/src/guestbook.go +++ b/src/guestbook.go @@ -162,7 +162,7 @@ func (g guestbook) Render() app.UI { func (g *guestbook) LoadComments(ctx app.Context) { // TODO: maybe you can put this in a localbrowser storage? - url := ApiURL + url := ApiURL + "/comment" ctx.Async(func() { res, err := http.Get(url) if err != nil { diff --git a/src/homepage.go b/src/homepage.go index 4cd52dc..9d752b7 100644 --- a/src/homepage.go +++ b/src/homepage.go @@ -53,7 +53,7 @@ func (p *Homepage) Render() app.UI { fmt.Printf("err: %v\n", err) return } - url := ApiURL + url := ApiURL + "/comment" ctx.Async(func() { req, err := http.Post(url, "application/json", bytes.NewBuffer(jsondata)) diff --git a/src/navbar.go b/src/navbar.go index bfb2e07..bffc452 100644 --- a/src/navbar.go +++ b/src/navbar.go @@ -20,11 +20,9 @@ func (n *navbar) Render() app.UI { app.Li().Body( app.A().Href("/galaxies").Text("Galaxies"), ), - app.Li(). - Style("display", "none"). - Body( - app.A().Href("/undertale").Text("Undertale"), - ), + app.Li().Body( + app.A().Href("/blog").Text("Blog"), + ), ), ).Class("navbar") } diff --git a/src/page.go b/src/page.go index f7856e4..c468750 100644 --- a/src/page.go +++ b/src/page.go @@ -11,8 +11,10 @@ type page struct { Blah blah etc*/ - IleftBar []app.UI - Imain []app.UI + IbackgroundClass string + Ibackground []app.UI + IleftBar []app.UI + Imain []app.UI // TODO: Possibly add "updateavailable" here, so it shows up on every page } @@ -21,6 +23,16 @@ func newPage() *page { return &page{} } +func (p *page) Background(v ...app.UI) *page { + p.Ibackground = app.FilterUIElems(v...) + return p +} + +func (p *page) BackgroundClass(t string) *page { + p.IbackgroundClass = app.AppendClass(p.IbackgroundClass, t) + return p +} + func (p *page) Title(t string) *page { p.Ititle = t return p @@ -37,25 +49,35 @@ func (p *page) Main(v ...app.UI) *page { } func (p *page) Render() app.UI { + if p.IbackgroundClass == "" { + p.IbackgroundClass = app.AppendClass(p.IbackgroundClass, "background") + } return app.Div(). - Class("main"). + Class(p.IbackgroundClass). Body( - // Header and navbar - &header{}, + app.Range(p.Ibackground).Slice(func(i int) app.UI { + return p.Ibackground[i] + }), app.Div(). - Class("left"). + Class("main"). Body( - &navbar{}, - app.Range(p.IleftBar).Slice(func(i int) app.UI { - return p.IleftBar[i] - }), - ), - app.Div(). - Class("right"). - Body( - app.Range(p.Imain).Slice(func(i int) app.UI { - return p.Imain[i] - }), + // Header and navbar + &header{}, + app.Div(). + Class("left"). + Body( + &navbar{}, + app.Range(p.IleftBar).Slice(func(i int) app.UI { + return p.IleftBar[i] + }), + ), + app.Div(). + Class("right"). + Body( + app.Range(p.Imain).Slice(func(i int) app.UI { + return p.Imain[i] + }), + ), ), ) } diff --git a/src/undertale.go b/src/undertale.go index a72aa77..e2fabdd 100644 --- a/src/undertale.go +++ b/src/undertale.go @@ -15,6 +15,8 @@ func NewUndertalePage() *UndertalePage { func (u *UndertalePage) Render() app.UI { return newPage(). Title("Undertale"). + BackgroundClass("undertale-bg"). + Background(). LeftBar( newHTMLBlock(). Class("left"). diff --git a/web/blocks/snippets/test.html b/web/blocks/snippets/test.html new file mode 100644 index 0000000..e69de29 diff --git a/web/static/images/ut-bg.webp b/web/static/images/ut-bg.webp new file mode 100644 index 0000000..60b05a1 Binary files /dev/null and b/web/static/images/ut-bg.webp differ diff --git a/web/static/style.css b/web/static/style.css index dcdbc55..d0f018d 100644 --- a/web/static/style.css +++ b/web/static/style.css @@ -1,16 +1,24 @@ html { - background-image: url(images/background_star.gif); overflow-y: scroll; + margin: 0px; + height: 100%; } body { - width: 900px; - position: relative; - margin-left: auto; - margin-right: auto; - color:aliceblue; - font-family: havakana; - font-size: 1.1em; + margin: 0px; + height: 100%; +} + +.background { + background-image: url(images/background_star.gif); + width: 100%; + position: absolute; +} + +.undertale-bg { + background-image: url(images/ut-bg.webp); + width: 100%; + position: sticky; } .header { @@ -35,6 +43,13 @@ body { .main { margin-top: 5px; + width: 900px; + position: relative; + margin-left: auto; + margin-right: auto; + color:aliceblue; + font-family: havakana; + font-size: 1.1em; } .navbar { @@ -109,6 +124,10 @@ body { padding: 10px; } +.no-border { + border: none; +} + .content-text { max-width: 75%; width: auto;