mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Show persona avatars on agent cards
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user