|
|
@ -1,29 +1,26 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { onUnmounted, useEventListener, useGlobal, useState, watch } from '#imports' |
|
|
|
import { onUnmounted, ref, useEventListener, useGlobal, useI18n, useNuxtApp, 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' |
|
|
|
import MdiAccountEdit from '~icons/mdi/account-edit' |
|
|
|
import MdiAccountEdit from '~icons/mdi/account-edit' |
|
|
|
import MdiEyeOutline from '~icons/mdi/eye-outline' |
|
|
|
import MdiEyeOutline from '~icons/mdi/eye-outline' |
|
|
|
import MdiCommentAccountOutline from '~icons/mdi/comment-account-outline' |
|
|
|
import MdiCommentAccountOutline from '~icons/mdi/comment-account-outline' |
|
|
|
|
|
|
|
import { ProjectRole } from '~/lib' |
|
|
|
|
|
|
|
|
|
|
|
const { float } = defineProps<{ float?: boolean }>() |
|
|
|
const { float } = defineProps<{ float?: boolean }>() |
|
|
|
|
|
|
|
|
|
|
|
const position = useState('preview-as-position', () => ({ |
|
|
|
|
|
|
|
y: `${window.innerHeight - 100}px`, |
|
|
|
|
|
|
|
x: `${window.innerWidth / 2 - 250}px`, |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { $e } = useNuxtApp() |
|
|
|
const { $e } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { previewAs } = useGlobal() |
|
|
|
|
|
|
|
|
|
|
|
const roleList = [ |
|
|
|
const roleList = [ |
|
|
|
{ value: 'editor', label: t('objects.roleType.editor') }, |
|
|
|
{ value: ProjectRole.Editor, label: t('objects.roleType.editor') }, |
|
|
|
{ value: 'commenter', label: t('objects.roleType.commenter') }, |
|
|
|
{ value: ProjectRole.Commenter, label: t('objects.roleType.commenter') }, |
|
|
|
{ value: 'viewer', label: t('objects.roleType.viewer') }, |
|
|
|
{ value: ProjectRole.Viewer, label: t('objects.roleType.viewer') }, |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
const { previewAs } = useGlobal() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const roleIcon = { |
|
|
|
const roleIcon = { |
|
|
|
owner: MdiAccountStar, |
|
|
|
owner: MdiAccountStar, |
|
|
|
creator: MdiAccountHardHat, |
|
|
|
creator: MdiAccountHardHat, |
|
|
@ -32,6 +29,11 @@ const roleIcon = { |
|
|
|
commenter: MdiCommentAccountOutline, |
|
|
|
commenter: MdiCommentAccountOutline, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const position = ref({ |
|
|
|
|
|
|
|
y: `${window.innerHeight - 100}px`, |
|
|
|
|
|
|
|
x: `${window.innerWidth / 2 - 250}px`, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const divMove = (e: MouseEvent) => { |
|
|
|
const divMove = (e: MouseEvent) => { |
|
|
|
position.value = { y: `${e.clientY - 10}px`, x: `${e.clientX - 18}px` } |
|
|
|
position.value = { y: `${e.clientY - 10}px`, x: `${e.clientX - 18}px` } |
|
|
|
} |
|
|
|
} |
|
|
@ -49,7 +51,7 @@ onUnmounted(() => { |
|
|
|
window.removeEventListener('mousemove', divMove, true) |
|
|
|
window.removeEventListener('mousemove', divMove, true) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
/** reload page on previewas change */ |
|
|
|
/** reload page on preview-as change */ |
|
|
|
watch(previewAs, (newRole) => { |
|
|
|
watch(previewAs, (newRole) => { |
|
|
|
$e('a:navdraw:preview', { role: newRole }) |
|
|
|
$e('a:navdraw:preview', { role: newRole }) |
|
|
|
window.location.reload() |
|
|
|
window.location.reload() |
|
|
@ -63,7 +65,7 @@ watch(previewAs, (newRole) => { |
|
|
|
class="floating-reset-btn nc-floating-preview-btn p-4" |
|
|
|
class="floating-reset-btn nc-floating-preview-btn p-4" |
|
|
|
:style="{ top: position.y, left: position.x }" |
|
|
|
:style="{ top: position.y, left: position.x }" |
|
|
|
> |
|
|
|
> |
|
|
|
<MdiDrag style="cursor: move" class="text-white" @mousedown="mouseDown" /> |
|
|
|
<MdiDrag class="cursor-move text-white" @mousedown="mouseDown" /> |
|
|
|
|
|
|
|
|
|
|
|
<div class="divider" /> |
|
|
|
<div class="divider" /> |
|
|
|
|
|
|
|
|
|
|
|