Browse Source

fix: user bg color

pull/6486/head
sreehari jayaraj 1 year ago
parent
commit
a1816006e0
  1. 29
      packages/nc-gui/components/general/UserIcon.vue
  2. 3
      packages/nc-gui/components/smartsheet/expanded-form/Comments.vue

29
packages/nc-gui/components/general/UserIcon.vue

@ -1,14 +1,27 @@
<script lang="ts" setup>
import type { UserType } from 'nocodb-sdk'
const props = defineProps<{
size?: 'small' | 'medium' | 'base' | 'large' | 'xlarge'
name?: string
user: UserType
}>()
const props = withDefaults(
defineProps<{
size?: 'small' | 'medium' | 'base' | 'large' | 'xlarge'
name?: string
commentOwner?: string
}>(),
{
commentOwner: '',
},
)
const user = toRef(props, 'user')
const { user } = useGlobal()
const backgroundColor = computed(() => (user.value?.id ? stringToColour(user.value?.id) : '#FFFFFF'))
const commentOwner = toRef(props, 'commentOwner')
const backgroundColor = computed(() => {
// in comments we need to generate user icon from email
if (commentOwner.value.length) {
return stringToColour(commentOwner.value)
}
return user.value?.email ? stringToColour(user.value?.email) : '#FFFFFF'
})
const size = computed(() => props.size || 'medium')

3
packages/nc-gui/components/smartsheet/expanded-form/Comments.vue

@ -163,7 +163,8 @@ const processedAudit = (log: string) => {
<div class="flex flex-col p-4 gap-3">
<div class="flex justify-between">
<div class="flex items-center gap-2">
<GeneralUserIcon size="base" :name="log.display_name ?? log.user" :user="log" />
<GeneralUserIcon size="base" :name="log.display_name ?? log.user" :comment-owner="log.user" />
<div class="flex flex-col">
<span class="truncate font-bold max-w-42">
{{ log.display_name ?? log.user.split('@')[0] ?? 'Shared base' }}

Loading…
Cancel
Save