Improved exploration

This commit is contained in:
2017-07-01 02:14:14 +02:00
parent 10ef00a810
commit 750302b60e
11 changed files with 114 additions and 67 deletions

View File

@ -1,20 +1,21 @@
package explore
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get search page.
// Get ...
func Get(ctx *aero.Context) string {
animeList, err := arn.GetPopularAnimeCached()
var cache arn.ListOfIDs
err := arn.DB.GetObject("Cache", "airing anime", &cache)
airing, err := arn.GetAiringAnimeCached()
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching popular anime", err)
return ctx.Error(500, "Couldn't fetch airing anime", err)
}
return ctx.HTML(components.ExploreAnime(nil, nil, animeList))
return ctx.HTML(components.Airing(airing))
}

View File

@ -1,9 +1,3 @@
component ExploreAnime(overall []*arn.Anime, story []*arn.Anime, airing []*arn.Anime)
h2 Highest Rating
AnimeGrid(overall)
h2 Best Story
AnimeGrid(story)
h2 Currently Airing
AnimeGrid(airing)
component Airing(animeList []*arn.Anime)
h2.page-title(title=toString(len(animeList)) + " anime") Explore
AnimeGrid(animeList)