feat: Show recipe owner (#8823)
This commit is contained in:
1 parent
0c71c2a226
commit
f630bc3c00
2 files changed
+24
-2
No files matched your search
+19
@@ -21,6 +21,18 @@
|
||||
:recipe-id="recipe.id"
|
||||
:slug="recipe.slug"
|
||||
/>
|
||||
<div
|
||||
v-if="isOwnGroup && owner"
|
||||
class="d-flex align-center mb-2"
|
||||
>
|
||||
<UserAvatar
|
||||
:user-id="owner.id"
|
||||
:tooltip="false"
|
||||
size="32"
|
||||
class="mr-2"
|
||||
/>
|
||||
{{ owner.fullName }}
|
||||
</div>
|
||||
</div>
|
||||
<v-divider class="my-2" />
|
||||
<SafeMarkdown :source="recipe.description" class="my-3" />
|
||||
@@ -86,7 +98,10 @@ import RecipeLastMade from "~/components/Domain/Recipe/RecipeLastMade.vue";
|
||||
import RecipeTimeCard from "~/components/Domain/Recipe/RecipeTimeCard.vue";
|
||||
import RecipeYield from "~/components/Domain/Recipe/RecipeYield.vue";
|
||||
import RecipePageInfoCardImage from "~/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageInfoCardImage.vue";
|
||||
import UserAvatar from "~/components/Domain/User/UserAvatar.vue";
|
||||
import { useUserStore } from "~/composables/store/use-user-store";
|
||||
import type { Recipe } from "~/lib/api/types/recipe";
|
||||
import type { UserSummary } from "~/lib/api/types/user";
|
||||
import type { NoUndefinedField } from "~/lib/api/types/non-generated";
|
||||
|
||||
interface Props {
|
||||
@@ -101,6 +116,10 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
|
||||
const { isOwnGroup } = useLoggedInState();
|
||||
|
||||
// group members aren't visible outside the group, so don't fetch them
|
||||
const users = isOwnGroup.value ? useUserStore().store : ref<UserSummary[]>([]);
|
||||
const owner = computed(() => users.value.find(u => u.id === props.recipe.userId));
|
||||
|
||||
const hasTime = computed(() => {
|
||||
const { prepTime, totalTime, performTime, prepTimeSeconds, totalTimeSeconds, performTimeSeconds } = props.recipe;
|
||||
return [prepTime, totalTime, performTime, prepTimeSeconds, totalTimeSeconds, performTimeSeconds].some(x => !!x);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<template #activator="{ props: tooltipProps }">
|
||||
<v-avatar
|
||||
v-if="list"
|
||||
v-bind="tooltipProps"
|
||||
v-bind="{ ...tooltipProps, ...$attrs }"
|
||||
>
|
||||
<v-img
|
||||
:src="imageURL"
|
||||
@@ -19,7 +19,7 @@
|
||||
<v-avatar
|
||||
v-else
|
||||
:size="size"
|
||||
v-bind="tooltipProps"
|
||||
v-bind="{ ...tooltipProps, ...$attrs }"
|
||||
>
|
||||
<v-img
|
||||
:src="imageURL"
|
||||
@@ -38,6 +38,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useUserStore } from "~/composables/store/use-user-store";
|
||||
|
||||
// the root element is the tooltip, so forward class/style/etc. to the avatar instead
|
||||
defineOptions({ inheritAttrs: false });
|
||||
|
||||
const props = defineProps({
|
||||
userId: {
|
||||
type: String,
|
||||
|
||||
Reference in new issue
Block a user