Limit tracks

This commit is contained in:
Eduard Urbach 2017-06-27 14:04:25 +02:00
parent 976c964559
commit 2b471b871d
2 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,8 @@ import (
"github.com/animenotifier/notify.moe/components"
)
const maxTracks = 10
// Get renders the music page.
func Get(ctx *aero.Context) string {
tracks := []*arn.SoundTrack{}
@ -42,6 +44,10 @@ func Get(ctx *aero.Context) string {
CreatedBy: "4J6qpK1ve",
})
if len(tracks) > maxTracks {
tracks = tracks[:maxTracks]
}
sort.Slice(tracks, func(i, j int) bool {
return tracks[i].Created > tracks[j].Created
})

View File

@ -9,7 +9,7 @@
.sound-track-footer
text-align right
margin-bottom content-padding
margin-bottom 1rem
font-size 0.9em
span