"use client"; import { motion, AnimatePresence } from "framer-motion"; import { useCollaborationContextOptional } from "./CollaborationProvider"; // ─── Animated dots ──────────────────────────────────────────────────────────── function Dots() { return ( {[0, 1, 2].map((i) => ( ))} ); } // ─── TypingIndicator ────────────────────────────────────────────────────────── export function TypingIndicator() { const ctx = useCollaborationContextOptional(); if (!ctx) return null; const { typingUsers } = ctx; if (typingUsers.length === 0) return null; let label: string; if (typingUsers.length === 1) { label = `${typingUsers[0].name} is typing`; } else if (typingUsers.length === 2) { label = `${typingUsers[0].name} and ${typingUsers[1].name} are typing`; } else { label = `${typingUsers.length} people are typing`; } return ( {/* Colored dots for each typing user */} {typingUsers.slice(0, 3).map((u) => ( {u.name[0].toUpperCase()} ))} {label} ); }