Improved explore page

This commit is contained in:
2017-11-12 11:18:16 +01:00
parent 54193978fe
commit d17376e5a7
8 changed files with 34 additions and 38 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
const (
@ -26,8 +27,9 @@ func Get(ctx *aero.Context) string {
status := "current"
typ := "tv"
results := filterAnime(year, status, typ)
user := utils.GetUser(ctx)
return ctx.HTML(components.ExploreAnime(results, year, status, typ))
return ctx.HTML(components.ExploreAnime(results, year, status, typ, user))
}
// Filter ...
@ -35,10 +37,11 @@ func Filter(ctx *aero.Context) string {
year := ctx.Get("year")
status := ctx.Get("status")
typ := ctx.Get("type")
user := utils.GetUser(ctx)
results := filterAnime(year, status, typ)
return ctx.HTML(components.ExploreAnime(results, year, status, typ))
return ctx.HTML(components.ExploreAnime(results, year, status, typ, user))
}
func filterAnime(year, status, typ string) []*arn.Anime {

View File

@ -1,4 +1,4 @@
component ExploreAnime(animeList []*arn.Anime, year string, status string, typ string)
component ExploreAnime(animeList []*arn.Anime, year string, status string, typ string, user *arn.User)
ExploreFilters(year, status, typ)
h1.page-title Explore
@ -6,7 +6,7 @@ component ExploreAnime(animeList []*arn.Anime, year string, status string, typ s
if len(animeList) == 0
p.no-data.mountable No anime found using the above filters.
else
AnimeGrid(animeList)
AnimeGrid(animeList, user)
component ExploreFilters(year string, status string, typ string)
.explore-filters