({
currentUser,
...rest
}: {
usersTyping: string[];
currentUser?: SerializedUser | null;
})
| 4 | const typingTimeout = 2000; |
| 5 | |
| 6 | export function UsersTyping({ |
| 7 | currentUser, |
| 8 | ...rest |
| 9 | }: { |
| 10 | usersTyping: string[]; |
| 11 | currentUser?: SerializedUser | null; |
| 12 | }) { |
| 13 | const usersTyping = useMemo( |
| 14 | () => rest.usersTyping.filter((u) => u !== currentUser?.displayName), |
| 15 | [rest.usersTyping, currentUser] |
| 16 | ); |
| 17 | |
| 18 | if (!usersTyping.length) { |
| 19 | return <></>; |
| 20 | } |
| 21 | |
| 22 | const isAre = usersTyping.length === 1 ? 'is' : 'are'; |
| 23 | return ( |
| 24 | <span |
| 25 | style={{ |
| 26 | fontSize: 'small', |
| 27 | fontStyle: 'italic', |
| 28 | color: 'var(--color-gray-400)', |
| 29 | position: 'absolute', |
| 30 | }} |
| 31 | > |
| 32 | {usersTyping.join(', ')} {isAre} typing... |
| 33 | </span> |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | export function TypingFunctions({ |
| 38 | isUserTyping, |
nothing calls this directly
no outgoing calls
no test coverage detected