Improved group join and leave

This commit is contained in:
Eduard Urbach 2018-11-22 11:13:39 +09:00
parent deba81e11f
commit da08f80247
4 changed files with 11 additions and 6 deletions

View File

@ -10,8 +10,8 @@ component GroupMembers(group *arn.Group, member *arn.GroupMember, user *arn.User
if member == nil
button.mountable.action(data-action="join", data-trigger="click")
Icon("user-plus")
span= fmt.Sprintf(`Join "%s"`, group.Name)
span Join group
else
button.mountable.action(data-action="leave", data-trigger="click")
Icon("user-times")
span= fmt.Sprintf(`Leave "%s"`, group.Name)
span Leave group

View File

@ -1,6 +1,7 @@
component Groups(groups []*arn.Group, nextIndex int, user *arn.User)
.tabs
Tab("Groups", "users", "/groups")
Tab("Latest", "users", "/groups")
Tab("Popular", "globe", "/groups/popular")
h1.page-title Groups

View File

@ -9,8 +9,8 @@ import (
)
const (
groupsFirstLoad = 12
groupsPerScroll = 9
groupsFirstLoad = 24
groupsPerScroll = 12
)
// render renders the groups page with the given groups.

View File

@ -2,6 +2,10 @@ import AnimeNotifier from "scripts/AnimeNotifier"
// join
export async function join(arn: AnimeNotifier, element: HTMLElement) {
if(!confirm(`Are you sure you want to join this group?`)) {
return
}
arn.statusMessage.showInfo("Joined group!", 1000)
let apiEndpoint = arn.findAPIEndpoint(element)
@ -15,7 +19,7 @@ export async function join(arn: AnimeNotifier, element: HTMLElement) {
// leave
export async function leave(arn: AnimeNotifier, element: HTMLElement) {
if(!confirm(`Are you sure you want to leave the group?`)) {
if(!confirm(`Are you sure you want to leave this group?`)) {
return
}