diff --git a/pages/music/music.pixy b/pages/music/music.pixy index 337c632f..ad400e24 100644 --- a/pages/music/music.pixy +++ b/pages/music/music.pixy @@ -8,11 +8,14 @@ component Music(tracks []*arn.SoundTrack) .sound-tracks each track in tracks - .sound-track(id=track.ID) - a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID) - img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical) - - iframe.lazy(data-src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&visual=true") - .sound-track-footer - span posted by - a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick \ No newline at end of file + SoundTrack(track) + +component SoundTrack(track *arn.SoundTrack) + .sound-track(id=track.ID) + a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID) + img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical) + + iframe.lazy(data-src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&visual=true") + .sound-track-footer + span posted by + a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick \ No newline at end of file diff --git a/pages/profile/profile.go b/pages/profile/profile.go index c146f2ac..1c3fa464 100644 --- a/pages/profile/profile.go +++ b/pages/profile/profile.go @@ -9,6 +9,7 @@ import ( ) const maxPosts = 5 +const maxTracks = 5 // Get user profile page. func Get(ctx *aero.Context) string { @@ -27,6 +28,7 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string { var user *arn.User var threads []*arn.Thread var animeList *arn.AnimeList + var tracks []*arn.SoundTrack var posts []*arn.Post flow.Parallel(func() { @@ -48,7 +50,14 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string { if len(posts) > maxPosts { posts = posts[:maxPosts] } + }, func() { + tracks = viewUser.SoundTracks() + arn.SortSoundTracksLatestFirst(tracks) + + if len(tracks) > maxTracks { + tracks = tracks[:maxTracks] + } }) - return ctx.HTML(components.Profile(viewUser, user, animeList, threads, posts)) + return ctx.HTML(components.Profile(viewUser, user, animeList, threads, posts, tracks)) } diff --git a/pages/profile/profile.pixy b/pages/profile/profile.pixy index 3dcbd6b2..fee38873 100644 --- a/pages/profile/profile.pixy +++ b/pages/profile/profile.pixy @@ -44,7 +44,7 @@ component ProfileHeader(viewUser *arn.User, user *arn.User) Icon("rocket") span= arn.Capitalize(viewUser.Role) -component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post) +component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack) ProfileHeader(viewUser, user) .profile-category.mountable @@ -58,7 +58,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, each item in animeList.Items a.profile-watching-list-item.ajax(href=item.Anime().Link(), title=item.Anime().Title.Canonical + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")") img.anime-cover-image.profile-watching-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical) - + .profile-category.mountable h3 a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads @@ -68,6 +68,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, else each thread in threads ThreadLink(thread) + .profile-category.mountable h3 a.ajax(href="/+" + viewUser.Nick + "/posts", title="View all posts") Posts @@ -84,6 +85,16 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, .spacer .post-likes= len(post.Likes) + .profile-category.mountable + h3 Tracks + + if len(tracks) == 0 + p No soundtracks posted yet. + else + .sound-tracks + each track in tracks + SoundTrack(track) + //- if user != nil && user.Role == "admin" //- .footer //- a(href="/api/user/" + viewUser.ID) User API \ No newline at end of file