diff --git a/dashboard/src/lib/group/CardView.svelte b/dashboard/src/lib/group/CardView.svelte
new file mode 100644
index 00000000..c30edea9
--- /dev/null
+++ b/dashboard/src/lib/group/CardView.svelte
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+
+
+ {@html htmlName} ({group.id})
+
+
+
+ {#if view === "card"}
+
{if (event.key === "Enter") {avatarOpen = true}}} on:click={toggleAvatarModal} class="rounded avatar mx-auto w-100 h-auto mb-2" src={icon_url_resized} alt={altText}/>
+
+
+
+
+
+ {#if group.display_name}
+
{@html htmlDisplayName}
+ {/if}
+
+
+ {@html htmlDesc}
+
+
+
+
+ {#if !isPublic} {view = "edit"}} id={`group-${group.uuid}-edit-button-card`}> {/if}
+
+
+ {#if !isPublic && isDash} {view = "groups"}} id={`group-${group.uuid}-groups-button-card`}> {/if}
+
+
+
+
+ {#if !isPublic}Edit group {/if}
+ {#if !isPublic && isDash}View members {/if}
+ View page
+
+ {:else if view === "groups"}
+ {#if memberList.length > 0}
+
Members
+
+
+ {#each memberList as member, index (member.id)}
+ {@html toHTML(member.name)} ({member.id}
)
+ {/each}
+
+ {:else}
+
This group has no members.
+ {/if}
+
+
+
+ {view = "edit"}} id={`group-${group.uuid}-edit-button-groups`}>
+
+
+ {view = "card"}} id={`group-${group.uuid}-back-button-groups`}>
+
+
+
+
+ Edit group
+ Back to info
+ View page
+
+ {:else if view === "edit"}
+
Name:
+
+
Icon url:
+
+
+
Display name:
+
+
+
Description:
+
+
+
Color:
+
+
+
+
+
+ input.color = e.target.value.slice(1, 7)} type="color" aria-label="color picker" />
+
+
+
+ {#if success}
+
group edited!
+ {/if}
+ {#if err}
+ {#each err as errorMessage}
+
{@html errorMessage}
+ {/each}
+ {/if}
+
+
+ {view = "card"}} id={`group-${group.uuid}-back-button-edit`}>
+
+
+
+
+
+
+ Go back
+ Submit edit
+
+ {/if}
+
+
+
+
\ No newline at end of file
diff --git a/dashboard/src/lib/list/CardView.svelte b/dashboard/src/lib/list/CardView.svelte
new file mode 100644
index 00000000..fd4ad9cd
--- /dev/null
+++ b/dashboard/src/lib/list/CardView.svelte
@@ -0,0 +1,96 @@
+
+
+
+ {#if itemType === "member"}
+ {#each list as item (item.uuid)}
+
+
+ copyShortLink(item.uuid, item.id)} on:keydown={(e) => copyShortLink(item.uuid, item.id, e)} tabindex={0} >
+ {#if item.privacy && item.privacy.visibility === "private"}
+
+ {:else}
+
+ {/if}
+
+
+
{copiedItems[item.uuid] ? "Copied!" : "Copy public link"}
+
+ {/each}
+ {:else if itemType === "group"}
+ {#each list as item (item.uuid)}
+
+
+ copyShortLink(item.uuid, item.id)} on:keydown={(e) => copyShortLink(item.uuid, item.id, e)} tabindex={0} >
+ {#if item.privacy && item.privacy.visibility === "private"}
+
+ {:else}
+
+ {/if}
+
+
+
{copiedItems[item.uuid] ? "Copied!" : "Copy public link"}
+
+ {/each}
+ {/if}
+
+
+
\ No newline at end of file
diff --git a/dashboard/src/lib/list/List.svelte b/dashboard/src/lib/list/List.svelte
index d3dae251..bd0dc577 100644
--- a/dashboard/src/lib/list/List.svelte
+++ b/dashboard/src/lib/list/List.svelte
@@ -8,13 +8,18 @@
import ListPagination from '../ListPagination.svelte';
import ListControl from './ListControl.svelte';
import ListSearch from './ListSearch.svelte';
- import CardsList from './CardsList.svelte';
+ import ListView from './ListView.svelte';
+ import CardView from './CardView.svelte';
import { Member, Group } from '../../api/types';
import api from '../../api';
export let members: Member[] = [];
export let groups: Group[] = [];
+
+ export let view: string = "list";
+
+ export let isDash = false;
let list: Member[] | Group[] = [];
let processedList: Member[] | Group[] = [];
@@ -31,7 +36,14 @@
let pageAmount: number;
let currentPage: number = 1;
- let itemsPerPageValue = settings && settings.accessibility && settings.accessibility.expandedcards ? "10" : "25";
+ let itemsPerPageValue;
+ $: {
+ if (view === "card") itemsPerPageValue = "24";
+
+ else if (settings && settings.accessibility && settings.accessibility.expandedcards) itemsPerPageValue = "10";
+ else itemsPerPageValue = "25";
+ }
+
$: itemsPerPage = parseInt(itemsPerPageValue);
$: indexOfLastItem = currentPage * itemsPerPage;
@@ -108,7 +120,7 @@
-
+
{#if listLoading && !err}
@@ -136,7 +148,13 @@
{/if}
{/if}
-
+{#if view === "card"}
+
+{:else if view === "tiny"}
+ tiny!
+{:else}
+
+{/if}
{/if}
diff --git a/dashboard/src/lib/list/ListControl.svelte b/dashboard/src/lib/list/ListControl.svelte
index 2950d5b7..a9a9c1e2 100644
--- a/dashboard/src/lib/list/ListControl.svelte
+++ b/dashboard/src/lib/list/ListControl.svelte
@@ -1,4 +1,5 @@
+
+
+
+
+
+
+
+ {@html htmlName} ({member.id})
+
+
+
+ {#if view === "card"}
+
{if (event.key === "Enter") {avatarOpen = true}}} on:click={toggleAvatarModal} class="rounded avatar mx-auto w-100 h-auto mb-2" src={icon_url_resized} alt={altText}/>
+
+
+
+
+
+ {#if member.display_name}
+
{@html htmlDisplayName}
+ {/if}
+ {#if member.pronouns}
+
{@html htmlPronouns}
+ {/if}
+
+
+ {@html htmlDesc}
+
+
+
+
+ {#if !isPublic} {view = "edit"}} id={`member-${member.uuid}-edit-button-card`}> {/if}
+
+
+ {#if !isPublic && isDash} {view = "groups"}} id={`member-${member.uuid}-groups-button-card`}> {/if}
+
+
+
+
+ {#if !isPublic}Edit member {/if}
+ {#if !isPublic && isDash}View groups {/if}
+ View page
+
+ {:else if view === "groups"}
+ {#if groupList.length > 0}
+
Groups
+
+
+ {#each groupList as group, index (group.id)}
+ {@html toHTML(group.name)} ({group.id}
)
+ {/each}
+
+ {:else}
+
This member is in no groups.
+ {/if}
+
+
+
+ {view = "edit"}} id={`member-${member.uuid}-edit-button-groups`}>
+
+
+ {view = "card"}} id={`member-${member.uuid}-back-button-groups`}>
+
+
+
+
+ Edit member
+ Back to info
+ View page
+
+ {:else if view === "edit"}
+
Name:
+
+
Avatar url:
+
+
+
Display name:
+
+
Pronouns:
+
+
+
Description:
+
+
+
Color:
+
+
+
+
+
+ input.color = e.target.value.slice(1, 7)} type="color" aria-label="color picker" />
+
+
+
+ {#if success}
+
Member edited!
+ {/if}
+ {#if err}
+ {#each err as errorMessage}
+
{@html errorMessage}
+ {/each}
+ {/if}
+
+
+ {view = "card"}} id={`member-${member.uuid}-back-button-edit`}>
+
+
+
+
+
+
+ Go back
+ Submit edit
+
+ {/if}
+
+
+
+
\ No newline at end of file
diff --git a/dashboard/src/pages/Dash.svelte b/dashboard/src/pages/Dash.svelte
index ca3208d7..b69a96cc 100644
--- a/dashboard/src/pages/Dash.svelte
+++ b/dashboard/src/pages/Dash.svelte
@@ -12,20 +12,19 @@
// get the state from the navigator so that we know which tab to start on
let location = useLocation();
let params = $location.search && new URLSearchParams($location.search);
- let tabPane: string|number;
- if (params) {
- tabPane = params.get("tab");
- }
-
- if (!tabPane) {
- tabPane = "system";
- }
-
+ let tabPane: string|number = params && params.get("tab") || "system";
+ let listView: string = params && params.get("view") || "list";
// change the URL when changing tabs
- function navigateTo(tab: string|number) {
- navigate(`./dash?tab=${tab}`);
+ function navigateTo(tab: string|number, view: string) {
+ let url = "./dash";
+ if (tab || view) url += "?";
+ if (tab) url += `tab=${tab}`
+ if (tab && view) url += "&";
+ if (view) url += `view=${view}`
+
+ navigate(url);
tabPane = tab;
}
@@ -85,15 +84,15 @@
Viewing your own system
- navigateTo(e.detail)}>
+ navigateTo(e.detail, listView)}>
-
+ navigateTo("members", e.detail)} bind:groups={groups} bind:members={members} isPublic={false} itemType={"member"} bind:view={listView} isDash={true} />
-
+ navigateTo("members", e.detail)} bind:members={members} bind:groups={groups} isPublic={false} itemType={"group"} bind:view={listView} isDash={true} />
diff --git a/dashboard/src/pages/Group.svelte b/dashboard/src/pages/Group.svelte
index 34c455ab..02aeb3f8 100644
--- a/dashboard/src/pages/Group.svelte
+++ b/dashboard/src/pages/Group.svelte
@@ -1,7 +1,7 @@