diff --git a/src/lib/components/common/Pagination.svelte b/src/lib/components/common/Pagination.svelte new file mode 100644 index 000000000..5ef7e7953 --- /dev/null +++ b/src/lib/components/common/Pagination.svelte @@ -0,0 +1,42 @@ + + +
+ +
+ + + +
+ {#each pages as page (page.key)} + {#if page.type === 'ellipsis'} +
...
+ {:else} + + {page.value} + + {/if} + {/each} +
+ + + +
+
+
diff --git a/src/lib/components/icons/ChevronLeft.svelte b/src/lib/components/icons/ChevronLeft.svelte new file mode 100644 index 000000000..78ee64d24 --- /dev/null +++ b/src/lib/components/icons/ChevronLeft.svelte @@ -0,0 +1,15 @@ + + + + + diff --git a/src/lib/components/icons/ChevronRight.svelte b/src/lib/components/icons/ChevronRight.svelte new file mode 100644 index 000000000..7daf4a14a --- /dev/null +++ b/src/lib/components/icons/ChevronRight.svelte @@ -0,0 +1,15 @@ + + + + + diff --git a/src/routes/(app)/admin/+page.svelte b/src/routes/(app)/admin/+page.svelte index a90b32625..a3493cb66 100644 --- a/src/routes/(app)/admin/+page.svelte +++ b/src/routes/(app)/admin/+page.svelte @@ -12,6 +12,7 @@ import { getSignUpEnabledStatus, toggleSignUpEnabledStatus } from '$lib/apis/auths'; import EditUserModal from '$lib/components/admin/EditUserModal.svelte'; import SettingsModal from '$lib/components/admin/SettingsModal.svelte'; + import Pagination from '$lib/components/common/Pagination.svelte'; const i18n = getContext('i18n'); @@ -21,6 +22,8 @@ let search = ''; let selectedUser = null; + let page = 1; + let showSettingsModal = false; let showEditUserModal = false; @@ -159,15 +162,17 @@ - {#each users.filter((user) => { - if (search === '') { - return true; - } else { - let name = user.name.toLowerCase(); - const query = search.toLowerCase(); - return name.includes(query); - } - }) as user} + {#each users + .filter((user) => { + if (search === '') { + return true; + } else { + let name = user.name.toLowerCase(); + const query = search.toLowerCase(); + return name.includes(query); + } + }) + .slice((page - 1) * 20, page * 20) as user}