New dashboard idea (still not happy though)
This commit is contained in:
@ -1,11 +1,28 @@
|
||||
package dashboard
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
const maxPosts = 6
|
||||
|
||||
// Get ...
|
||||
func Get(ctx *aero.Context) string {
|
||||
return ctx.HTML(components.Dashboard())
|
||||
posts, err := arn.GetPosts()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(500, "Error fetching posts")
|
||||
}
|
||||
|
||||
sort.Sort(sort.Reverse(posts))
|
||||
|
||||
if len(posts) > maxPosts {
|
||||
posts = posts[:maxPosts]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Dashboard(posts))
|
||||
}
|
||||
|
@ -1,4 +1,12 @@
|
||||
component Dashboard
|
||||
component Dashboard(posts []*arn.Post)
|
||||
section
|
||||
header
|
||||
h2 Dash
|
||||
h2 Dash
|
||||
|
||||
.dashboard-widget
|
||||
each post in posts
|
||||
a.dashboard-event.ui.ajax(href=post.Link())
|
||||
.dashboard-event-author
|
||||
AvatarNoLink(post.Author())
|
||||
.dashboard-event-text
|
||||
span= post.Thread().Title
|
23
pages/dashboard/dashboard.styl
Normal file
23
pages/dashboard/dashboard.styl
Normal file
@ -0,0 +1,23 @@
|
||||
.dashboard-widget
|
||||
display flex
|
||||
flex-flow column
|
||||
align-items center
|
||||
|
||||
.dashboard-event
|
||||
display flex
|
||||
flex-flow column wrap
|
||||
margin-bottom 1rem
|
||||
padding 0.75rem
|
||||
width 100%
|
||||
max-width 700px
|
||||
|
||||
.dashboard-event-author
|
||||
display flex
|
||||
justify-content center
|
||||
width 100%
|
||||
|
||||
.dashboard-event-text
|
||||
display flex
|
||||
justify-content center
|
||||
align-items center
|
||||
width 100%
|
Reference in New Issue
Block a user