New dashboard idea (still not happy though)

This commit is contained in:
2016-11-22 12:34:59 +09:00
parent 4159525c25
commit 80506aa92e
18 changed files with 192 additions and 79 deletions

30
pages/search/search.go Normal file
View File

@ -0,0 +1,30 @@
package search
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
titleCount := 0
animeCount := 0
// let info: any = await bluebird.props({
// popular: arn.db.get('Cache', 'popularAnime'),
// stats: arn.db.get('Cache', 'animeStats')
// })
// return response.render({
// user,
// popularAnime: info.popular.anime,
// animeCount: info.stats.animeCount,
// titleCount: info.stats.titleCount,
// anime: null
// })
popular, _ := arn.GetPopularCache()
return ctx.HTML(components.Search(popular.Anime, titleCount, animeCount))
}

16
pages/search/search.pixy Normal file
View File

@ -0,0 +1,16 @@
component Search(popularAnime []*arn.Anime, titleCount int, animeCount int)
h2 Anime
#search-container
input#search(type="text", placeholder="Search...", onkeyup="$.searchAnime();", onfocus="this.select();", disabled="disabled", data-count=titleCount, data-anime-count=animeCount)
#search-results-container
#search-results
if popularAnime != nil
h3.popular-title Popular
.popular-anime-list
each anime in popularAnime
a.popular-anime.ajax(href="/anime/" + toString(anime.ID), title=anime.Title.Romaji + " (" + arn.Plural(anime.Watching, "user") + " watching)")
img.anime-image.popular-anime-image(src=anime.Image, alt=anime.Title.Romaji)

2
pages/search/search.styl Normal file
View File

@ -0,0 +1,2 @@
.popular-title
text-align center