Added user lists

This commit is contained in:
2017-07-19 13:08:12 +02:00
parent cd6641cc06
commit e57e67610f
5 changed files with 131 additions and 16 deletions

View File

@ -22,7 +22,7 @@ component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
Icon("home")
a(href=viewUser.WebsiteURL(), target="_blank", rel="nofollow")= viewUser.WebsiteShortURL()
if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 1000
if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 100
p.profile-field.osu(title="osu! Level " + toString(int(viewUser.Accounts.Osu.Level)) + " | Accuracy: " + fmt.Sprintf("%.1f", viewUser.Accounts.Osu.Accuracy) + "%")
Icon("trophy")
a(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, target="_blank", rel="noopener")= toString(int(viewUser.Accounts.Osu.PP)) + " pp"

View File

@ -8,9 +8,42 @@ import (
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
users, err := arn.GetActiveUsersCached()
// Active ...
func Active(ctx *aero.Context) string {
users, err := arn.GetListOfUsersCached("active users")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
}
return ctx.HTML(components.Users(users))
}
// Osu ...
func Osu(ctx *aero.Context) string {
users, err := arn.GetListOfUsersCached("active osu users")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
}
return ctx.HTML(components.Users(users))
}
// Staff ...
func Staff(ctx *aero.Context) string {
users, err := arn.GetListOfUsersCached("active staff users")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
}
return ctx.HTML(components.Users(users))
}
// AnimeWatching ...
func AnimeWatching(ctx *aero.Context) string {
users, err := arn.GetListOfUsersCached("active anime watching users")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)

View File

@ -1,6 +1,23 @@
component Users(users []*arn.User)
h1.page-title Users
.buttons.tabs
a.button.tab.action(href="/users", data-action="diff", data-trigger="click")
Icon("users")
span Active
a.button.tab.action(href="/users/anime/watching", data-action="diff", data-trigger="click")
Icon("tv")
span Watching
a.button.tab.action(href="/users/osu", data-action="diff", data-trigger="click")
Icon("gamepad")
span Osu
a.button.tab.action(href="/users/staff", data-action="diff", data-trigger="click")
Icon("user-secret")
span Staff
.user-avatars
each user in users
Avatar(user)