Browse Source

fix(nc-gui): update workspace icon issue from admin panel

pull/9722/head
Ramesh Mane 1 week ago
parent
commit
98bfc9c8f3
  1. 6
      packages/nc-gui/components/dlg/InviteDlg.vue
  2. 6
      packages/nc-gui/components/general/EmojiPicker.vue
  3. 15
      packages/nc-gui/components/general/WorkspaceIcon.vue
  4. 7
      packages/nc-gui/components/workspace/View.vue
  5. 4
      packages/nc-gui/utils/commonUtils.ts

6
packages/nc-gui/components/dlg/InviteDlg.vue

@ -417,15 +417,15 @@ const onRoleChange = (role: keyof typeof RoleLabels) => (inviteData.roles = role
</a-input> </a-input>
</div> </div>
<div class="flex flex-col max-h-64 overflow-y-auto nc-scrollbar-md mt-2"> <div class="flex flex-col max-h-64 overflow-y-auto nc-scrollbar-md mt-2 px-2">
<div <div
v-for="ws in workSpaceSelectList" v-for="ws in workSpaceSelectList"
:key="ws.id" :key="ws.id"
class="px-4 cursor-pointer hover:bg-gray-100 rounded-lg h-9.5 py-2 w-full flex gap-2" class="px-2 cursor-pointer hover:bg-gray-100 rounded-lg h-9.5 py-2 w-full flex gap-2"
@click="checked[ws.id!] = !checked[ws.id!]" @click="checked[ws.id!] = !checked[ws.id!]"
> >
<div class="flex gap-2 capitalize items-center"> <div class="flex gap-2 capitalize items-center">
<GeneralWorkspaceIcon :hide-label="true" :workspace="ws" size="small" /> <GeneralWorkspaceIcon :workspace="ws" size="medium" />
{{ ws.title }} {{ ws.title }}
</div> </div>
<div class="flex-1" /> <div class="flex-1" />

6
packages/nc-gui/components/general/EmojiPicker.vue

@ -39,10 +39,6 @@ function selectEmoji(_emoji: any) {
isOpen.value = false isOpen.value = false
} }
const isUnicodeEmoji = computed(() => {
return emojiRef.value?.match(/\p{Extended_Pictographic}/gu)
})
const onClick = (e: Event) => { const onClick = (e: Event) => {
if (readonly) return if (readonly) return
@ -95,7 +91,7 @@ const showClearButton = computed(() => {
<template v-if="!emojiRef"> <template v-if="!emojiRef">
<slot name="default" /> <slot name="default" />
</template> </template>
<template v-else-if="isUnicodeEmoji"> <template v-else-if="isUnicodeEmoji(emojiRef)">
{{ emojiRef }} {{ emojiRef }}
</template> </template>
<template v-else> <template v-else>

15
packages/nc-gui/components/general/WorkspaceIcon.vue

@ -39,7 +39,6 @@ const workspaceIcon = computed(() => {
return { return {
icon: iconType === WorkspaceIconType.IMAGE && ncIsObject(icon) ? getPossibleAttachmentSrc(icon) || '' : icon, icon: iconType === WorkspaceIconType.IMAGE && ncIsObject(icon) ? getPossibleAttachmentSrc(icon) || '' : icon,
iconType: iconType, iconType: iconType,
isUnicodeEmoji: iconType === WorkspaceIconType.EMOJI && icon ? icon?.match(/\p{Extended_Pictographic}/gu) : false,
} }
}) })
@ -103,11 +102,21 @@ const size = computed(() => props.size || 'medium')
'text-4xl': size === 'xlarge', 'text-4xl': size === 'xlarge',
}" }"
> >
<template v-if="workspaceIcon.isUnicodeEmoji"> <template v-if="isUnicodeEmoji(workspaceIcon.icon)">
{{ workspaceIcon.icon }} {{ workspaceIcon.icon }}
</template> </template>
<template v-else> <template v-else>
<Icon :data-testid="`nc-icon-${workspaceIcon.icon}`" class="!text-inherit flex-none" :icon="workspaceIcon.icon"></Icon> <Icon
:data-testid="`nc-icon-${workspaceIcon.icon}`"
class="!text-inherit flex-none"
:class="{
'w-3 h-3': size === 'small',
'w-4 h-4': size === 'medium',
'w-6 h-6': size === 'large',
'w-10 h-10': size === 'xlarge',
}"
:icon="workspaceIcon.icon"
></Icon>
</template> </template>
</div> </div>
<GeneralIcon <GeneralIcon

7
packages/nc-gui/components/workspace/View.vue

@ -109,7 +109,7 @@ onMounted(() => {
<NcPageHeader> <NcPageHeader>
<template #icon> <template #icon>
<div class="flex justify-center items-center h-6 w-6"> <div class="flex justify-center items-center h-6 w-6">
<GeneralWorkspaceIcon :workspace="currentWorkspace" hide-label size="small" /> <GeneralWorkspaceIcon :workspace="currentWorkspace" size="medium" />
</div> </div>
</template> </template>
<template #title> <template #title>
@ -166,11 +166,6 @@ onMounted(() => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.nc-workspace-avatar {
@apply min-w-5 h-5 w-5 rounded-[6px] flex items-center justify-center text-white font-weight-bold uppercase;
font-size: 0.7rem;
}
.tab { .tab {
@apply flex flex-row items-center gap-x-2; @apply flex flex-row items-center gap-x-2;
} }

4
packages/nc-gui/utils/commonUtils.ts

@ -55,3 +55,7 @@ export const ncArrayFrom = <T>(
): T[] => { ): T[] => {
return Array.from({ length }, (_, i) => contentCallback(i)) return Array.from({ length }, (_, i) => contentCallback(i))
} }
export const isUnicodeEmoji = (emoji: string) => {
return !!emoji?.match(/(\p{Emoji}|\p{Extended_Pictographic})/gu)
}

Loading…
Cancel
Save