Started working on blogposts
continuous-integration/drone/push Build is failing Details

This commit is contained in:
DutchEllie 2022-03-24 13:25:07 +01:00
parent 6b4c6bb447
commit acbdd113d4
Signed by: DutchEllie
SSH Key Fingerprint: SHA256:dKq6ZSgN5E3Viqrw/+xAdf2VdR6hdRGNyrYqXXwfjTY
11 changed files with 103 additions and 34 deletions

View File

@ -17,7 +17,7 @@ steps:
from_secret: docker_password from_secret: docker_password
repo: dutchellie/proper-website-2 repo: dutchellie/proper-website-2
build_args: build_args:
- APIURL=https://api.nicecock.eu/api/testingcomment - APIURL=https://api.nicecock.eu/api/testing
tags: tags:
- dev - dev
- ${DRONE_COMMIT_SHA:0:8} - ${DRONE_COMMIT_SHA:0:8}
@ -65,7 +65,7 @@ steps:
from_secret: docker_password from_secret: docker_password
repo: dutchellie/proper-website-2 repo: dutchellie/proper-website-2
build_args: build_args:
- APIURL=https://api.nicecock.eu/api/comment - APIURL=https://api.nicecock.eu/api
tags: tags:
- latest - latest
- ${DRONE_COMMIT_SHA:0:8} - ${DRONE_COMMIT_SHA:0:8}

0
src/bloglinks.go Normal file
View File

28
src/blogpage.go Normal file
View File

@ -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"),
)
}

View File

@ -162,7 +162,7 @@ func (g guestbook) Render() app.UI {
func (g *guestbook) LoadComments(ctx app.Context) { func (g *guestbook) LoadComments(ctx app.Context) {
// TODO: maybe you can put this in a localbrowser storage? // TODO: maybe you can put this in a localbrowser storage?
url := ApiURL url := ApiURL + "/comment"
ctx.Async(func() { ctx.Async(func() {
res, err := http.Get(url) res, err := http.Get(url)
if err != nil { if err != nil {

View File

@ -53,7 +53,7 @@ func (p *Homepage) Render() app.UI {
fmt.Printf("err: %v\n", err) fmt.Printf("err: %v\n", err)
return return
} }
url := ApiURL url := ApiURL + "/comment"
ctx.Async(func() { ctx.Async(func() {
req, err := http.Post(url, "application/json", bytes.NewBuffer(jsondata)) req, err := http.Post(url, "application/json", bytes.NewBuffer(jsondata))

View File

@ -20,11 +20,9 @@ func (n *navbar) Render() app.UI {
app.Li().Body( app.Li().Body(
app.A().Href("/galaxies").Text("Galaxies"), app.A().Href("/galaxies").Text("Galaxies"),
), ),
app.Li(). app.Li().Body(
Style("display", "none"). app.A().Href("/blog").Text("Blog"),
Body( ),
app.A().Href("/undertale").Text("Undertale"),
),
), ),
).Class("navbar") ).Class("navbar")
} }

View File

@ -11,8 +11,10 @@ type page struct {
Blah blah Blah blah
etc*/ etc*/
IleftBar []app.UI IbackgroundClass string
Imain []app.UI Ibackground []app.UI
IleftBar []app.UI
Imain []app.UI
// TODO: Possibly add "updateavailable" here, so it shows up on every page // TODO: Possibly add "updateavailable" here, so it shows up on every page
} }
@ -21,6 +23,16 @@ func newPage() *page {
return &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 { func (p *page) Title(t string) *page {
p.Ititle = t p.Ititle = t
return p return p
@ -37,25 +49,35 @@ func (p *page) Main(v ...app.UI) *page {
} }
func (p *page) Render() app.UI { func (p *page) Render() app.UI {
if p.IbackgroundClass == "" {
p.IbackgroundClass = app.AppendClass(p.IbackgroundClass, "background")
}
return app.Div(). return app.Div().
Class("main"). Class(p.IbackgroundClass).
Body( Body(
// Header and navbar app.Range(p.Ibackground).Slice(func(i int) app.UI {
&header{}, return p.Ibackground[i]
}),
app.Div(). app.Div().
Class("left"). Class("main").
Body( Body(
&navbar{}, // Header and navbar
app.Range(p.IleftBar).Slice(func(i int) app.UI { &header{},
return p.IleftBar[i] app.Div().
}), Class("left").
), Body(
app.Div(). &navbar{},
Class("right"). app.Range(p.IleftBar).Slice(func(i int) app.UI {
Body( return p.IleftBar[i]
app.Range(p.Imain).Slice(func(i int) app.UI { }),
return p.Imain[i] ),
}), app.Div().
Class("right").
Body(
app.Range(p.Imain).Slice(func(i int) app.UI {
return p.Imain[i]
}),
),
), ),
) )
} }

View File

@ -15,6 +15,8 @@ func NewUndertalePage() *UndertalePage {
func (u *UndertalePage) Render() app.UI { func (u *UndertalePage) Render() app.UI {
return newPage(). return newPage().
Title("Undertale"). Title("Undertale").
BackgroundClass("undertale-bg").
Background().
LeftBar( LeftBar(
newHTMLBlock(). newHTMLBlock().
Class("left"). Class("left").

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1,16 +1,24 @@
html { html {
background-image: url(images/background_star.gif);
overflow-y: scroll; overflow-y: scroll;
margin: 0px;
height: 100%;
} }
body { body {
width: 900px; margin: 0px;
position: relative; height: 100%;
margin-left: auto; }
margin-right: auto;
color:aliceblue; .background {
font-family: havakana; background-image: url(images/background_star.gif);
font-size: 1.1em; width: 100%;
position: absolute;
}
.undertale-bg {
background-image: url(images/ut-bg.webp);
width: 100%;
position: sticky;
} }
.header { .header {
@ -35,6 +43,13 @@ body {
.main { .main {
margin-top: 5px; margin-top: 5px;
width: 900px;
position: relative;
margin-left: auto;
margin-right: auto;
color:aliceblue;
font-family: havakana;
font-size: 1.1em;
} }
.navbar { .navbar {
@ -109,6 +124,10 @@ body {
padding: 10px; padding: 10px;
} }
.no-border {
border: none;
}
.content-text { .content-text {
max-width: 75%; max-width: 75%;
width: auto; width: auto;