2021-01-30 16:17:04 +00:00
|
|
|
<template>
|
|
|
|
<dropdown>
|
2022-09-28 16:08:23 +00:00
|
|
|
<template v-if="isSavedFilter(list)">
|
2021-01-30 16:17:04 +00:00
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'filter.settings.edit', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="pen"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.edit') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'filter.settings.delete', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="trash-alt"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('misc.delete') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
</template>
|
2021-11-01 17:19:59 +00:00
|
|
|
|
2021-01-30 16:17:04 +00:00
|
|
|
<template v-else-if="list.isArchived">
|
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'list.settings.archive', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="archive"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.unarchive') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'list.settings.edit', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="pen"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.edit') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
<dropdown-item
|
|
|
|
v-if="backgroundsEnabled"
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'list.settings.background', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="image"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.setBackground') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'list.settings.share', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="share-alt"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.share') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'list.settings.duplicate', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="paste"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.duplicate') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'list.settings.archive', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="archive"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.archive') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
2022-10-07 16:15:00 +00:00
|
|
|
<Subscription
|
2022-07-20 15:08:46 +00:00
|
|
|
class="has-no-shadow"
|
2021-02-14 19:18:51 +00:00
|
|
|
:is-button="false"
|
|
|
|
entity="list"
|
|
|
|
:entity-id="list.id"
|
2022-09-13 15:30:33 +00:00
|
|
|
:model-value="list.subscription"
|
2022-10-07 16:15:00 +00:00
|
|
|
@update:model-value="setSubscriptionInStore"
|
2022-07-20 15:08:46 +00:00
|
|
|
type="dropdown"
|
2021-02-14 19:18:51 +00:00
|
|
|
/>
|
2021-01-30 16:17:04 +00:00
|
|
|
<dropdown-item
|
2021-11-01 17:19:59 +00:00
|
|
|
:to="{ name: 'list.settings.delete', params: { listId: list.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="trash-alt"
|
|
|
|
class="has-text-danger"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.delete') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
</template>
|
|
|
|
</dropdown>
|
|
|
|
</template>
|
|
|
|
|
2022-01-30 12:40:14 +00:00
|
|
|
<script setup lang="ts">
|
2022-07-20 22:42:36 +00:00
|
|
|
import {ref, computed, watchEffect, type PropType} from 'vue'
|
2022-01-30 12:40:14 +00:00
|
|
|
|
2022-09-28 16:08:23 +00:00
|
|
|
import {isSavedFilter} from '@/helpers/savedFilter'
|
2021-07-25 13:27:15 +00:00
|
|
|
import Dropdown from '@/components/misc/dropdown.vue'
|
|
|
|
import DropdownItem from '@/components/misc/dropdown-item.vue'
|
2022-10-07 16:15:00 +00:00
|
|
|
import Subscription from '@/components/misc/subscription.vue'
|
2022-09-06 09:36:01 +00:00
|
|
|
import type {IList} from '@/modelTypes/IList'
|
|
|
|
import type {ISubscription} from '@/modelTypes/ISubscription'
|
2022-09-21 00:21:22 +00:00
|
|
|
import {useConfigStore} from '@/stores/config'
|
2022-10-07 16:15:00 +00:00
|
|
|
import {useListStore} from '@/stores/lists'
|
|
|
|
import {useNamespaceStore} from '@/stores/namespaces'
|
2021-01-30 16:17:04 +00:00
|
|
|
|
2022-01-30 12:40:14 +00:00
|
|
|
const props = defineProps({
|
|
|
|
list: {
|
2022-07-20 22:42:36 +00:00
|
|
|
type: Object as PropType<IList>,
|
2022-01-30 12:40:14 +00:00
|
|
|
required: true,
|
2021-02-14 19:18:51 +00:00
|
|
|
},
|
2022-01-30 12:40:14 +00:00
|
|
|
})
|
|
|
|
|
2022-10-07 16:15:00 +00:00
|
|
|
const listStore = useListStore()
|
|
|
|
const namespaceStore = useNamespaceStore()
|
2022-07-20 22:42:36 +00:00
|
|
|
const subscription = ref<ISubscription | null>(null)
|
2022-01-30 12:40:14 +00:00
|
|
|
watchEffect(() => {
|
2022-04-24 15:06:00 +00:00
|
|
|
subscription.value = props.list.subscription ?? null
|
2022-01-30 12:40:14 +00:00
|
|
|
})
|
|
|
|
|
2022-09-21 00:21:22 +00:00
|
|
|
const configStore = useConfigStore()
|
|
|
|
const backgroundsEnabled = computed(() => configStore.enabledBackgroundProviders?.length > 0)
|
2022-10-07 16:15:00 +00:00
|
|
|
|
|
|
|
function setSubscriptionInStore(sub: ISubscription) {
|
|
|
|
subscription.value = sub
|
|
|
|
const updatedList = {
|
|
|
|
...props.list,
|
|
|
|
subscription: sub,
|
|
|
|
}
|
|
|
|
listStore.setList(updatedList)
|
|
|
|
namespaceStore.setListInNamespaceById(updatedList)
|
|
|
|
}
|
2021-01-30 16:17:04 +00:00
|
|
|
</script>
|