diff --git a/dashboard/src/components/list/ListControl.svelte b/dashboard/src/components/list/ListControl.svelte
index 5bf45214..6b5e37ea 100644
--- a/dashboard/src/components/list/ListControl.svelte
+++ b/dashboard/src/components/list/ListControl.svelte
@@ -141,6 +141,7 @@ function resetPage() {
{/if}
+
{#if !pageOptions.isPublic}
{/if}
@@ -391,6 +392,16 @@ function resetPage() {
{/if}
+
+
+ Color
+ resetPage()}>
+
+
+
+
+
+
{/if}
diff --git a/dashboard/src/components/list/functions.ts b/dashboard/src/components/list/functions.ts
index 314d2b7a..8753d945 100644
--- a/dashboard/src/components/list/functions.ts
+++ b/dashboard/src/components/list/functions.ts
@@ -121,6 +121,22 @@ function sort(list: T[], options: ListOptions): T[] {
return aa.localeCompare(bb);
});
+ } else if (options.sort === 'color') {
+ newList = [...list].sort((a, b) => {
+ let aa = Number("0x" + a.color);
+ let bb = Number("0x" + b.color);
+
+ if (a.color === null) return 1;
+ if (b.color === null) return -1;
+
+ if (aa === bb) return a.name.localeCompare(b.name);
+
+ if (Number.isNaN(aa)) return 1;
+ if (Number.isNaN(bb)) return -1;
+
+ if (aa > bb) return 1;
+ if (aa < bb) return -1;
+ })
}
return newList;
}
diff --git a/dashboard/src/components/list/types.ts b/dashboard/src/components/list/types.ts
index ab093a29..c7e72e0d 100644
--- a/dashboard/src/components/list/types.ts
+++ b/dashboard/src/components/list/types.ts
@@ -44,10 +44,11 @@ export interface ListOptions {
display_name: "all"|"include"|"exclude",
avatar_url: "all"|"include"|"exclude",
icon: "all"|"include"|"exclude",
+ color: "all"|"include"|"exclude",
}
// what it says on the tin
- sort: 'name'|'description'|'birthday'|'pronouns'|'display_name'|'id'|'none'|'created',
+ sort: 'name'|'description'|'birthday'|'pronouns'|'display_name'|'id'|'none'|'created' | 'color',
order: "ascending"|"descending",
show: "all"|"private"|"public",
// so we can change the key for duplicate members on the randomize page
@@ -109,7 +110,8 @@ export const defaultListOptions: ListOptions = {
description: 'all',
pronouns: 'all',
avatar_url: 'all',
- icon: 'all'
+ icon: 'all',
+ color: 'all',
},
sort: 'name',