diff --git a/src/routes/(app)/admin/+page.svelte b/src/routes/(app)/admin/+page.svelte index 79ea40c44..4b12346ea 100644 --- a/src/routes/(app)/admin/+page.svelte +++ b/src/routes/(app)/admin/+page.svelte @@ -4,6 +4,8 @@ import { goto } from '$app/navigation'; import { onMount, getContext } from 'svelte'; + import dayjs from 'dayjs'; + import { toast } from 'svelte-sonner'; import { updateUserRole, getUsers, deleteUserById } from '$lib/apis/users'; @@ -16,6 +18,7 @@ let loaded = false; let users = []; + let search = ''; let selectedUser = null; let showSettingsModal = false; @@ -80,157 +83,193 @@ -
+
{#if loaded}
-
+
-
-
- {$i18n.t('All Users')} -
- {users.length} -
-
- +
{$i18n.t('Admin Settings')}
+ +
-
- ⓘ {$i18n.t("Click on the user role button to change a user's role.")} + +
+
Overview
+
-
+
-
- - - - - - - - - - - {#each users as user} - - - - +
+ +
+ - +
+
{$i18n.t('Role')} {$i18n.t('Name')} {$i18n.t('Email')} {$i18n.t('Action')}
- - -
- user +
+
+
+ {$i18n.t('All Users')} +
+ {users.length} +
-
{user.name}
-
-
{user.email} -
- - - -
-
+ + + + + + + - {/each} - -
{$i18n.t('Role')} {$i18n.t('Name')} {$i18n.t('Email')} {$i18n.t('Created at')}
+ + + {#each users.filter((user) => { + if (search === '') { + return true; + } else { + let name = user.name.toLowerCase(); + const query = search.toLowerCase(); + return name.includes(query); + } + }) as user} + + + + + +
+ user + +
{user.name}
+
+ + {user.email} + + + {dayjs(user.timestamp * 1000).format($i18n.t('MMMM DD, YYYY'))} + + + +
+ + + +
+ + + {/each} + + +
+ +
+ ⓘ {$i18n.t("Click on the user role button to change a user's role.")} +