Files
speckle-server/packages/frontend-2/components/workspace/invite/dialog/UserRow.vue
T
Kristaps Fabians Geikins 2bb7802fb9 feat: accept & decline workspace invite as a registered member (#2675)
* 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
2024-08-19 13:01:25 +03:00

48 lines
1.2 KiB
Vue

<template>
<div
class="flex px-4 py-3 items-center space-x-2 border-b last:border-0 border-outline-3"
>
<UserAvatar :user="user" />
<span class="grow truncate text-body-sm">{{ user.name }}</span>
<span v-tippy="isTryingToSetGuestOwner ? settingGuestOwnerErrorMessage : undefined">
<FormButton
:disabled="isButtonDisabled"
size="sm"
color="outline"
@click="() => $emit('invite-user')"
>
Invite
</FormButton>
</span>
</div>
</template>
<script setup lang="ts">
import { Roles } from '@speckle/shared'
import type { UserSearchItem } from '~~/lib/common/composables/users'
defineEmits<{
(e: 'invite-user'): void
}>()
const props = withDefaults(
defineProps<{
isOwnerRole: boolean
user: UserSearchItem
disabled?: boolean
settingGuestOwnerErrorMessage?: string
}>(),
{
settingGuestOwnerErrorMessage: "Server guests can't be workspace owners"
}
)
const isTryingToSetGuestOwner = computed(
() => props.user.role === Roles.Server.Guest && props.isOwnerRole
)
const isButtonDisabled = computed(() => {
if (props.disabled) return true
if (isTryingToSetGuestOwner.value) return true
return false
})
</script>