Few minor updates
This commit is contained in:
@ -35,6 +35,6 @@ func GetPostsByUser(ctx *aero.Context) string {
|
||||
postables[i] = arn.ToPostable(post)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.LatestPosts(postables, viewUser, utils.GetUser(ctx)))
|
||||
return ctx.HTML(components.LatestPosts(postables, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.User)
|
||||
ProfileHeader(viewUser, user)
|
||||
component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.User, uri string)
|
||||
ProfileHeader(viewUser, user, uri)
|
||||
|
||||
if len(postables) > 0
|
||||
h2.page-title= len(postables), " latest posts by ", postables[0].Author().Nick
|
||||
|
@ -1,6 +1,8 @@
|
||||
package profile
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/aerogo/flow"
|
||||
"github.com/animenotifier/arn"
|
||||
@ -36,7 +38,12 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||
}, func() {
|
||||
animeList = viewUser.AnimeList()
|
||||
animeList.PrefetchAnime()
|
||||
|
||||
// Sort by rating
|
||||
sort.Slice(animeList.Items, func(i, j int) bool {
|
||||
return animeList.Items[i].Rating.Overall > animeList.Items[j].Rating.Overall
|
||||
})
|
||||
})
|
||||
|
||||
return ctx.HTML(components.Profile(viewUser, user, animeList, threads, posts, tracks))
|
||||
return ctx.HTML(components.Profile(viewUser, user, animeList, threads, posts, tracks, ctx.URI()))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
component ProfileHeader(viewUser *arn.User, user *arn.User)
|
||||
component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
|
||||
.profile
|
||||
img.profile-cover(src=viewUser.CoverImageURL(), alt="Cover image")
|
||||
|
||||
@ -44,9 +44,9 @@ component ProfileHeader(viewUser *arn.User, user *arn.User)
|
||||
Icon("rocket")
|
||||
span= arn.Capitalize(viewUser.Role)
|
||||
|
||||
ProfileNavigation(viewUser)
|
||||
ProfileNavigation(viewUser, uri)
|
||||
|
||||
component ProfileNavigation(viewUser *arn.User)
|
||||
component ProfileNavigation(viewUser *arn.User, uri string)
|
||||
.buttons.tabs
|
||||
a.button.tab.action(href="/+" + viewUser.Nick, data-action="diff", data-trigger="click")
|
||||
Icon("th")
|
||||
@ -68,32 +68,33 @@ component ProfileNavigation(viewUser *arn.User)
|
||||
Icon("music")
|
||||
span.tab-text Tracks
|
||||
|
||||
//- StatusTabs("/+" + viewUser.Nick + "/animelist")
|
||||
//- if strings.Contains(uri, "/animelist")
|
||||
//- StatusTabs("/+" + viewUser.Nick + "/animelist")
|
||||
|
||||
component StatusTabs(urlPrefix string)
|
||||
.buttons.tabs
|
||||
a.button.tab.action(href=urlPrefix + "/watching", data-action="diff", data-trigger="click")
|
||||
.buttons.tabs.status-tabs
|
||||
a.button.status-tab.action(href=urlPrefix + "/watching", data-action="diff", data-trigger="click")
|
||||
Icon("play")
|
||||
span.tab-text Watching
|
||||
|
||||
a.button.tab.action(href=urlPrefix + "/completed", data-action="diff", data-trigger="click")
|
||||
a.button.status-tab.action(href=urlPrefix + "/completed", data-action="diff", data-trigger="click")
|
||||
Icon("check")
|
||||
span.tab-text Completed
|
||||
|
||||
a.button.tab.action(href=urlPrefix + "/planned", data-action="diff", data-trigger="click")
|
||||
a.button.status-tab.action(href=urlPrefix + "/planned", data-action="diff", data-trigger="click")
|
||||
Icon("forward")
|
||||
span.tab-text Planned
|
||||
|
||||
a.button.tab.action(href=urlPrefix + "/hold", data-action="diff", data-trigger="click")
|
||||
a.button.status-tab.action(href=urlPrefix + "/hold", data-action="diff", data-trigger="click")
|
||||
Icon("pause")
|
||||
span.tab-text On Hold
|
||||
|
||||
a.button.tab.action(href=urlPrefix + "/dropped", data-action="diff", data-trigger="click")
|
||||
a.button.status-tab.action(href=urlPrefix + "/dropped", data-action="diff", data-trigger="click")
|
||||
Icon("stop")
|
||||
span.tab-text Dropped
|
||||
|
||||
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack)
|
||||
ProfileHeader(viewUser, user)
|
||||
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack, uri string)
|
||||
ProfileHeader(viewUser, user, uri)
|
||||
|
||||
if len(animeList.Items) == 0
|
||||
p.no-data.mountable= viewUser.Nick + " hasn't added any anime yet."
|
||||
|
@ -27,5 +27,5 @@ func GetThreadsByUser(ctx *aero.Context) string {
|
||||
threads = threads[:maxThreads]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx)))
|
||||
return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User)
|
||||
ProfileHeader(viewUser, user)
|
||||
component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User, uri string)
|
||||
ProfileHeader(viewUser, user, uri)
|
||||
|
||||
if len(threads) == 0
|
||||
p.no-data.mountable= viewUser.Nick + " hasn't written any threads yet."
|
||||
|
@ -27,6 +27,6 @@ func GetSoundTracksByUser(ctx *aero.Context) string {
|
||||
|
||||
arn.SortSoundTracksLatestFirst(tracks)
|
||||
|
||||
return ctx.HTML(components.TrackList(tracks, viewUser, user))
|
||||
return ctx.HTML(components.TrackList(tracks, viewUser, user, ctx.URI()))
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
component TrackList(tracks []*arn.SoundTrack, viewUser *arn.User, user *arn.User)
|
||||
ProfileHeader(viewUser, user)
|
||||
component TrackList(tracks []*arn.SoundTrack, viewUser *arn.User, user *arn.User, uri string)
|
||||
ProfileHeader(viewUser, user, uri)
|
||||
|
||||
h2.page-title= "Tracks added by " + viewUser.Nick
|
||||
|
||||
|
@ -10,6 +10,15 @@
|
||||
height 78px !important
|
||||
border-radius 2px
|
||||
|
||||
// .status-tabs
|
||||
// position fixed
|
||||
// top 4.6rem
|
||||
// right 1.6rem
|
||||
// flex-direction column
|
||||
|
||||
// .status-tab
|
||||
// font-size 0.9rem
|
||||
|
||||
// < 380px
|
||||
// .profile-watching-list
|
||||
// justify-content center
|
Reference in New Issue
Block a user