Sequels page is now linked on profiles

This commit is contained in:
2018-12-06 14:13:49 +09:00
parent 566b8f83cf
commit 7dfaa85a7a
8 changed files with 21 additions and 49 deletions

View File

@ -19,10 +19,6 @@ component ExploreAnime(animes []*arn.Anime, year string, season string, status s
a.button(href="/genres", title="View genres")
RawIcon("clone")
if user != nil
a.button(href="/explore/sequels", title="View sequels of my completed anime")
RawIcon("forward")
a.button(href="/explore/color/any/anime", title="View colors")
RawIcon("paint-brush")

View File

@ -1,4 +1,4 @@
component ExploreAnimeSequels(entries []*utils.AnimeWithRelatedAnime, user *arn.User)
component ExploreAnimeSequels(entries []*utils.AnimeWithRelatedAnime, viewUser *arn.User, user *arn.User)
h1 Sequels of my completed anime
.explore-anime

View File

@ -13,13 +13,20 @@ import (
// Sequels ...
func Sequels(ctx *aero.Context) string {
nick := ctx.Get("nick")
user := utils.GetUser(ctx)
if user == nil {
return ctx.Error(http.StatusUnauthorized, "Not logged in")
}
animeList := user.AnimeList()
viewUser, err := arn.GetUserByNick(nick)
if err != nil {
return ctx.Error(http.StatusNotFound, "User not found", err)
}
animeList := viewUser.AnimeList()
sequels := []*utils.AnimeWithRelatedAnime{}
for anime := range arn.StreamAnime() {
@ -56,5 +63,5 @@ func Sequels(ctx *aero.Context) string {
return aScore > bScore
})
return ctx.HTML(components.ExploreAnimeSequels(sequels, user))
return ctx.HTML(components.ExploreAnimeSequels(sequels, viewUser, user))
}