mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 14:09:19 +02:00
22 lines
578 B
Vue
22 lines
578 B
Vue
<template>
|
|
<img v-if="actor.icon && actor.icon.original" :src="actor.icon.small_square_crop" class="ui avatar circular image" />
|
|
<span v-else :style="defaultAvatarStyle" class="ui avatar circular label">{{ actor.preferred_username[0]}}</span>
|
|
</template>
|
|
|
|
<script>
|
|
import {hashCode, intToRGB} from '@/utils/color'
|
|
|
|
export default {
|
|
props: ['actor'],
|
|
computed: {
|
|
actorColor () {
|
|
return intToRGB(hashCode(this.actor.full_username))
|
|
},
|
|
defaultAvatarStyle () {
|
|
return {
|
|
'background-color': `#${this.actorColor}`
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|