From 1266da8f0b2f29e6ca18565ddb4f9bbb9a707da0 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Thu, 1 Sep 2022 20:53:50 +0200 Subject: [PATCH] feat: port list store to pinia --- 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/namespaces.ts | 4 +- src/store/modules/tasks.ts | 6 +- src/store/types.ts | 3 +- src/stores/lists.ts | 166 ++++++++++++------ 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 +- 22 files changed, 199 insertions(+), 166 deletions(-) delete mode 100644 src/composables/useList.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 @@