chore: more cleanups

This commit is contained in:
Muhsin Keloth
2024-04-25 10:33:51 +05:30
parent b5185c0100
commit 73a5796910
2 changed files with 4 additions and 10 deletions
@@ -24,7 +24,7 @@ const colors = {
};
const props = defineProps({
username: {
name: {
type: String,
default: '',
},
@@ -39,11 +39,11 @@ const style = computed(() => ({
}));
const colorClass = computed(() => {
return colors[(props.username.length % 8) + 1];
return colors[(props.name.length % 8) + 1];
});
const userInitial = computed(() => {
const parts = props.username.split(/[ -]/).filter(Boolean);
const parts = props.name.split(/[ -]/).filter(Boolean);
let initials = parts.map(part => part[0].toUpperCase()).join('');
return initials.slice(0, 2);
});
@@ -18,11 +18,7 @@
@load="onImageLoad"
@error="onImageLoadError"
/>
<initials-avatar
v-if="!shouldShowImage"
:username="userNameWithoutEmoji"
:size="72"
/>
<initials-avatar v-if="!shouldShowImage" username="name" :size="72" />
<input
ref="fileInputRef"
@@ -54,7 +50,6 @@
<script setup>
import { computed, ref } from 'vue';
import InitialsAvatar from 'v3/components/Form/InitialsAvatar.vue';
import { removeEmoji } from 'shared/helpers/emoji';
const props = defineProps({
src: {
type: String,
@@ -72,7 +67,6 @@ const hasImageLoaded = ref(false);
const imageLoadedError = ref(false);
const shouldShowUploadIcon = ref(false);
const fileInputRef = ref(null);
const userNameWithoutEmoji = computed(() => removeEmoji(props.name));
const shouldShowFallback = computed(() => !props.src && !props.name);