From 3ebda6fd47a58394cdfe9034778ec5c1dd6800cd Mon Sep 17 00:00:00 2001 From: Thomas Petersen Date: Tue, 4 Aug 2026 22:52:49 +0200 Subject: [PATCH] feat(desktop): show the adder's avatar in the catalog "Added by" line The catalog detail header named the entry's publisher but showed no face. Resolve the publisher's profile picture (or the viewer's own for "Added by You") and render it inline before the name. Signed-off-by: Thomas Petersen --- .../src/features/agents/ui/PersonaAddedBy.tsx | 20 +++++++++++-- .../agents/ui/PersonaCatalogDialog.tsx | 28 +++++++++++-------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/desktop/src/features/agents/ui/PersonaAddedBy.tsx b/desktop/src/features/agents/ui/PersonaAddedBy.tsx index 3cdec29104..f93df37f99 100644 --- a/desktop/src/features/agents/ui/PersonaAddedBy.tsx +++ b/desktop/src/features/agents/ui/PersonaAddedBy.tsx @@ -1,18 +1,32 @@ +import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar"; import { cn } from "@/shared/lib/cn"; type PersonaAddedByProps = { + /** The adder's profile picture; omitted while the profile resolves. */ + avatarUrl?: string | null; className?: string; label?: string; }; export function PersonaAddedBy({ + avatarUrl, className, label = "You", }: PersonaAddedByProps) { return ( -

- Added by{" "} - {label} +

+ Added by + + {label}

); } diff --git a/desktop/src/features/agents/ui/PersonaCatalogDialog.tsx b/desktop/src/features/agents/ui/PersonaCatalogDialog.tsx index ae8a694250..b2f1b059bf 100644 --- a/desktop/src/features/agents/ui/PersonaCatalogDialog.tsx +++ b/desktop/src/features/agents/ui/PersonaCatalogDialog.tsx @@ -4,6 +4,7 @@ import { isCatalogPersonaSelected } from "@/features/agents/lib/catalog"; import { isCatalogPersona } from "@/features/agents/lib/personaCatalogRelay"; import { useUsersBatchQuery } from "@/features/profile/hooks"; import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar"; +import { useIdentityQuery } from "@/shared/api/hooks"; import type { AgentPersona } from "@/shared/api/types"; import { useFeedbackToasts } from "@/shared/hooks/useToastEffect"; import { cn } from "@/shared/lib/cn"; @@ -306,22 +307,23 @@ function PersonaCatalogDetail({ }) { const isCommunityEntry = isCatalogPersona(persona) && !persona.catalogSource.isOwn; + const identityQuery = useIdentityQuery(); + // Community entries resolve their publisher's profile; own/local entries + // resolve the viewer's, so "Added by You" carries the viewer's avatar. const ownerPubkey = isCommunityEntry ? persona.catalogSource.ownerPubkey - : undefined; + : identityQuery.data?.pubkey; const ownerBatchQuery = useUsersBatchQuery(ownerPubkey ? [ownerPubkey] : [], { enabled: !!ownerPubkey, }); + const ownerSummary = ownerPubkey + ? ownerBatchQuery.data?.profiles[ownerPubkey.toLowerCase()] + : undefined; - let addedByLabel: string; - if (!isCommunityEntry) { - addedByLabel = "You"; - } else { - const summary = ownerPubkey - ? ownerBatchQuery.data?.profiles[ownerPubkey.toLowerCase()] - : undefined; - addedByLabel = resolveCatalogOwnerLabel(summary); - } + const addedByLabel = isCommunityEntry + ? resolveCatalogOwnerLabel(ownerSummary) + : "You"; + const addedByAvatarUrl = ownerSummary?.avatarUrl ?? null; return (
@@ -336,7 +338,11 @@ function PersonaCatalogDetail({ {persona.displayName} {persona.isBuiltIn ? null : ( - + )}