'use client'
interface TypingIndicatorProps {
users: string[]
className?: string
}
export default function TypingIndicator({ users, className = '' }: TypingIndicatorProps) {
if (users.length === 0) return null
const formatTypingText = () => {
if (users.length === 1) {
return `${users[0]} is typing`
} else if (users.length === 2) {
return `${users[0]} and ${users[1]} are typing`
} else {
return `${users[0]} and ${users.length - 1} others are typing`
}
}
return (
)
}
// Minimal version for tight spaces
export function TypingDots({ className = '' }: { className?: string }) {
return (
)
}
// Chat-style typing indicator with avatar placeholders
export function ChatTypingIndicator({
users,
showAvatars = true,
className = '',
}: {
users: string[]
showAvatars?: boolean
className?: string
}) {
if (users.length === 0) return null
return (
{showAvatars && (
{users.slice(0, 3).map((user, index) => (
{user[0]?.toUpperCase()}
))}
)}
)
}