MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / UsersTyping

Function UsersTyping

apps/web/ui/Thread/UsersTyping.tsx:6–35  ·  view source on GitHub ↗
({
  currentUser,
  ...rest
}: {
  usersTyping: string[];
  currentUser?: SerializedUser | null;
})

Source from the content-addressed store, hash-verified

4const typingTimeout = 2000;
5
6export 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
37export function TypingFunctions({
38 isUserTyping,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected