mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #6617 from Ocelot-Social-Community/6588-chat-link-to-chat-page
feat(webapp): chat link to chat page
This commit is contained in:
commit
052d59b3b6
@ -4,7 +4,7 @@
|
||||
<vue-advanced-chat
|
||||
:theme="theme"
|
||||
:current-user-id="currentUser.id"
|
||||
:room-id="!singleRoom ? roomId : null"
|
||||
:room-id="computedRoomId"
|
||||
:template-actions="JSON.stringify(templatesText)"
|
||||
:menu-actions="JSON.stringify(menuActions)"
|
||||
:text-messages="JSON.stringify(textMessages)"
|
||||
@ -27,10 +27,28 @@
|
||||
show-reaction-emojis="false"
|
||||
@show-demo-options="showDemoOptions = $event"
|
||||
>
|
||||
<div slot="menu-icon" @click.prevent.stop="$emit('close-single-room', true)">
|
||||
<div v-if="singleRoom">
|
||||
<ds-icon name="close"></ds-icon>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedRoom && selectedRoom.roomId"
|
||||
slot="room-options"
|
||||
class="chat-room-options"
|
||||
>
|
||||
<ds-flex v-if="singleRoom">
|
||||
<ds-flex-item centered class="single-chat-bubble">
|
||||
<nuxt-link :to="{ name: 'chat' }">
|
||||
<base-icon name="chat-bubble" />
|
||||
</nuxt-link>
|
||||
</ds-flex-item>
|
||||
<ds-flex-item centered>
|
||||
<div
|
||||
class="vac-svg-button vac-room-options"
|
||||
@click="$emit('close-single-room', true)"
|
||||
>
|
||||
<slot name="menu-icon">
|
||||
<ds-icon name="close" />
|
||||
</slot>
|
||||
</div>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
</div>
|
||||
|
||||
<div slot="room-header-avatar">
|
||||
@ -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, options = {} } = {}) {
|
||||
this.roomsLoaded = options.refetch ? this.roomsLoaded : false
|
||||
@ -262,6 +290,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)
|
||||
@ -408,4 +443,8 @@ body {
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.ds-flex-item.single-chat-bubble {
|
||||
margin-right: 1em;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -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 = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user