Added Hall of Fame
This commit is contained in:
65
pages/explore/halloffame/halloffame.go
Normal file
65
pages/explore/halloffame/halloffame.go
Normal file
@ -0,0 +1,65 @@
|
||||
package halloffame
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Get ...
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
maxYear := time.Now().Year() - 1
|
||||
hallOfFameEntries := []*utils.HallOfFameEntry{}
|
||||
|
||||
animes := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||
if len(anime.StartDate) < 4 {
|
||||
return false
|
||||
}
|
||||
|
||||
if anime.StartDateTime().Year() > maxYear {
|
||||
return false
|
||||
}
|
||||
|
||||
if anime.Status != "finished" {
|
||||
return false
|
||||
}
|
||||
|
||||
if anime.Type != "tv" {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
arn.SortAnimeByQuality(animes)
|
||||
|
||||
yearsAdded := map[int]bool{}
|
||||
|
||||
for _, anime := range animes {
|
||||
year := anime.StartDateTime().Year()
|
||||
|
||||
_, exists := yearsAdded[year]
|
||||
|
||||
if exists {
|
||||
continue
|
||||
}
|
||||
|
||||
hallOfFameEntries = append(hallOfFameEntries, &utils.HallOfFameEntry{
|
||||
Year: year,
|
||||
Anime: anime,
|
||||
})
|
||||
|
||||
yearsAdded[year] = true
|
||||
}
|
||||
|
||||
sort.Slice(hallOfFameEntries, func(i, j int) bool {
|
||||
return hallOfFameEntries[i].Year > hallOfFameEntries[j].Year
|
||||
})
|
||||
|
||||
return ctx.HTML(components.HallOfFame(hallOfFameEntries, user))
|
||||
}
|
13
pages/explore/halloffame/halloffame.pixy
Normal file
13
pages/explore/halloffame/halloffame.pixy
Normal file
@ -0,0 +1,13 @@
|
||||
component HallOfFame(entries []*utils.HallOfFameEntry, user *arn.User)
|
||||
h1.hall-of-fame-page-title Hall of Fame
|
||||
.footer Best TV series for each year.
|
||||
|
||||
.hall-of-fame
|
||||
each entry in entries
|
||||
.hall-of-fame-entry
|
||||
.hall-of-fame-anime
|
||||
AnimeImageLink(entry.Anime, "large", user)
|
||||
a.hall-of-fame-footer(href="/explore/anime/" + strconv.Itoa(entry.Year) + "/finished/tv", title="Best TV series " + strconv.Itoa(entry.Year))
|
||||
.hall-of-fame-trophy
|
||||
Icon("trophy")
|
||||
.hall-of-fame-year= entry.Year
|
52
pages/explore/halloffame/halloffame.scarlet
Normal file
52
pages/explore/halloffame/halloffame.scarlet
Normal file
@ -0,0 +1,52 @@
|
||||
.hall-of-fame
|
||||
horizontal-wrap
|
||||
justify-content center
|
||||
margin-top calc(content-padding * 2)
|
||||
|
||||
.hall-of-fame-page-title
|
||||
margin-bottom 0
|
||||
|
||||
.hall-of-fame-entry
|
||||
vertical
|
||||
padding content-padding
|
||||
margin-bottom content-padding
|
||||
|
||||
.hall-of-fame-footer
|
||||
horizontal
|
||||
justify-content center
|
||||
align-items center
|
||||
font-weight bold
|
||||
letter-spacing 1px
|
||||
padding 1rem
|
||||
border-bottom ui-border
|
||||
border-bottom-left-radius 50%
|
||||
border-bottom-right-radius 50%
|
||||
|
||||
:hover
|
||||
background reverse-light-color
|
||||
|
||||
.hall-of-fame-trophy
|
||||
font-size 2.5rem
|
||||
|
||||
.hall-of-fame-year
|
||||
font-size 1.5rem
|
||||
color text-color
|
||||
opacity 0.85
|
||||
text-shadow none
|
||||
|
||||
.hall-of-fame-anime
|
||||
saturate-up
|
||||
shadow-up
|
||||
default-transition
|
||||
position relative
|
||||
width anime-image-large-width
|
||||
height anime-image-large-height
|
||||
border-radius ui-element-border-radius
|
||||
|
||||
.anime-grid-title
|
||||
font-size 1.2rem
|
||||
padding 1rem 0.75rem
|
||||
|
||||
:hover
|
||||
.anime-grid-title
|
||||
opacity 1
|
Reference in New Issue
Block a user