import { ChatParticipantIcon, getNameInitialsFirst } from '@servicetitan/titan-chat-ui-common'; import { useMemo } from 'react'; import { IMessageAvatarProps } from './message-avatar'; export const useAvatarProps = (name: string, icon: ChatParticipantIcon): IMessageAvatarProps => { return useMemo( () => ({ name: name.length && icon === ChatParticipantIcon.Initials ? getNameInitialsFirst(name) : name, icon, }), [icon, name] ); };