diff --git a/package.json b/package.json index c9b1e734..2286a8b9 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "gh-pages": "^3.2.3", "moment": "^2.29.1", "moment-timezone": "^0.5.34", + "svelecte": "^3.4.5", "svelte-autosize": "^1.0.1", "svelte-icons": "^2.1.0", "svelte-navigator": "^3.1.5", diff --git a/src/api/group.ts b/src/api/group.ts index 63582f35..634e4fad 100644 --- a/src/api/group.ts +++ b/src/api/group.ts @@ -16,6 +16,7 @@ export default class Group { color?: string; privacy?: GroupPrivacy; created?: string; + members?: string[]; constructor(data: any) { this.id = data.id; @@ -27,6 +28,7 @@ export default class Group { this.banner = data.banner; this.color = data.color; this.created = data.created; + this.members = data.members; if (data.privacy) { this.privacy = {} this.privacy.description_privacy = data.privacy.description_privacy; diff --git a/src/api/index.ts b/src/api/index.ts index a46f5290..e4a57f68 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -14,7 +14,7 @@ export default class PKAPI { GET_SYSTEM: (sid?: string) => sid ? `/systems/${sid}` : `/systems/@me`, GET_MEMBER_LIST: (sid?: string) => sid ? `/systems/${sid}/members` : `/systems/@me/members`, GET_MEMBER: (mid: string) => `/members/${mid}`, - GET_GROUP_LIST: (sid?: string) => sid ? `/systems/${sid}/groups` : `/systems/@me/groups`, + GET_GROUP_LIST: (sid?: string, members?: boolean) => `${sid ? `/systems/${sid}/groups` : `/systems/@me/groups`}` + `${members ? `?with_members=true` : ""}`, PATCH_SYSTEM: () => `/systems/@me`, @@ -115,14 +115,16 @@ export default class PKAPI { return member; } - async getGroupList(options: {token?: string, id?: any}) { + async getGroupList(options: {token?: string, id?: any, members?: boolean}) { if (!options.token && !options.id) { throw new Error("Must pass a token or id."); } + if (!options.members) options.members = false; + var groups: Group[] = []; var res: AxiosResponse; try { - res = await this.handle(this.ROUTES.GET_GROUP_LIST(options.id ? options.id : ""), 'GET', {token: !options.id ? options.token : ""}); + res = await this.handle(this.ROUTES.GET_GROUP_LIST(options.id ? options.id : "", options.members), 'GET', {token: !options.id ? options.token : ""}); if (res.status === 200) { let resObject: any = res.data; resObject.forEach(g => { diff --git a/src/lib/group/List.svelte b/src/lib/group/List.svelte index 55ab605b..d35e4572 100644 --- a/src/lib/group/List.svelte +++ b/src/lib/group/List.svelte @@ -1,18 +1,25 @@ @@ -165,7 +202,7 @@ {#if !isPublic} - + Only show @@ -177,6 +214,18 @@ {/if} + {#if !isPublic} +
+ + + + memberSearchMode = "include"}>{@html memberSearchMode === "include" ? "include" : "include"} + | memberSearchMode = "exclude"}>{@html memberSearchMode === "exclude" ? "exclude" : "exclude"} + | memberSearchMode = "match"}>{@html memberSearchMode === "match" ? "exact match" : "exact match"} + Includes every group with any of the members. + Excludes every group with any of the members, opposite of include. + Only includes groups which have all the members selected. + {/if} @@ -204,6 +253,7 @@ + {/each} diff --git a/src/lib/member/List.svelte b/src/lib/member/List.svelte index b67d497f..fae09c24 100644 --- a/src/lib/member/List.svelte +++ b/src/lib/member/List.svelte @@ -1,5 +1,5 @@ @@ -166,7 +200,7 @@
{#if !isPublic} - + Only show @@ -178,6 +212,18 @@ {/if} + {#if !isPublic} +
+ + + + groupSearchMode = "include"}>{@html groupSearchMode === "include" ? "include" : "include"} + | groupSearchMode = "exclude"}>{@html groupSearchMode === "exclude" ? "exclude" : "exclude"} + | groupSearchMode = "match"}>{@html groupSearchMode === "match" ? "exact match" : "exact match"} + Includes every member who's a part of any of the groups. + Excludes every member who's a part of any of the groups, the opposite of include. + Only includes members who are a part of every group. + {/if} diff --git a/src/pages/Dash.svelte b/src/pages/Dash.svelte index 981c1c27..b536eb0f 100644 --- a/src/pages/Dash.svelte +++ b/src/pages/Dash.svelte @@ -86,10 +86,10 @@ - + - + diff --git a/src/pages/profiles/Main.svelte b/src/pages/profiles/Main.svelte index a0102390..5c5e1142 100644 --- a/src/pages/profiles/Main.svelte +++ b/src/pages/profiles/Main.svelte @@ -7,6 +7,7 @@ import PKAPI from '../../api'; import Sys from '../../api/system'; import MemberList from '../../lib/member/List.svelte'; + import GroupList from '../../lib/group/List.svelte'; let isPublic = true; @@ -63,7 +64,10 @@ - + + + + {/if} diff --git a/style.css b/style.css index 146fd46c..9fe2ed87 100644 --- a/style.css +++ b/style.css @@ -65,6 +65,23 @@ blockquote { justify-content: center !important; } +.page-link { + z-index: initial !important; +} + +.svelecte-control .sv-control, .sv-content, .sv-dropdown, .sv-item, .sv-item-content { + color: var(--bs-body-color) !important; + background-color: var(--bs-body-bg) !important; +} + +.sv-item-btn { + background-color: var(--bs-light) !important; +} + +.sv-item { + cursor: pointer !important; +} + .d-spoiler { color: var(--bs-dark); background-color: var(--bs-dark); @@ -88,6 +105,10 @@ blockquote { width: auto; } +code { + color: var(--bs-body-color) !important; +} + .description a { text-decoration: none; color: #457ead !important; diff --git a/yarn.lock b/yarn.lock index bf11dedd..ac375626 100644 --- a/yarn.lock +++ b/yarn.lock @@ -937,6 +937,13 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +svelecte@^3.4.5: + version "3.4.5" + resolved "https://registry.yarnpkg.com/svelecte/-/svelecte-3.4.5.tgz#31ee09194030693d16501cb0031ba50fe5d0dada" + integrity sha512-HVva//rlRWg5Ck2iOuHuIVYrMATxZ7D1Kr91HLpMRbPfnqqAPFto6twwJ3XvBE+O9GD/kMzcYDwQULZ0sx3w1w== + dependencies: + svelte-tiny-virtual-list "^1.1.7" + svelte-autosize@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/svelte-autosize/-/svelte-autosize-1.0.1.tgz#2121b2373ab89191a58aaa9a3aec957ca475e812" @@ -988,6 +995,11 @@ svelte-preprocess@^4.0.0, svelte-preprocess@^4.9.8: sorcery "^0.10.0" strip-indent "^3.0.0" +svelte-tiny-virtual-list@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/svelte-tiny-virtual-list/-/svelte-tiny-virtual-list-1.1.7.tgz#7ba8ee1fc23372512de2aba50d9674972a35c6f7" + integrity sha512-8314cmLXOVqIQwSc3NFu8yGU7BdHEJeixrwFirmnMoWl6YNcCq5jVjCKjE3tDNJfUenz1LN5M5YshPt6GcPuww== + svelte-toggle@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/svelte-toggle/-/svelte-toggle-3.1.0.tgz#bce1efb71fb96ab3921374023c95ffd3ad5cbf3d"