Show persona avatars on agent cards

This commit is contained in:
klopez4212
2026-06-22 15:43:28 +01:00
parent 4fe66cfb06
commit 430ecb9f2f
3 changed files with 25 additions and 7 deletions
@@ -3,6 +3,7 @@ import { AgentProviderCollage } from "./AgentProviderCollage";
type AgentIdentityCardProps = {
ariaLabel: string;
avatarUrl?: string | null;
dataTestId: string;
label: string;
modelLabel: string;
@@ -11,6 +12,7 @@ type AgentIdentityCardProps = {
export function AgentIdentityCard({
ariaLabel,
avatarUrl,
dataTestId,
label,
modelLabel,
@@ -26,7 +28,7 @@ export function AgentIdentityCard({
onClick={onClick}
type="button"
>
<AgentProviderCollage label={label} />
<AgentProviderCollage avatarUrl={avatarUrl} label={label} />
<div className="absolute right-3 bottom-3 left-3 z-30 flex min-w-0 flex-col gap-0.5 text-left text-sm leading-5">
<span className="min-w-0 truncate font-semibold text-foreground tracking-normal">
@@ -1,5 +1,6 @@
import type { CSSProperties } from "react";
import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar";
import { IdentityInitialsAvatar } from "./IdentityInitialsAvatar";
type ClusterLayout = {
@@ -7,13 +8,17 @@ type ClusterLayout = {
};
type AgentProviderCollageProps = {
avatarUrl?: string | null;
label: string;
};
const CLUSTER_CENTER_TOP_PERCENT = 50;
const AGENT_INITIAL_AVATAR_SIZE = 152;
export function AgentProviderCollage({ label }: AgentProviderCollageProps) {
export function AgentProviderCollage({
avatarUrl,
label,
}: AgentProviderCollageProps) {
const { avatarStyle } = buildClusterPoints();
return (
@@ -24,11 +29,21 @@ export function AgentProviderCollage({ label }: AgentProviderCollageProps) {
data-agent-cluster-item="avatar"
style={avatarStyle}
>
<IdentityInitialsAvatar
colorSeed={label}
label={label}
size={AGENT_INITIAL_AVATAR_SIZE}
/>
{avatarUrl ? (
<ProfileAvatar
avatarUrl={avatarUrl}
className="h-full w-full"
iconClassName="h-12 w-12"
label={label}
testId="agent-card-avatar"
/>
) : (
<IdentityInitialsAvatar
colorSeed={label}
label={label}
size={AGENT_INITIAL_AVATAR_SIZE}
/>
)}
</div>
</div>
</div>
@@ -231,6 +231,7 @@ function AgentPersonaCard({
return (
<AgentIdentityCard
ariaLabel={`${title} agent profile`}
avatarUrl={persona.avatarUrl}
dataTestId={`persona-agent-row-${persona.id}`}
label={title}
modelLabel={modelLabel}