Skip to content

Commit 8be13d8

Browse files
committed
(docs) add online status and typing indicator
1 parent 29305f4 commit 8be13d8

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
- Images, files & emojis
2020
- Edit messages
2121
- Reply to other messages
22+
- UI elements for seen, new, deleted and typing messages
23+
- Online / Offline status
2224
- Flexible options
23-
- UI elements for seen, new and deleted messages
2425
- Custom theming - light and dark modes
2526
- Firestore example
2627
- Web Component support
@@ -199,7 +200,9 @@ styles="{
199200
},
200201
201202
header: {
202-
background: '#fff'
203+
background: '#fff',
204+
colorRoomName: '#0a0a0a',
205+
colorRoomInfo: '#9ca6af'
203206
},
204207
205208
footer: {
@@ -230,6 +233,7 @@ styles="{
230233
background: '#fff',
231234
backgroundMe: '#ccf2cf',
232235
color: '#0a0a0a',
236+
colorStarted: '#9ca6af',
233237
backgroundDeleted: '#dadfe2',
234238
colorDeleted: '#757e85',
235239
colorUsername: '#9ca6af',
@@ -310,17 +314,33 @@ rooms="[
310314
users: [
311315
{
312316
_id: 1234,
313-
username: 'John Doe'
317+
username: 'John Doe',
318+
status: {
319+
state: 'online',
320+
last_changed: 'today, 14:30'
321+
}
314322
},
315323
{
316324
_id: 4321,
317-
username: 'John Snow'
325+
username: 'John Snow',
326+
status: {
327+
state: 'offline',
328+
last_changed: '14 July, 20:00'
329+
}
318330
}
319-
]
331+
],
332+
typingUsers: [ 4321 ]
320333
}
321334
]"
322335
```
323336

337+
- For each room user, you can add the `status` property, which can hold the `state` and `last_changed` properties:
338+
339+
- `state` can be `'online'` or `'offline'`
340+
- `last_changed` is the date when `state` was last modified.
341+
342+
- `typingUsers` is an array of all the users who are currently writing a message
343+
324344
### Messages prop
325345

326346
Message objects are rendered differently depending on their type. Currently, only text, emoji and file types are supported.<br>
@@ -368,6 +388,7 @@ messages="[
368388
| menuActionHandler (2) | `{ roomId, action }` | A user clicks on the vertical dots icon inside a room |
369389
| messageActionHandler (3) | `{ roomId, action }` | A user clicks on the dropdown icon inside a message |
370390
| sendMessageReaction | `{ roomId, messageId, reaction, remove }` | A user clicks on the emoji icon inside a message |
391+
| typingMessage | `{ message, roomId }` | A user is typing a message |
371392

372393
(1) `fetchMessages` should be a method implementing a pagination system. Its purpose is to load older messages of a conversation when the user scroll on top
373394

0 commit comments

Comments
 (0)