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 : ( - + )}