import type { ConversationMember } from '@chat-app/shared/chat'; import { useTranslation } from 'react-i18next'; interface Props { typingUserIds: string[]; members: ConversationMember[]; } export function TypingIndicator({ typingUserIds, members }: Props) { const { t } = useTranslation(['app']); if (typingUserIds.length === 0) return null; const names = typingUserIds .map((id) => members.find((m) => m.userId === id)?.profile?.displayName) .filter((n): n is string => typeof n === 'string' && n.length > 0); const text = names.length === 1 ? t('app:chats.typing_one', { name: names[0] }) : t('app:chats.typing_many', { count: typingUserIds.length }); return (
{text}
); } function TypingDots() { return (