From f4ee8b321e3234f4ede1f8348e4c498bfd86854c Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 17 Oct 2022 22:58:12 +0200 Subject: [PATCH] client refactor: use pagination in drive component Squashed commit of the following: commit 8636adab6455bea29659a6799a7f3aad9e7cc10d Author: Johann150 Date: Mon Oct 17 22:53:24 2022 +0200 fix: remove comment commit 7ff8d45bfa2ed5c07c9a053e817604ef2eb115ad Author: Johann150 Date: Mon Oct 17 21:55:48 2022 +0200 fix paginations reloading The Pagination type actually specifies that just the params property should be a Ref. commit 55fe9210c15785611603e3a7a2535ebf8008ea64 Author: Johann150 Date: Mon Oct 17 18:55:54 2022 +0200 fix variable name commit a464d1363bc8c62606a4d2acc148ce269973bede Author: Johann150 Date: Sun Oct 16 22:36:11 2022 +0200 fix: don't display empty drive message while loading commit 52905b398f683ff3c71c2d5592851b2d2a428550 Author: Johann150 Date: Fri Oct 14 22:19:13 2022 +0200 remove unavailable i18n strings commit d491a71cbec05f991864a06b8e0001d40da006a3 Author: Johann150 Date: Fri Oct 14 22:18:42 2022 +0200 client refactor: use pagination in drive component This majorly refactors the drive component to use the proper pagination component instead of reimplementing pagination. The drive component is also refactored to use ref sugar (i.e. $ref). --- packages/client/src/components/drive.vue | 430 ++++++++---------- .../client/src/components/ui/pagination.vue | 4 + 2 files changed, 184 insertions(+), 250 deletions(-) diff --git a/packages/client/src/components/drive.vue b/packages/client/src/components/drive.vue index 7db6505e6..b246f4be4 100644 --- a/packages/client/src/components/drive.vue +++ b/packages/client/src/components/drive.vue @@ -28,7 +28,7 @@
-
- - -
- {{ i18n.ts.loadMore }} -
-
- - -
- {{ i18n.ts.loadMore }} -
-
-

{{ i18n.t('empty-draghover') }}

-

{{ i18n.ts.emptyDrive }}
{{ i18n.t('empty-drive-description') }}

-

{{ i18n.ts.emptyFolder }}

+ + + + + + + + + + +
+

{{ i18n.ts.emptyDrive }}

+

{{ i18n.ts.emptyFolder }}

-
@@ -88,12 +114,13 @@ @@ -718,18 +660,6 @@ onBeforeUnmount(() => { user-select: none; } - &.fetching { - cursor: wait !important; - - * { - pointer-events: none; - } - - > .contents { - opacity: 0.5; - } - } - &.uploading { height: calc(100% - 38px - 100px); } diff --git a/packages/client/src/components/ui/pagination.vue b/packages/client/src/components/ui/pagination.vue index 6904849e5..baa1a7bf1 100644 --- a/packages/client/src/components/ui/pagination.vue +++ b/packages/client/src/components/ui/pagination.vue @@ -70,6 +70,8 @@ const props = withDefaults(defineProps<{ const emit = defineEmits<{ (ev: 'queue', count: number): void; + (ev: 'loaded'): void; + (ev: 'error'): void; }>(); type Item = { id: string; [another: string]: unknown; }; @@ -105,9 +107,11 @@ const init = async (): Promise => { offset.value = res.length; error.value = false; fetching.value = false; + emit('loaded'); }, () => { error.value = true; fetching.value = false; + emit('error'); }); };