From a38075f376aa5cc2d8a06943cf8932366a0d4011 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 21 Sep 2022 16:21:25 +0000 Subject: [PATCH] feat: move list store to pina (#2392) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2392 Reviewed-by: konrad Co-authored-by: Dominik Pschenitschni Co-committed-by: Dominik Pschenitschni --- src/components/home/navigation.vue | 15 +- src/components/list/partials/list-card.vue | 15 +- .../quick-actions/quick-actions.vue | 18 +- src/components/tasks/partials/listSearch.vue | 6 +- .../tasks/partials/singleTaskInList.vue | 19 +- src/composables/useList.ts | 37 ---- src/router/index.ts | 7 +- src/store/index.ts | 2 - src/store/modules/lists.ts | 130 ------------- src/store/modules/namespaces.ts | 4 +- src/store/modules/tasks.ts | 6 +- src/store/types.ts | 3 +- src/stores/lists.ts | 182 ++++++++++++++++++ src/views/Home.vue | 4 +- src/views/list/ListInfo.vue | 6 +- src/views/list/ListWrapper.vue | 4 +- src/views/list/NewList.vue | 10 +- src/views/list/settings/archive.vue | 6 +- src/views/list/settings/background.vue | 9 +- src/views/list/settings/delete.vue | 14 +- src/views/list/settings/duplicate.vue | 4 +- src/views/list/settings/edit.vue | 6 +- src/views/user/settings/General.vue | 4 +- 23 files changed, 272 insertions(+), 239 deletions(-) delete mode 100644 src/composables/useList.ts delete mode 100644 src/store/modules/lists.ts create mode 100644 src/stores/lists.ts diff --git a/src/components/home/navigation.vue b/src/components/home/navigation.vue index 07be48e08..2e5947714 100644 --- a/src/components/home/navigation.vue +++ b/src/components/home/navigation.vue @@ -124,7 +124,7 @@ @@ -159,6 +159,7 @@ import {useEventListener} from '@vueuse/core' import type {IList} from '@/modelTypes/IList' import type {INamespace} from '@/modelTypes/INamespace' import ColorBubble from '@/components/misc/colorBubble.vue' +import {useListStore} from '@/stores/lists' const drag = ref(false) const dragOptions = { @@ -195,15 +196,7 @@ const namespaceListsCount = computed(() => { useEventListener('resize', resize) onMounted(() => resize()) - -function toggleFavoriteList(list: IList) { - // The favorites pseudo list is always favorite - // Archived lists cannot be marked favorite - if (list.id === -1 || list.isArchived) { - return - } - store.dispatch('lists/toggleListFavorite', list) -} +const listStore = useListStore() function resize() { // Hide the menu by default on mobile @@ -268,7 +261,7 @@ async function saveListPosition(e: SortableEvent) { try { // create a copy of the list in order to not violate vuex mutations - await store.dispatch('lists/updateList', { + await listStore.updateList({ ...list, position, namespaceId, diff --git a/src/components/list/partials/list-card.vue b/src/components/list/partials/list-card.vue index f2a8b4eb4..99da97ee4 100644 --- a/src/components/list/partials/list-card.vue +++ b/src/components/list/partials/list-card.vue @@ -24,7 +24,7 @@ @@ -37,7 +37,6 @@