Skip to content

Commit

Permalink
Fully Implement Add Typing Start
Browse files Browse the repository at this point in the history
  • Loading branch information
theADAMJR committed Aug 13, 2021
1 parent 6b44370 commit eeb7519
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frontend/src/components/channel/message-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ const MessageBox: React.FunctionComponent<MessageBoxProps> = (props) => {
const user = (userId: string) => getUser(userId)(store.getState());

const typingMessage = () => {
if (!typers.length) return;

const maxTypers = 3;
const typingUsers = typers.map(t => user(t.userId)!.username).join(', ');

if (!typers.length) return;

return (typers.length > maxTypers)
? 'Many users are typing...'
: `${typingUsers} is typing...`
Expand All @@ -70,7 +69,7 @@ const MessageBox: React.FunctionComponent<MessageBoxProps> = (props) => {
autoFocus />
{(props.editingMessageId)
? <span className="text-xs py-2">escape to cancel • enter to save</span>
: <div className="w-full h-6">{typingMessage()}</div>}
: <div className="text-sm w-full h-6">{typingMessage()}</div>}
</div>
);
}
Expand Down

0 comments on commit eeb7519

Please sign in to comment.