2bb7802fb9
* abstract base invite banner * WIP banner actions * WIP modify obj * minor fix * invite accept/decline cache mutations * banner accept/decline basically works * new block for accepting workspace invite * WIP wrong account flow * login/registration block changes * add email invite related changes * add new email FE * add email w/ invite works * final adjustments * minor fixes * addressing cr comments * no-FF support * extra workspace ff checks
64 lines
1.7 KiB
Vue
64 lines
1.7 KiB
Vue
<template>
|
|
<div class="flex px-4 py-3 items-center space-x-2">
|
|
<UserAvatar />
|
|
<span class="grow truncate text-body-sm">{{ selectedEmails.join(', ') }}</span>
|
|
<div class="flex items-center space-x-2">
|
|
<FormSelectServerRoles
|
|
v-if="showServerRoleSelect"
|
|
v-model="serverRole"
|
|
:allow-guest="isGuestMode"
|
|
:allow-admin="isAdmin"
|
|
fixed-height
|
|
/>
|
|
<span
|
|
v-tippy="
|
|
isTryingToSetGuestOwner ? `Server guests can't be project owners` : undefined
|
|
"
|
|
>
|
|
<FormButton
|
|
:disabled="isButtonDisabled"
|
|
color="outline"
|
|
@click="() => $emit('invite-emails', { serverRole })"
|
|
>
|
|
Invite
|
|
</FormButton>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { Roles } from '@speckle/shared'
|
|
import type { ServerRoles } from '@speckle/shared'
|
|
import { useActiveUser } from '~~/lib/auth/composables/activeUser'
|
|
|
|
defineEmits<{
|
|
(e: 'invite-emails', payload: { serverRole: ServerRoles }): void
|
|
}>()
|
|
|
|
const props = defineProps<{
|
|
selectedEmails: string[]
|
|
disabled?: boolean
|
|
isGuestMode: boolean
|
|
isOwnerRole: boolean
|
|
}>()
|
|
|
|
const { isAdmin } = useActiveUser()
|
|
|
|
const serverRole = ref<ServerRoles>(Roles.Server.User)
|
|
|
|
const showServerRoleSelect = computed(() => props.isGuestMode || isAdmin.value)
|
|
|
|
const isTryingToSetGuestOwner = computed(() => {
|
|
if (!showServerRoleSelect.value) return false
|
|
if (serverRole.value === Roles.Server.Guest && props.isOwnerRole) return true
|
|
return false
|
|
})
|
|
|
|
const isButtonDisabled = computed(() => {
|
|
if (props.disabled) return true
|
|
if (isTryingToSetGuestOwner.value) return true
|
|
if (!props.selectedEmails.length) return true
|
|
return false
|
|
})
|
|
</script>
|