|
|
@ -1,4 +1,5 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
|
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { onUnmounted, useEventListener, useGlobal, useState, watch } from '#imports' |
|
|
|
import { onUnmounted, useEventListener, useGlobal, useState, watch } from '#imports' |
|
|
|
import MdiAccountStar from '~icons/mdi/account-star' |
|
|
|
import MdiAccountStar from '~icons/mdi/account-star' |
|
|
|
import MdiAccountHardHat from '~icons/mdi/account-hard-hat' |
|
|
|
import MdiAccountHardHat from '~icons/mdi/account-hard-hat' |
|
|
@ -13,7 +14,13 @@ const position = useState('preview-as-position', () => ({ |
|
|
|
x: `${window.innerWidth / 2 - 250}px`, |
|
|
|
x: `${window.innerWidth / 2 - 250}px`, |
|
|
|
})) |
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
const roleList = [{ title: 'editor' }, { title: 'commenter' }, { title: 'viewer' }] |
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const roleList = [ |
|
|
|
|
|
|
|
{ value: 'editor', label: t('objects.roleType.editor') }, |
|
|
|
|
|
|
|
{ value: 'commenter', label: t('objects.roleType.commenter') }, |
|
|
|
|
|
|
|
{ value: 'viewer', label: t('objects.roleType.viewer') }, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
const { previewAs } = useGlobal() |
|
|
|
const { previewAs } = useGlobal() |
|
|
|
|
|
|
|
|
|
|
@ -62,28 +69,29 @@ watch(previewAs, () => window.location.reload()) |
|
|
|
<span>{{ $t('activity.previewAs') }}</span> |
|
|
|
<span>{{ $t('activity.previewAs') }}</span> |
|
|
|
|
|
|
|
|
|
|
|
<a-radio-group v-model:value="previewAs" name="radioGroup"> |
|
|
|
<a-radio-group v-model:value="previewAs" name="radioGroup"> |
|
|
|
<a-radio v-for="role of roleList" :key="role.title" class="capitalize !text-white" :value="role.title" |
|
|
|
<a-radio v-for="role of roleList" :key="role.value" class="capitalize !text-white" :value="role.value" |
|
|
|
>{{ role.title }} |
|
|
|
>{{ role.label }} |
|
|
|
</a-radio> |
|
|
|
</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
|
|
|
|
|
|
|
|
|
<div class="divider -ml-4" /> |
|
|
|
<div class="divider -ml-4" /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Close --> |
|
|
|
<div class="flex items-center gap-2 cursor-pointer" @click="previewAs = null"> |
|
|
|
<div class="flex items-center gap-2 cursor-pointer" @click="previewAs = null"> |
|
|
|
<MdiExitToApp /> |
|
|
|
<MdiExitToApp /> |
|
|
|
Exit |
|
|
|
{{ $t('general.close') }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<template v-else> |
|
|
|
<template v-else> |
|
|
|
<template v-for="role of roleList" :key="role.title"> |
|
|
|
<template v-for="role of roleList" :key="role.value"> |
|
|
|
<a-menu-item @click="previewAs = role.title"> |
|
|
|
<a-menu-item @click="previewAs = role.value"> |
|
|
|
<div class="nc-project-menu-item group"> |
|
|
|
<div class="nc-project-menu-item group"> |
|
|
|
<component :is="roleIcon[role.title]" class="group-hover:text-accent" /> |
|
|
|
<component :is="roleIcon[role.value]" class="group-hover:text-accent" /> |
|
|
|
|
|
|
|
|
|
|
|
<span class="capitalize" :class="{ 'x-active--text': role.title === previewAs }"> |
|
|
|
<span class="capitalize" :class="{ 'x-active--text': role.value === previewAs }"> |
|
|
|
{{ role.title }} |
|
|
|
{{ role.label }} |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-menu-item> |
|
|
|
</a-menu-item> |
|
|
|