2021-01-30 16:17:04 +00:00
|
|
|
<template>
|
|
|
|
<dropdown>
|
2022-11-18 12:59:38 +00:00
|
|
|
<template #trigger="triggerProps">
|
|
|
|
<slot name="trigger" v-bind="triggerProps">
|
|
|
|
<BaseButton class="dropdown-trigger" @click="triggerProps.toggleOpen">
|
|
|
|
<icon icon="ellipsis-h" class="icon"/>
|
|
|
|
</BaseButton>
|
|
|
|
</slot>
|
|
|
|
</template>
|
|
|
|
|
2021-01-30 16:17:04 +00:00
|
|
|
<template v-if="namespace.isArchived">
|
|
|
|
<dropdown-item
|
|
|
|
:to="{ name: 'namespace.settings.archive', params: { id: namespace.id } }"
|
|
|
|
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
|
|
|
|
:to="{ name: 'namespace.settings.edit', params: { id: namespace.id } }"
|
|
|
|
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-30 15:58:15 +00:00
|
|
|
:to="{ name: 'namespace.settings.share', params: { namespaceId: namespace.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-17 17:04:53 +00:00
|
|
|
:to="{ name: 'list.create', params: { namespaceId: namespace.id } }"
|
2021-01-30 16:17:04 +00:00
|
|
|
icon="plus"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
{{ $t('menu.newList') }}
|
2021-01-30 16:17:04 +00:00
|
|
|
</dropdown-item>
|
|
|
|
<dropdown-item
|
|
|
|
:to="{ name: 'namespace.settings.archive', params: { id: namespace.id } }"
|
|
|
|
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 15:18:15 +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="namespace"
|
|
|
|
:entity-id="namespace.id"
|
2022-09-13 15:30:33 +00:00
|
|
|
:model-value="subscription"
|
2022-10-07 15:18:15 +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
|
|
|
|
:to="{ name: 'namespace.settings.delete', params: { id: namespace.id } }"
|
|
|
|
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>
|
|
|
|
|
2021-12-04 14:47:32 +00:00
|
|
|
<script setup lang="ts">
|
2022-07-20 22:42:36 +00:00
|
|
|
import {ref, onMounted, type PropType} from 'vue'
|
2021-12-04 14:47:32 +00:00
|
|
|
|
2022-11-18 12:59:38 +00:00
|
|
|
import BaseButton from '@/components/base/BaseButton.vue'
|
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 15:18:15 +00:00
|
|
|
import Subscription from '@/components/misc/subscription.vue'
|
2022-09-06 09:36:01 +00:00
|
|
|
import type {INamespace} from '@/modelTypes/INamespace'
|
|
|
|
import type {ISubscription} from '@/modelTypes/ISubscription'
|
2022-10-07 15:18:15 +00:00
|
|
|
import {useNamespaceStore} from '@/stores/namespaces'
|
2021-01-30 16:17:04 +00:00
|
|
|
|
2021-12-04 14:47:32 +00:00
|
|
|
const props = defineProps({
|
|
|
|
namespace: {
|
2022-07-20 22:42:36 +00:00
|
|
|
type: Object as PropType<INamespace>,
|
2021-12-04 14:47:32 +00:00
|
|
|
required: true,
|
2021-01-30 16:17:04 +00:00
|
|
|
},
|
2021-12-04 14:47:32 +00:00
|
|
|
})
|
|
|
|
|
2022-10-07 15:18:15 +00:00
|
|
|
const namespaceStore = useNamespaceStore()
|
|
|
|
|
2022-09-06 09:36:01 +00:00
|
|
|
const subscription = ref<ISubscription | null>(null)
|
2021-12-04 14:47:32 +00:00
|
|
|
onMounted(() => {
|
|
|
|
subscription.value = props.namespace.subscription
|
|
|
|
})
|
2022-10-07 15:18:15 +00:00
|
|
|
|
|
|
|
function setSubscriptionInStore(sub: ISubscription) {
|
|
|
|
subscription.value = sub
|
2022-10-24 16:56:50 +00:00
|
|
|
namespaceStore.setNamespaceById({
|
|
|
|
...props.namespace,
|
|
|
|
subscription: sub,
|
|
|
|
})
|
2022-10-07 15:18:15 +00:00
|
|
|
}
|
2021-01-30 16:17:04 +00:00
|
|
|
</script>
|
2022-11-18 12:59:38 +00:00
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.dropdown-trigger {
|
|
|
|
padding: 0.5rem;
|
|
|
|
}
|
|
|
|
</style>
|