Restore card model and error affordances

This commit is contained in:
klopez4212
2026-06-25 14:21:04 +01:00
parent a4588ca00d
commit b6ebac07bb
3 changed files with 29 additions and 5 deletions

View File

@@ -10,6 +10,8 @@ type AgentIdentityCardProps = {
avatarUrl?: string | null;
dataTestId: string;
label: string;
errorLabel?: string | null;
modelControl?: ReactNode;
modelLabel: string;
onClick: () => void;
status?: ReactNode;
@@ -20,7 +22,9 @@ export function AgentIdentityCard({
ariaLabel,
avatarUrl,
dataTestId,
errorLabel,
label,
modelControl,
modelLabel,
onClick,
status,
@@ -68,9 +72,19 @@ export function AgentIdentityCard({
<span className="min-w-0 truncate font-semibold text-foreground tracking-normal">
{label}
</span>
<span className="min-w-0 truncate font-normal text-secondary-foreground/75">
{modelLabel}
</span>
{modelControl ?? (
<span className="min-w-0 truncate font-normal text-secondary-foreground/75">
{modelLabel}
</span>
)}
{errorLabel ? (
<span
className="min-w-0 truncate text-2xs font-medium text-destructive"
title={errorLabel}
>
{errorLabel}
</span>
) : null}
</div>
</div>
);

View File

@@ -34,16 +34,16 @@ export function IdentityInitialsAvatar({
IDENTITY_INITIAL_AVATAR_CLASS_NAMES[
paletteIndex % IDENTITY_INITIAL_AVATAR_CLASS_NAMES.length
];
const fontSize = Math.round(Math.min(40, Math.max(22, size * 0.28)));
const textSizeClassName = size >= 80 ? "text-3xl" : "text-xl";
return (
<span
className={cn(
"flex h-full w-full items-center justify-center rounded-full border-[3px] border-background font-semibold shadow-sm",
colorClassName,
textSizeClassName,
className,
)}
style={{ fontSize }}
>
{initials.length > 0 ? initials : <UserRound className="h-8 w-8" />}
</span>

View File

@@ -16,8 +16,10 @@ import {
import { toast } from "sonner";
import { useActiveAgentTurns } from "@/features/agents/activeAgentTurnsStore";
import { friendlyAgentLastError } from "@/features/agents/lib/friendlyAgentLastError";
import { isManagedAgentActive } from "@/features/agents/lib/managedAgentControlActions";
import { AgentStatusBadge } from "@/features/agents/ui/AgentStatusBadge";
import { ModelPicker } from "@/features/agents/ui/ModelPicker";
import { useUserProfileQuery } from "@/features/profile/hooks";
import type {
AgentPersona,
@@ -390,6 +392,9 @@ function AgentPersonaCard({
const avatarUrl = agent
? firstAvatarUrl(profileQuery.data?.avatarUrl, persona.avatarUrl)
: persona.avatarUrl;
const friendlyError = agent
? friendlyAgentLastError(agent.lastError)?.copy
: null;
return (
<AgentIdentityCard
@@ -404,7 +409,9 @@ function AgentPersonaCard({
ariaLabel={`${title} agent profile`}
avatarUrl={avatarUrl}
dataTestId={`persona-agent-row-${persona.id}`}
errorLabel={friendlyError}
label={title}
modelControl={agent ? <ModelPicker agent={agent} /> : undefined}
modelLabel={modelLabel}
onClick={() => {
if (agent && onOpenAgentProfile) {
@@ -441,6 +448,7 @@ function StandaloneAgentCard({
}) {
const title = agent.name;
const profileQuery = useUserProfileQuery(agent.pubkey);
const friendlyError = friendlyAgentLastError(agent.lastError)?.copy;
return (
<AgentIdentityCard
@@ -448,7 +456,9 @@ function StandaloneAgentCard({
ariaLabel={`${title} agent profile`}
avatarUrl={profileQuery.data?.avatarUrl}
dataTestId={`managed-agent-${agent.pubkey}`}
errorLabel={friendlyError}
label={title}
modelControl={<ModelPicker agent={agent} />}
modelLabel={formatAgentModelLabel(agent.model)}
onClick={() => {
if (onOpenAgentProfile) {