-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Change default workspace avatars (#3670)
- Loading branch information
Showing
25 changed files
with
154 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,6 @@ graphql(` | |
slug | ||
name | ||
logo | ||
defaultLogoIndex | ||
} | ||
`) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,35 @@ | ||
<template> | ||
<div | ||
:class="[ | ||
'text-foreground-on-primary flex shrink-0 items-center justify-center overflow-hidden rounded-full uppercase transition', | ||
'flex shrink-0 overflow-hidden rounded-md border border-outline-2 bg-foundation-2', | ||
sizeClasses | ||
]" | ||
> | ||
<div | ||
class="h-full w-full bg-cover bg-center bg-no-repeat" | ||
:style="{ backgroundImage: `url('${avatar}')` }" | ||
/> | ||
class="h-full w-full bg-cover bg-center bg-no-repeat flex items-center justify-center" | ||
:style="{ backgroundImage: `url('${logo}')` }" | ||
> | ||
<span class="text-foreground-3 uppercase leading-none"> | ||
{{ name[0] }} | ||
</span> | ||
</div> | ||
</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 | ||
} | ||
`) | ||
import { type UserAvatarSize, useAvatarSizeClasses } from '@speckle/ui-components' | ||
const props = withDefaults( | ||
defineProps<{ | ||
size?: UserAvatarSize | ||
logo?: MaybeNullOrUndefined<string> | ||
defaultLogoIndex: number | ||
logo: MaybeNullOrUndefined<string> | ||
name: string | ||
}>(), | ||
{ | ||
size: 'base' | ||
} | ||
) | ||
const { sizeClasses } = useAvatarSizeClasses({ props: toRefs(props) }) | ||
const { getDefaultAvatar } = useWorkspacesAvatar() | ||
const avatar = computed(() => | ||
props.logo ? props.logo : getDefaultAvatar(props.defaultLogoIndex) | ||
) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.