diff --git a/apps/web/app/(app)/recipes/[id]/page.tsx b/apps/web/app/(app)/recipes/[id]/page.tsx index 543bbbf..ecac380 100644 --- a/apps/web/app/(app)/recipes/[id]/page.tsx +++ b/apps/web/app/(app)/recipes/[id]/page.tsx @@ -19,6 +19,7 @@ import { auth } from "@/lib/auth/server"; import { db, recipes, ratings, favorites, avg } from "@epicure/db"; import { and, eq, or, count, inArray } from "@epicure/db"; import { Badge } from "@/components/ui/badge"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { buttonVariants } from "@/components/ui/button"; import { Separator } from "@/components/ui/separator"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; @@ -62,6 +63,7 @@ export default async function RecipePage({ params }: Params) { ingredients: { orderBy: (t, { asc }) => asc(t.order) }, steps: { orderBy: (t, { asc }) => asc(t.order) }, photos: { orderBy: (t, { asc }) => asc(t.order) }, + author: { columns: { id: true, name: true, username: true, avatarUrl: true } }, }, }), db.select({ avgScore: avg(ratings.score), total: count() }).from(ratings).where(eq(ratings.recipeId, id)), @@ -91,6 +93,18 @@ export default async function RecipePage({ params }: Params) { {/* Header */}

{recipe.title}

+ {!isOwner && recipe.author.username && ( + + + {recipe.author.avatarUrl && } + {recipe.author.name.slice(0, 2).toUpperCase()} + + {formatMessage(m.recipe.byAuthor, { name: recipe.author.name })} + + )}
{recipe.steps.length > 0 && ( diff --git a/apps/web/messages/en.json b/apps/web/messages/en.json index 1d8e70c..951d924 100644 --- a/apps/web/messages/en.json +++ b/apps/web/messages/en.json @@ -29,6 +29,7 @@ "mention": "{name} mentioned you in a comment" }, "recipe": { + "byAuthor": "by {name}", "source": "Source", "share": "Share", "shareLinkCopied": "Link copied to clipboard", diff --git a/apps/web/messages/fr.json b/apps/web/messages/fr.json index b766bff..6a3f42d 100644 --- a/apps/web/messages/fr.json +++ b/apps/web/messages/fr.json @@ -29,6 +29,7 @@ "mention": "{name} vous a mentionné dans un commentaire" }, "recipe": { + "byAuthor": "par {name}", "source": "Source", "share": "Partager", "shareLinkCopied": "Lien copié dans le presse-papiers",