From e58d09b6ccdf2a7a3b945b4adeab5aaaffc961e9 Mon Sep 17 00:00:00 2001 From: Evan Boehs Date: Thu, 2 Feb 2023 16:02:39 -0500 Subject: [PATCH] feat: finish list CRUD (#1532) Co-authored-by: userquin closes https://github.com/elk-zone/elk/issues/372 --- components/account/AccountHeader.vue | 94 +++++----- components/common/CommonPaginator.vue | 17 ++ components/list/ListEntry.vue | 169 ++++++++++++++++++ locales/en.json | 13 +- pages/[[server]]/list.vue | 55 ------ pages/[[server]]/list/[list].vue | 35 ---- pages/[[server]]/list/[list]/index.vue | 55 +++++- .../list/[list]/{ => index}/accounts.vue | 0 pages/[[server]]/list/[list]/index/index.vue | 17 ++ pages/[[server]]/lists.vue | 78 +++++++- 10 files changed, 383 insertions(+), 150 deletions(-) create mode 100644 components/list/ListEntry.vue delete mode 100644 pages/[[server]]/list.vue delete mode 100644 pages/[[server]]/list/[list].vue rename pages/[[server]]/list/[list]/{ => index}/accounts.vue (100%) create mode 100644 pages/[[server]]/list/[list]/index/index.vue diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index 233c96d4..135819c2 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -91,56 +91,58 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
-
- -
-
- - -
- +
+ + + {{ $t('settings.profile.appearance.title') }} + + + + + + + + + + + + + +
-
- - - - - - - - - - - - - - {{ $t('settings.profile.appearance.title') }} - +
+
+ + +
+
diff --git a/components/common/CommonPaginator.vue b/components/common/CommonPaginator.vue index 9e9dc935..ee51666d 100644 --- a/components/common/CommonPaginator.vue +++ b/components/common/CommonPaginator.vue @@ -51,6 +51,23 @@ nuxtApp.hook('elk-logo:click', () => { update() nuxtApp.$scrollToTop() }) + +function createEntry(item: any) { + items.value = [...items.value, preprocess?.([item]) ?? item] +} + +function updateEntry(item: any) { + const id = item[keyProp] + const index = items.value.findIndex(i => (i as any)[keyProp] === id) + if (index > -1) + items.value = [...items.value.slice(0, index), preprocess?.([item]) ?? item, ...items.value.slice(index + 1)] +} + +function removeEntry(entryId: any) { + items.value = items.value.filter(i => (i as any)[keyProp] !== entryId) +} + +defineExpose({ createEntry, removeEntry, updateEntry })