chore: more cleanups
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user