This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/views/list/settings/share.vue

68 lines
1.5 KiB
Vue
Raw Normal View History

<template>
<create-edit
:title="$t('list.share.header')"
:has-primary-action="false"
>
2021-11-30 15:58:15 +00:00
<template v-if="list">
<userTeam
:id="list.id"
:userIsAdmin="userIsAdmin"
shareType="user"
type="list"
/>
<userTeam
:id="list.id"
:userIsAdmin="userIsAdmin"
shareType="team"
type="list"
/>
</template>
2022-10-05 12:41:07 +00:00
<link-sharing
v-if="linkSharingEnabled"
class="mt-4"
:list-id="listId"
/>
</create-edit>
</template>
2021-11-30 15:58:15 +00:00
<script lang="ts">
2022-06-23 01:08:35 +00:00
export default {name: 'list-setting-share'}
2021-11-30 15:58:15 +00:00
</script>
<script lang="ts" setup>
2022-10-05 12:41:07 +00:00
import {computed} from 'vue'
2021-11-30 15:58:15 +00:00
import {useI18n} from 'vue-i18n'
import {useTitle} from '@vueuse/core'
import CreateEdit from '@/components/misc/create-edit.vue'
import LinkSharing from '@/components/sharing/linkSharing.vue'
import userTeam from '@/components/sharing/userTeam.vue'
2022-09-24 13:20:40 +00:00
2022-10-05 12:41:07 +00:00
import {useAuthStore} from '@/stores/auth'
2022-09-21 00:21:22 +00:00
import {useConfigStore} from '@/stores/config'
2022-10-05 12:41:07 +00:00
import {useList} from '@/stores/lists'
import type {IList} from '@/modelTypes/IList'
const {listId} = defineProps<{
listId: IList['id']
}>()
const {t} = useI18n({useScope: 'global'})
2021-11-30 15:58:15 +00:00
2022-10-05 12:41:07 +00:00
const {list} = useList(listId)
2021-11-30 15:58:15 +00:00
const title = computed(() => list.value?.title
? t('list.share.title', {list: list.value.title})
: '',
)
useTitle(title)
2022-09-21 00:21:22 +00:00
const configStore = useConfigStore()
2022-10-05 12:41:07 +00:00
const authStore = useAuthStore()
2022-09-21 00:21:22 +00:00
const linkSharingEnabled = computed(() => configStore.linkSharingEnabled)
2022-10-05 12:41:07 +00:00
const userIsAdmin = computed(() => list.value.owner.id === authStore.info?.id)
</script>