New editor score system and new user lists

This commit is contained in:
2018-03-10 16:42:39 +01:00
parent 4d5dd97da4
commit 9958364b92
10 changed files with 133 additions and 57 deletions

21
pages/users/editors.pixy Normal file
View File

@ -0,0 +1,21 @@
component EditorRankingList(users []*arn.User, url string)
h1.page-title Editor ranking list
UsersTabs(url)
table.ranking-list
thead
tr.mountable
th #
th User
th.ranking-score Score
tbody
for index, user := range users
tr.ranking.mountable
td= toString(index + 1) + "."
td.ranking-user
Avatar(user)
a.ajax(href=user.Link())= user.Nick
td.ranking-score= user.EditorScore()
.footer.mountable
p Score is generated from new data submissions and data fixes.

View File

@ -1,7 +1,6 @@
component OsuRankingList(users []*arn.User)
component OsuRankingList(users []*arn.User, url string)
h1.page-title osu! ranking list
UsersTabs
UsersTabs(url)
table.ranking-list
thead

View File

@ -1,7 +1,6 @@
component OverwatchRankingList(users []*arn.User)
component OverwatchRankingList(users []*arn.User, url string)
h1.page-title Overwatch ranking list
UsersTabs
UsersTabs(url)
table.ranking-list
thead

View File

@ -36,7 +36,55 @@ func Active(ctx *aero.Context) string {
return followersA > followersB
})
return ctx.HTML(components.Users(users))
return ctx.HTML(components.Users(users, ctx.URI()))
}
// Pro ...
func Pro(ctx *aero.Context) string {
users := arn.FilterUsers(func(user *arn.User) bool {
return user.IsPro()
})
sort.Slice(users, func(i, j int) bool {
return users[i].Registered > users[j].Registered
})
return ctx.HTML(components.ProUsers(users, ctx.URI()))
}
// Editors ...
func Editors(ctx *aero.Context) string {
score := map[string]int{}
users := []*arn.User{}
for entry := range arn.StreamEditLogEntries() {
entryScore := entry.EditorScore()
if entryScore == 0 {
continue
}
current, exists := score[entry.UserID]
if !exists {
users = append(users, entry.User())
}
score[entry.UserID] = current + entryScore
}
sort.Slice(users, func(i, j int) bool {
scoreA := score[users[i].ID]
scoreB := score[users[j].ID]
if scoreA == scoreB {
return users[i].Registered > users[j].Registered
}
return scoreA > scoreB
})
return ctx.HTML(components.EditorRankingList(users, ctx.URI()))
}
// ActiveNoAvatar ...
@ -66,7 +114,7 @@ func ActiveNoAvatar(ctx *aero.Context) string {
return followersA > followersB
})
return ctx.HTML(components.Users(users))
return ctx.HTML(components.Users(users, ctx.URI()))
}
// Osu ...
@ -84,7 +132,7 @@ func Osu(ctx *aero.Context) string {
users = users[:50]
}
return ctx.HTML(components.OsuRankingList(users))
return ctx.HTML(components.OsuRankingList(users, ctx.URI()))
}
// Overwatch ...
@ -102,7 +150,7 @@ func Overwatch(ctx *aero.Context) string {
users = users[:50]
}
return ctx.HTML(components.OverwatchRankingList(users))
return ctx.HTML(components.OverwatchRankingList(users, ctx.URI()))
}
// Staff ...
@ -156,5 +204,5 @@ func Staff(ctx *aero.Context) string {
editors,
}
return ctx.HTML(components.UserLists(userLists) + components.StaffRecruitment())
return ctx.HTML(components.UserLists(userLists, ctx.URI()) + components.StaffRecruitment())
}

View File

@ -1,17 +1,29 @@
component Users(users []*arn.User)
component Users(users []*arn.User, url string)
h1.page-title Users
UsersTabs
UsersTabs(url)
.user-avatars
each user in users
.mountable
Avatar(user)
component UserLists(groups []*utils.UserList)
h1.page-title Users
component ProUsers(users []*arn.User, url string)
h1.page-title Supporters
UsersTabs(url)
UsersTabs
.pro-avatars
each user in users
a.profile-image-container.mountable.ajax(href=user.Link())
ProfileImage(user)
.anime-grid-title
.anime-grid-title-text= user.Nick
.footer.mountable
p We are thankful to everyone supporting the site!
component UserLists(groups []*utils.UserList, url string)
h1.page-title Users
UsersTabs(url)
each group in groups
h3.user-list-name.mountable= group.Name
@ -28,10 +40,15 @@ component StaffRecruitment
br
a(href="https://discord.gg/0kimAmMCeXGXuzNF", target="_blank", rel="noopener") Interested in editing data?
component UsersTabs
component UsersTabs(url string)
.tabs
Tab("Active", "users", "/users")
//- Tab("No Avatar", "users", "/users/noavatar")
Tab("Osu", "gamepad", "/users/osu")
Tab("Overwatch", "overwatch", "/users/overwatch")
Tab("Staff", "user-secret", "/users/staff")
Tab("Games", "gamepad", "/users/games/osu")
Tab("Editors", "pencil", "/users/editors")
Tab("Supporters", "heart", "/users/pro")
Tab("Staff", "user-secret", "/users/staff")
if strings.Contains(url, "/users/games")
.tabs
Tab("Osu", "gamepad", "/users/games/osu")
Tab("Overwatch", "overwatch", "/users/games/overwatch")

View File

@ -6,6 +6,24 @@
.user-image
margin 0.4rem
.pro-avatars
horizontal-wrap
justify-content center
.profile-image-container
width 140px
height 140px
max-width 140px
max-height 140px
margin 0.4rem
position relative
border ui-border
box-shadow shadow-light
:hover
.anime-grid-title
opacity 1
.user
display flex