Files
speckle-server/packages/frontend-2/lib/workspaces/composables/avatar.ts
T
Mike 01c9fb4e55 Feat: Workspace creation wizard should allow for optional logo (#2757)
* 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>
2024-08-26 17:20:43 +02:00

20 lines
468 B
TypeScript

export const useWorkspacesAvatar = () => {
const count = ref(6)
const generateDefaultLogoIndex = () => {
return Math.floor(Math.random() * count.value)
}
const getDefaultAvatar = (avatarIndex?: number) => {
const index =
avatarIndex && avatarIndex >= 0 && avatarIndex <= count.value ? avatarIndex : 0
return `/images/workspace/avatars/avatar_${index}.svg`
}
return {
count,
getDefaultAvatar,
generateDefaultLogoIndex
}
}