From 2b471b871d071f153de8af012c20053e6c15156f Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 27 Jun 2017 14:04:25 +0200 Subject: [PATCH] Limit tracks --- pages/music/music.go | 6 ++++++ pages/music/music.scarlet | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pages/music/music.go b/pages/music/music.go index 061a1d5a..66ced1d2 100644 --- a/pages/music/music.go +++ b/pages/music/music.go @@ -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 }) diff --git a/pages/music/music.scarlet b/pages/music/music.scarlet index f648ed36..66ab4050 100644 --- a/pages/music/music.scarlet +++ b/pages/music/music.scarlet @@ -9,7 +9,7 @@ .sound-track-footer text-align right - margin-bottom content-padding + margin-bottom 1rem font-size 0.9em span