diff --git a/webapp/components/Chat/Chat.vue b/webapp/components/Chat/Chat.vue index d7864ebef..f947f4886 100644 --- a/webapp/components/Chat/Chat.vue +++ b/webapp/components/Chat/Chat.vue @@ -4,7 +4,7 @@ -
-
- -
+
+ + + + + + + +
+ + + +
+
+
@@ -89,11 +107,6 @@ export default { data() { return { menuActions: [ - // NOTE: if menuActions is empty, the related slot is not shown - { - name: 'dummyItem', - title: 'Just a dummy item', - }, /* { name: 'inviteUser', @@ -197,10 +210,24 @@ export default { computed: { ...mapGetters({ currentUser: 'auth/user', + getStoreRoomId: 'chat/roomID', }), computedChatStyle() { return chatStyle.STYLE.light }, + computedRoomId() { + let roomId = null + + if (!this.singleRoom) { + roomId = this.roomId + + if (this.getStoreRoomId.roomId) { + roomId = this.getStoreRoomId.roomId + } + } + + return roomId + }, textMessages() { return { ROOMS_EMPTY: this.$t('chat.roomsEmpty'), @@ -221,6 +248,7 @@ export default { methods: { ...mapMutations({ commitUnreadRoomCount: 'chat/UPDATE_ROOM_COUNT', + commitRoomIdFromSingleRoom: 'chat/UPDATE_ROOM_ID', }), async fetchRooms({ room } = {}) { this.roomsLoaded = false @@ -253,6 +281,13 @@ export default { this.roomsLoaded = true } this.roomPage += 1 + + if (this.singleRoom && this.rooms.length > 0) { + this.commitRoomIdFromSingleRoom(this.rooms[0].roomId) + } else if (this.getStoreRoomId.roomId) { + // reset store room id + this.commitRoomIdFromSingleRoom(null) + } } catch (error) { this.rooms = [] this.$toast.error(error.message) @@ -389,4 +424,8 @@ body { transform: translate(-50%, -50%); } } + +.single-chat-bubble { + margin-right: 1em; +} diff --git a/webapp/store/chat.js b/webapp/store/chat.js index ed6b5256c..1e0b496ac 100644 --- a/webapp/store/chat.js +++ b/webapp/store/chat.js @@ -14,6 +14,9 @@ export const mutations = { UPDATE_ROOM_COUNT(state, count) { state.unreadRoomCount = count }, + UPDATE_ROOM_ID(state, roomid) { + state.roomId = roomid || null + }, } export const getters = {