Skip to content

Commit b58a653

Browse files
committed
(slots) add no-room-selected
1 parent 83466c0 commit b58a653

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fetchMessages({ room, options }) {
171171
| rooms | Array | - | [ ] |
172172
| loadingRooms (2) | Boolean | - | false |
173173
| roomId (3) | [String, Number] | - | null |
174-
| loadFirstRoom (4) | Boolean | - | true |
174+
| loadFirstRoom (4) | Boolean | - | true |
175175
| messages | Array | - | [ ] |
176176
| roomMessage (5) | Object | - | null |
177177
| messagesLoaded (6) | Boolean | - | false |
@@ -184,7 +184,7 @@ fetchMessages({ room, options }) {
184184
| showEmojis | Boolean | - | true |
185185
| showReactionEmojis | Boolean | - | true |
186186
| showNewMessagesDivider (9) | Boolean | - | true |
187-
| textMessages (10) | Object | - | null |
187+
| textMessages (10) | Object | - | null |
188188
| textFormatting (11) | Boolean | - | true |
189189
| responsiveBreakpoint (12) | Number | - | 900 |
190190
| singleRoom (13) | Boolean | - | false |
@@ -629,7 +629,8 @@ Example:
629629
| room-options | Replace the template of the room options | - | menu-icon |
630630
| message | Replace the template of the message box | message | deleted-icon, eye-icon, document-icon, pencil-icon, checkmark-icon, dropdown-icon, emoji-picker-icon |
631631
| messages-empty | Replace the empty message template | - | - |
632-
| rooms-empty | Replace the empty room template | - | - |
632+
| rooms-empty | Replace the empty rooms template | - | - |
633+
| no-room-selected | Replace the no room selected template | - | - |
633634
| menu-icon | Replace the room menu icon | - | - |
634635
| toggle-icon | Replace the toggle room list icon | - | - |
635636
| scroll-icon | Replace the scroll to newest message icon | - | - |

src/ChatWindow/ChatWindow.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
</rooms-list>
2222

2323
<room
24+
v-if="room.roomId || loadFirstRoom"
2425
:currentUserId="currentUserId"
2526
:rooms="rooms"
2627
:roomId="room.roomId || ''"
@@ -60,6 +61,11 @@
6061
<slot :name="name" v-bind="data"></slot>
6162
</template>
6263
</room>
64+
<slot v-else name="no-room-selected">
65+
<div class="container-center room-empty">
66+
{{ t.ROOM_EMPTY }}
67+
</div>
68+
</slot>
6369
</div>
6470
</div>
6571
</template>
@@ -320,4 +326,23 @@ a {
320326
-webkit-appearance: none;
321327
}
322328
}
329+
330+
.container-center {
331+
height: 100%;
332+
width: 100%;
333+
display: flex;
334+
flex-direction: column;
335+
justify-content: center;
336+
align-items: center;
337+
text-align: center;
338+
}
339+
340+
.room-empty {
341+
font-size: 14px;
342+
color: #9ca6af;
343+
font-style: italic;
344+
padding: 0 10%;
345+
line-height: 20px;
346+
white-space: pre-line;
347+
}
323348
</style>

src/locales/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export default {
22
ROOMS_EMPTY: 'No rooms',
3+
ROOM_EMPTY: 'No room selected',
34
NEW_MESSAGES: 'New Messages',
45
MESSAGE_DELETED: 'This message was deleted',
56
MESSAGES_EMPTY: 'No messages',

0 commit comments

Comments
 (0)