single chat modul in default template

This commit is contained in:
ogerly 2023-07-05 17:17:54 +02:00
parent c8af90f0a6
commit 9a690d6051
3 changed files with 79 additions and 46 deletions

View File

@ -3,22 +3,28 @@
<client-only> <client-only>
<internal-page :pageParams="pageParams" /> <internal-page :pageParams="pageParams" />
<vue-advanced-chat <vue-advanced-chat
:theme="theme"
:current-user-id="currentUserId" :current-user-id="currentUserId"
:room-id="null"
:template-actions="JSON.stringify(templatesText)" :template-actions="JSON.stringify(templatesText)"
:text-messages="JSON.stringify(textMessages)"
:menu-actions="JSON.stringify(menuActions)" :menu-actions="JSON.stringify(menuActions)"
:rooms="JSON.stringify(rooms)" :text-messages="JSON.stringify(textMessages)"
:messages="JSON.stringify(messages)" :messages="JSON.stringify(messages)"
:messages-loaded="messagesLoaded"
:rooms="JSON.stringify(rooms)"
:room-actions="JSON.stringify(roomActions)" :room-actions="JSON.stringify(roomActions)"
:rooms-loaded="true" :rooms-loaded="true"
show-files="false" show-files="false"
show-audio="false" show-audio="false"
:show-footer="true" :show-footer="true"
:messages-loaded="messagesLoaded"
@send-message="sendMessage($event.detail[0])" @send-message="sendMessage($event.detail[0])"
@fetch-messages="fetchMessages($event.detail[0])" @fetch-messages="fetchMessages($event.detail[0])"
:theme="theme"
:is-device="isDevice" :responsive-breakpoint="responsiveBreakpoint"
:single-room="singleRoom"
@show-demo-options="showDemoOptions = $event" @show-demo-options="showDemoOptions = $event"
/> />
</client-only> </client-only>
@ -35,6 +41,10 @@ export default {
theme: { theme: {
type: String, type: String,
}, },
singleRoom: {
type: Boolean,
default: false,
}
}, },
data() { data() {
return { return {
@ -97,30 +107,30 @@ export default {
{ name: 'deleteRoom', title: 'Delete Room' }, { name: 'deleteRoom', title: 'Delete Room' },
], ],
rooms: [ rooms: [
// { {
// roomId: '1', roomId: '1',
// roomName: 'John Snow', roomName: 'John Snow',
// avatar: 'https://66.media.tumblr.com/avatar_c6a8eae4303e_512.pnj', avatar: 'https://66.media.tumblr.com/avatar_c6a8eae4303e_512.pnj',
// users: [ users: [
// { _id: '1234', username: 'John Doe' }, { _id: '1234', username: 'John Doe' },
// { _id: '4321', username: 'John Snow' }, { _id: '4321', username: 'John Snow' },
// ], ],
// }, },
// { {
// roomId: '2', roomId: '2',
// roomName: 'Max J. Mustermann', roomName: 'Max J. Mustermann',
// avatar: avatar:
// 'https://64.media.tumblr.com/8889b6e26370f4e3837584c1c59721a6/f4f76ed6b0249d08-4b/s1280x1920/810e9e5fa724366d26c10c0fa22ba97dad8778d1.pnj', 'https://64.media.tumblr.com/8889b6e26370f4e3837584c1c59721a6/f4f76ed6b0249d08-4b/s1280x1920/810e9e5fa724366d26c10c0fa22ba97dad8778d1.pnj',
// users: [ users: [
// { _id: '1234', username: 'Johnx Doe' }, { _id: '1234', username: 'Johnx Doe' },
// { _id: '43210', username: 'Max J. Mustermann' }, { _id: '43210', username: 'Max J. Mustermann' },
// ], ],
// }, },
], ],
messages: [], messages: [],
messagesLoaded: false, messagesLoaded: true,
showDemoOptions: true, showDemoOptions: true,
isDevice: true, responsiveBreakpoint: 600,
} }
}, },
@ -207,26 +217,26 @@ export default {
}, 2000) }, 2000)
}, },
}, },
apollo: { // apollo: {
Rooms: { // Rooms: {
query() { // query() {
return roomQuery() // return roomQuery()
}, // },
update({ Room }) { // update({ Room }) {
console.log('Rooms', Room) // console.log('Rooms', Room)
if (!Room) { // if (!Room) {
this.rooms = [] // this.rooms = []
return // return
} // }
this.rooms = Room // this.rooms = Room
}, // },
error(error) { // error(error) {
this.rooms = [] // this.rooms = []
this.$toast.error(error.message) // this.$toast.error(error.message)
}, // },
fetchPolicy: 'cache-and-network', // fetchPolicy: 'cache-and-network',
}, // },
}, // },
} }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -13,6 +13,9 @@
<client-only> <client-only>
<modal /> <modal />
</client-only> </client-only>
<client-only>
<div v-if="true" class="chat-modul" ><chat-modul :singleRoom="true"/></div>
</client-only>
</div> </div>
</template> </template>
@ -22,12 +25,14 @@ import mobile from '~/mixins/mobile'
import HeaderMenu from '~/components/HeaderMenu/HeaderMenu' import HeaderMenu from '~/components/HeaderMenu/HeaderMenu'
import Modal from '~/components/Modal' import Modal from '~/components/Modal'
import PageFooter from '~/components/PageFooter/PageFooter' import PageFooter from '~/components/PageFooter/PageFooter'
import ChatModul from '~/components/Chat/Chat.vue'
export default { export default {
components: { components: {
HeaderMenu, HeaderMenu,
Modal, Modal,
PageFooter, PageFooter,
ChatModul,
}, },
mixins: [seo, mobile()], mixins: [seo, mobile()],
} }
@ -41,4 +46,14 @@ export default {
padding-top: 6rem; padding-top: 6rem;
padding-bottom: 5rem; padding-bottom: 5rem;
} }
.chat-modul {
background-color: red;
height: 594px;
width: 355px;
position: absolute;
bottom: 45px;
right: 0;
z-index: 10000;
}
</style> </style>

View File

@ -79,6 +79,14 @@
@optimistic="optimisticFollow" @optimistic="optimisticFollow"
@update="updateFollow" @update="updateFollow"
/> />
<base-button
v-tooltip="{
content: $t('notifications.headerMenuButton.chat'),
placement: 'bottom-start',
}"
><img src="/img/empty/chat-bubble.svg" height="20"/>
</base-button>
</div> </div>
<template v-if="user.about"> <template v-if="user.about">
<hr /> <hr />