import { Avatar } from '@mui/material' import type { FormulaWidgetState, ValueProps } from '../types' import { useWidgetSelector } from '../../stores/use-widget-selector' /** * Renders a colored avatar badge showing the first letter of the series name for multi-value formula widgets. */ export function Series({ id, index = 0 }: Pick) { const serie = useWidgetSelector( id, (w) => (w as FormulaWidgetState | undefined)?.series?.[index], ) if (!serie) { return null } const { name, color } = serie return ( theme.palette.getContrastText(color), }), }} > {name.charAt(0).toUpperCase()} ) }