Files
RenewCMS/web/src/components/ActivityActor.vue
T

26 lines
849 B
Vue

<script setup lang="ts">
import { t } from '@/i18n'
import { computed } from 'vue'
import ActivityAvatar from '@/components/ActivityAvatar.vue'
import ActivityBadge from '@/components/ActivityBadge.vue'
import { type ActivityActor } from '@/lib/activity'
const props = defineProps<{
actor: ActivityActor
}>()
const displayName = computed(() =>
props.actor.type === 'anonymous' ? t('Not signed in') : props.actor.name,
)
</script>
<template>
<span class="flex min-w-0 items-center gap-2" data-testid="activity-actor">
<ActivityAvatar :actor="actor" />
<span class="min-w-0 truncate font-medium text-highlighted">{{ displayName }}</span>
<ActivityBadge v-if="actor.type === 'api_key'" tone="neutral" :label="t('API key')" />
<ActivityBadge v-else-if="actor.type === 'system'" tone="neutral" :label="t('System')" />
</span>
</template>