01c9fb4e55
* Fixed reactivity, added workspace logo to create workspace modal * Reverse order so name is focussed first * Fix typo * feat(workspaces): allow sending the logo on ws creation * Fix avatar uploading * Added default index 0 * fix(workspaces): maybe default logo --------- Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
48 lines
1.2 KiB
Vue
48 lines
1.2 KiB
Vue
<template>
|
|
<div
|
|
:class="[
|
|
'text-foreground-on-primary flex shrink-0 items-center justify-center overflow-hidden rounded-full uppercase transition',
|
|
sizeClasses
|
|
]"
|
|
>
|
|
<div
|
|
class="h-full w-full bg-cover bg-center bg-no-repeat"
|
|
:style="{ backgroundImage: `url('${avatar}')` }"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { graphql } from '~~/lib/common/generated/gql'
|
|
import type { MaybeNullOrUndefined } from '@speckle/shared'
|
|
import type { UserAvatarSize } from '@speckle/ui-components'
|
|
import { useAvatarSizeClasses } from '@speckle/ui-components'
|
|
import { useWorkspacesAvatar } from '~/lib/workspaces/composables/avatar'
|
|
|
|
graphql(`
|
|
fragment WorkspaceAvatar_Workspace on Workspace {
|
|
id
|
|
logo
|
|
defaultLogoIndex
|
|
}
|
|
`)
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
size?: UserAvatarSize
|
|
logo?: MaybeNullOrUndefined<string>
|
|
defaultLogoIndex: number
|
|
}>(),
|
|
{
|
|
size: 'base'
|
|
}
|
|
)
|
|
|
|
const { sizeClasses } = useAvatarSizeClasses({ props: toRefs(props) })
|
|
const { getDefaultAvatar } = useWorkspacesAvatar()
|
|
|
|
const avatar = computed(() =>
|
|
props.logo ? props.logo : getDefaultAvatar(props.defaultLogoIndex)
|
|
)
|
|
</script>
|