mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-11 15:47:13 -07:00
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend Tests (push) Waiting to run
Docker Nightly Production / Build Package (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
Release Drafter / ✏️ Draft release (push) Waiting to run
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
85 lines
1.7 KiB
Vue
85 lines
1.7 KiB
Vue
<template>
|
|
<v-tooltip
|
|
v-if="userId"
|
|
:disabled="!user || !tooltip"
|
|
right
|
|
>
|
|
<template #activator="{ props }">
|
|
<v-avatar
|
|
v-if="list"
|
|
v-bind="props"
|
|
>
|
|
<v-img
|
|
:src="imageURL"
|
|
:alt="userId"
|
|
@load="error = false"
|
|
@error="error = true"
|
|
/>
|
|
</v-avatar>
|
|
<v-avatar
|
|
v-else
|
|
:size="size"
|
|
v-bind="props"
|
|
>
|
|
<v-img
|
|
:src="imageURL"
|
|
:alt="userId"
|
|
@load="error = false"
|
|
@error="error = true"
|
|
/>
|
|
</v-avatar>
|
|
</template>
|
|
<span v-if="user">
|
|
{{ user.fullName }}
|
|
</span>
|
|
</v-tooltip>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { useUserStore } from "~/composables/store/use-user-store";
|
|
|
|
export default defineNuxtComponent({
|
|
props: {
|
|
userId: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
list: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
size: {
|
|
type: String,
|
|
default: "42",
|
|
},
|
|
tooltip: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
setup(props) {
|
|
const state = reactive({
|
|
error: false,
|
|
});
|
|
|
|
const $auth = useMealieAuth();
|
|
const { store: users } = useUserStore();
|
|
const user = computed(() => {
|
|
return users.value.find(user => user.id === props.userId);
|
|
});
|
|
|
|
const imageURL = computed(() => {
|
|
// Note: $auth.user is a ref now
|
|
const authUser = $auth.user.value;
|
|
const key = authUser?.cacheKey ?? "";
|
|
return `/api/media/users/${props.userId}/profile.webp?cacheKey=${key}`;
|
|
});
|
|
|
|
return {
|
|
user,
|
|
imageURL,
|
|
...toRefs(state),
|
|
};
|
|
},
|
|
});
|
|
</script>
|