Skip to content

Commit 4f3b850

Browse files
committed
Added UserAvatar component
1 parent ae7ccbc commit 4f3b850

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@websitebeaver/vue-magnifier": "^1.1.0",
2121
"dayjs": "^1.11.13",
2222
"exifr": "^7.1.3",
23-
"mosquito-alert": "github:mosquito-alert/mosquito-alert-typescript-sdk#0.1.18",
23+
"mosquito-alert": "github:mosquito-alert/mosquito-alert-typescript-sdk#0.1.19",
2424
"pinia": "^3.0.1",
2525
"primeicons": "^7.0.0",
2626
"primevue": "^4.3.3",

src/components/IdentificationTaskList.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
<Column header="Assignations">
2929
<template #body="slotProps">
3030
<AvatarGroup>
31-
<Avatar v-for="assignment, index in slotProps.data.assignments" :key="index" icon="pi pi-user" shape="circle"
32-
:label="getInitials(assignment.user.full_name)"
33-
v-tooltip.top="assignment.annotation_id === null ? `${assignment.user.full_name} (Pending)` : assignment.user.full_name"
31+
<UserAvatar v-for="assignment, index in slotProps.data.assignments" :key="index" :user="assignment.user"
32+
v-tooltip.top="assignment.annotation_id === null ? `${assignment.user.full_name || assignment.user.username} (Pending)` : assignment.user.full_name || assignment.user.username"
3433
:class="assignment.annotation_id ? '' : 'border-(--p-tag-warn-color)! bg-(--p-tag-warn-background)! text-(--p-tag-warn-color)!'" />
3534
</AvatarGroup>
3635
</template>
@@ -78,9 +77,10 @@ import type { DataTableRowClickEvent } from 'primevue';
7877
7978
import type { IdentificationTask } from 'mosquito-alert';
8079
80+
import UserAvatar from './users/UserAvatar.vue';
81+
8182
import { getStatusSeverity } from '@/utils/IdentificationTaskUtils';
8283
import { formatLocalDateTime } from '@/utils/DateUtils';
83-
import { getInitials } from '@/utils/Utils';
8484
8585
defineProps<{
8686
tasks: IdentificationTask[],

src/components/annotations/AnnotationPanel.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<Panel toggleable :collapsed="collapsed">
33
<template #header>
44
<div class="flex items-center gap-2">
5-
<Avatar icon="pi pi-user" shape="circle" :label="getInitials(annotation?.user.full_name || '')" />
6-
<span class="font-bold">{{ annotation?.user.full_name }}</span>
5+
<UserAvatar :user="annotation?.user" />
6+
<span class="font-bold">{{ annotation?.user.full_name || annotation?.user.username }}</span>
77
<AnnotationTypeTag v-if="annotation.type === AnnotationType.Long" :type="annotation.type" />
88
<Tag v-if="annotation?.is_flagged" icon="pi pi-flag" severity="danger" value="Flagged" rounded />
99
<Tag v-if="annotation?.is_decisive" severity="contrast" value="Executive" rounded
@@ -54,9 +54,9 @@
5454
import type { Annotation } from 'mosquito-alert';
5555
import { AnnotationType } from 'mosquito-alert';
5656
import TaxonClassificationTag from '../taxa/TaxonClassificationTag.vue';
57+
import UserAvatar from '../users/UserAvatar.vue';
5758
import AnnotationTypeTag from './AnnotationTypeTag.vue';
5859
59-
import { getInitials } from '@/utils/Utils';
6060
import { formatLocalDateTime } from '@/utils/DateUtils';
6161
6262
withDefaults(defineProps<{
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<Avatar icon="pi pi-user" shape="circle" :label="getInitials(user?.full_name || user?.username || '')" />
3+
</template>
4+
5+
<script setup lang="ts">
6+
import { getInitials } from '@/utils/Utils';
7+
import type { User, SimpleAnnotatorUser } from 'mosquito-alert';
8+
9+
defineProps<{
10+
user: User | SimpleAnnotatorUser | null
11+
}>();
12+
</script>

src/layout/AppTopbar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<Button class="p-2!" icon="pi pi-user" :label="username" rounded variant="outlined" severity="secondary"
3636
@click="profileMenuToggle">
3737
<template #icon>
38-
<Avatar icon="pi pi-user" shape="circle" :label="getInitials(username || '')" />
38+
<UserAvatar :user="userStore.user" />
3939
</template>
4040
</Button>
4141
<Menu ref="profileMenu" id="overlay_menu" :model="profileMenuItems" :popup="true" />
@@ -51,7 +51,7 @@ import { ref } from 'vue';
5151
import { useRouter } from 'vue-router';
5252
5353
import { useLayout } from './composables/layout';
54-
import { getInitials } from '@/utils/Utils';
54+
import UserAvatar from '@/components/users/UserAvatar.vue';
5555
import { useAuthStore } from '@/stores/authStore';
5656
import { useUserStore } from '@/stores/userStore';
5757

0 commit comments

Comments
 (0)