diff --git a/dashboard/src/App.svelte b/dashboard/src/App.svelte index bca3a6ae..ac324263 100644 --- a/dashboard/src/App.svelte +++ b/dashboard/src/App.svelte @@ -15,6 +15,7 @@ import DiscordLogin from "./pages/DiscordLogin.svelte"; import { onMount } from 'svelte'; import BulkGroupPrivacy from "./pages/BulkGroupPrivacy.svelte"; import BulkMemberPrivacy from "./pages/BulkMemberPrivacy.svelte"; + import Random from './pages/Random.svelte'; // theme cdns (I might make some myself too) // if there's a style already set, retrieve it @@ -38,8 +39,6 @@ import BulkMemberPrivacy from "./pages/BulkMemberPrivacy.svelte"; }; }; - let falseBool = false; - onMount(() => { let settings = JSON.parse(localStorage.getItem("pk-settings")); @@ -55,21 +54,29 @@ import BulkMemberPrivacy from "./pages/BulkMemberPrivacy.svelte"; - - + + + + + +
- + Please provide a system ID in the URL. + + + Please provide a member ID in the URL. + Please provide a group ID in the URL. diff --git a/dashboard/src/lib/group/Body.svelte b/dashboard/src/lib/group/Body.svelte index eb78b24b..6d280180 100644 --- a/dashboard/src/lib/group/Body.svelte +++ b/dashboard/src/lib/group/Body.svelte @@ -104,25 +104,50 @@ {/if} -
+
Description:
{@html htmlDescription && htmlDescription}
{#if (group.banner && ((settings && settings.appearance.banner_bottom) || !settings))} group banner {/if} + {#if !isPublic} - -{#if isMainDash}{/if} -{/if} -{#if !isPage} - - {:else if !isPublic} - + + {#if isMainDash} + {/if} +{/if} + +{#if !isPage} + + {:else if !isPublic} + +{/if} + + {:else if editMode} {:else if memberMode} {/if} - \ No newline at end of file + + + \ No newline at end of file diff --git a/dashboard/src/lib/list/ListControl.svelte b/dashboard/src/lib/list/ListControl.svelte index 008d5500..cb080f7d 100644 --- a/dashboard/src/lib/list/ListControl.svelte +++ b/dashboard/src/lib/list/ListControl.svelte @@ -3,6 +3,7 @@ import { Card, CardHeader, CardBody, CardTitle, Alert, Accordion, AccordionItem, import FaSearch from 'svelte-icons/fa/FaSearch.svelte' import Svelecte, { addFormatter } from 'svelecte'; import { Member, Group } from '../../api/types'; +import { Link, useParams } from 'svelte-navigator'; export let list: Member[] | Group[] = []; @@ -24,6 +25,9 @@ let selectedGroups = []; export let currentPage: number; export let isPublic: boolean; +let params = useParams(); +$: systemId = $params.id; + $: {searchValue; privacyFilter; currentPage = 1}; // converting list to any[] avoids a "this expression is not calleable" error @@ -143,6 +147,19 @@ function memberListRenderer(item: any) { addFormatter({ 'member-list': memberListRenderer }); + +function getRandomizerUrl(): string { + let str: string; + if (isPublic) str = `/profile/s/${systemId}/random` + else str = "/dash/random"; + + if (itemType === "group") str += "/g"; + return str; +} + +function capitalizeFirstLetter(string: string) { + return string.charAt(0).toUpperCase() + string.slice(1); +} @@ -210,6 +227,9 @@ addFormatter({ {/if} + + + {#if !isPublic}
@@ -220,14 +240,29 @@ addFormatter({ {/if} - groupSearchMode = "include"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "include" : ""} tabindex={0}>{@html groupSearchMode === "include" ? "include" : "include"} - | groupSearchMode = "exclude"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "exclude" : ""} tabindex={0}>{@html groupSearchMode === "exclude" ? "exclude" : "exclude"} - | groupSearchMode = "match"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "match" : ""} tabindex={0}>{@html groupSearchMode === "match" ? "exact match" : "exact match"} - | groupSearchMode = "none"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "none" : ""} tabindex={0}>{@html groupSearchMode === "none" ? "none" : "none"} - Includes every member who's a part of any of the groups. +
+ groupSearchMode = "include"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "include" : ""} tabindex={0}>{@html groupSearchMode === "include" ? "include" : "include"} + | groupSearchMode = "exclude"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "exclude" : ""} tabindex={0}>{@html groupSearchMode === "exclude" ? "exclude" : "exclude"} + | groupSearchMode = "match"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "match" : ""} tabindex={0}>{@html groupSearchMode === "match" ? "exact match" : "exact match"} + | groupSearchMode = "none"} on:keyup={e => e.key === "Enter" ? groupSearchMode = "none" : ""} tabindex={0}>{@html groupSearchMode === "none" ? "none" : "none"} +
+ 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. Only includes members that are in no groups. {/if} -
\ No newline at end of file + + + \ No newline at end of file diff --git a/dashboard/src/pages/Random.svelte b/dashboard/src/pages/Random.svelte new file mode 100644 index 00000000..5ef554bb --- /dev/null +++ b/dashboard/src/pages/Random.svelte @@ -0,0 +1,291 @@ + + + + + + + + +
+ +
Randomize {capitalizeFirstLetter(type)}s {isPublic && id ? `(${id})` : pickFromGroup ? `(${groupId})` : ""}
+
+ + + + + + + + + + + + + + + + + + + + {#if !isPublic} + + + + + + + + {/if} + + + + + + +
+ {#if loading} + loading... + {:else if err} + {err} + {:else} + {#if !openByDefault && (settings && settings.accessibility ? (!settings.accessibility.expandedcards && !settings.accessibility.pagelinks) : true)} + + {#each randomList as item, index (item.id + index)} + + +
+ {#if isPublic || item.privacy.visibility === "public"} + {#if type === "member"} + + {:else if type === "group"} + + {/if} + {:else} + + {/if} +
+
+ {#if type === "member"} + + {:else if type === "group"} + + {/if} +
+ {/each} +
+ {:else if openByDefault || settings.accessibility.expandedcards} + {#each randomList as item, index (item.id + index)} + + + +
+ {#if isPublic || item.privacy.visibility === "public"} + {#if type === "member"} + + {:else if type === "group"} + + {/if} + {:else} + + {/if} +
+
+
+ + {#if type === "member"} + + {:else if type === "group"} + + {/if} + +
+ {/each} + {:else} +
+ {#each randomList as item, index (item.id + index)} + + + +
+ {#if isPublic || item.privacy.visibility === "public"} + {#if type === "member"} + + {:else if type === "group"} + + {/if} + {:else} + + {/if} +
+
+ +
+ {/each} +
+ {/if} + {/if} + +
+
\ No newline at end of file