Skip to content

Commit

Permalink
feat(leave/join): add leave and join message
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Nov 17, 2019
1 parent 6e20f62 commit 43bdc2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The plugin must set an interval that asks for new updates every n milliseconds.
### Todolist/Featurelist

- [x] set custom server URL ([https://github.com/ph1p/figma-chat-server](https://github.com/ph1p/figma-chat-server))
- [ ] add leave and join message
- [x] add leave and join message
- [ ] add typing info
- [x] notifications (first version)
- [x] save local history
Expand Down
9 changes: 9 additions & 0 deletions src/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ const init = serverUrl => {
state.addMessage(data);
});

socket.on('join leave message', data => {
const username = data.user.name || 'Anon';
const message = 'joined the chat';
if (data.type === 'LEAVE') {
const message = 'leaved the chat';
}
state.addNotification(`${username} ${message}`);
});

socket.on('online', data => (state.online = data));

sendMainMessage('get-root-data');
Expand Down

0 comments on commit 43bdc2f

Please sign in to comment.