UI improvements
This commit is contained in:
32
pages/animelist/animelist.go
Normal file
32
pages/animelist/animelist.go
Normal file
@ -0,0 +1,32 @@
|
||||
package animelist
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
// Get anime list.
|
||||
func Get(ctx *aero.Context) string {
|
||||
nick := ctx.Get("nick")
|
||||
viewUser, err := arn.GetUserByNick(nick)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusNotFound, "User not found", err)
|
||||
}
|
||||
|
||||
animeList := viewUser.AnimeList()
|
||||
|
||||
if animeList == nil {
|
||||
return ctx.Error(http.StatusNotFound, "Anime list not found", err)
|
||||
}
|
||||
|
||||
sort.Slice(animeList.Items, func(i, j int) bool {
|
||||
return animeList.Items[i].FinalRating() < animeList.Items[j].FinalRating()
|
||||
})
|
||||
|
||||
return ctx.HTML(components.AnimeList(animeList))
|
||||
}
|
13
pages/animelist/animelist.pixy
Normal file
13
pages/animelist/animelist.pixy
Normal file
@ -0,0 +1,13 @@
|
||||
component AnimeList(animeList *arn.AnimeList)
|
||||
table.anime-list
|
||||
thead
|
||||
tr
|
||||
th Anime
|
||||
th Progress
|
||||
th Rating
|
||||
tbody
|
||||
each item in animeList.Items
|
||||
tr.anime-list-item
|
||||
td= item.Anime().Title.Canonical
|
||||
td= toString(item.Episodes) + " / " + item.Anime().EpisodeCountString()
|
||||
td= item.FinalRating()
|
2
pages/animelist/animelist.scarlet
Normal file
2
pages/animelist/animelist.scarlet
Normal file
@ -0,0 +1,2 @@
|
||||
.anime-list
|
||||
//
|
Reference in New Issue
Block a user