diff --git a/ui/src/pages/Admin/EnvironmentsPage.tsx b/ui/src/pages/Admin/EnvironmentsPage.tsx index 40aa9d36..07f67e1c 100644 --- a/ui/src/pages/Admin/EnvironmentsPage.tsx +++ b/ui/src/pages/Admin/EnvironmentsPage.tsx @@ -1,6 +1,5 @@ import { useState, useMemo, useEffect } from 'react'; import { - Avatar, Badge, Button, Input, @@ -394,24 +393,50 @@ export default function EnvironmentsPage() { // ── Env-colored Avatar ────────────────────────────────────────────── +// Custom circular initial badge filled with the environment's color. We don't +// wrap the DS `Avatar` because it picks its background from a name hash with +// no color override — we need the env color to be the dominant signal. +const ENV_AVATAR_SIZES = { sm: 24, md: 28, lg: 40 } as const; +const ENV_AVATAR_FONT = { sm: 10, md: 12, lg: 16 } as const; + +function envInitials(displayName: string): string { + const words = displayName.trim().split(/\s+/).filter(Boolean); + if (words.length === 0) return '?'; + if (words.length === 1) return words[0].slice(0, 2).toUpperCase(); + return (words[0][0] + words[1][0]).toUpperCase(); +} + function EnvColoredAvatar({ name, color, size }: { name: string; color: string | null | undefined; size: 'sm' | 'md' | 'lg'; }) { - const ringWidth = size === 'lg' ? 3 : 2; + const dimension = ENV_AVATAR_SIZES[size]; + const fontSize = ENV_AVATAR_FONT[size]; return ( - + {envInitials(name)} ); }