plazbot
Version:
Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.
31 lines (30 loc) • 1 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { agentColorToHex } from '../../styles/theme';
import { widgetIconSVG } from '../../styles/icons';
export function AgentAvatar({ name, color, icon, size = 28, style }) {
const bg = agentColorToHex(color);
const initials = name
? name
.split(' ')
.map((w) => w[0])
.join('')
.toUpperCase()
.slice(0, 2)
: '';
const displayIcon = icon ? widgetIconSVG(icon, size * 0.5) : null;
return (_jsx("div", { style: {
width: size,
height: size,
borderRadius: '50%',
backgroundColor: bg,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: '#ffffff',
fontSize: size * 0.38,
fontWeight: 600,
fontFamily: 'sans-serif',
flexShrink: 0,
...style,
}, children: displayIcon ?? initials }));
}