mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
chat-modul structur, add store state roomID
This commit is contained in:
parent
9b4a71bd96
commit
1cb486cc8c
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<nuxt-link
|
<nuxt-link
|
||||||
|
v-if="!unreadChatNotificationsCount"
|
||||||
class="chat-menu"
|
class="chat-menu"
|
||||||
:to="{ name: 'chat' }"
|
:to="{ name: 'chat' }"
|
||||||
>
|
>
|
||||||
@ -14,19 +15,92 @@
|
|||||||
</base-button>
|
</base-button>
|
||||||
|
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
|
<dropdown v-else class="notifications-menu" offset="8" :placement="placement">
|
||||||
|
<template #default="{ toggleMenu }">
|
||||||
|
<base-button
|
||||||
|
ghost
|
||||||
|
circle
|
||||||
|
v-tooltip="{
|
||||||
|
content: $t('notifications.headerMenuButton.tooltip'),
|
||||||
|
placement: 'bottom-start',
|
||||||
|
}"
|
||||||
|
@click="toggleMenu"
|
||||||
|
>
|
||||||
|
<counter-icon icon="" :count="unreadChatNotificationsCount" danger />
|
||||||
|
<img src="/img/empty/chat-bubble.svg"/>
|
||||||
|
|
||||||
|
</base-button>
|
||||||
|
</template>
|
||||||
|
<template #popover="{}">
|
||||||
|
<div class="notifications-menu-popover">
|
||||||
|
<div v-for="notification in notifications" v-bind:key="notification.roomid">
|
||||||
|
|
||||||
|
<ds-space>
|
||||||
|
|
||||||
|
<div class="notifications-menu-popover-item" @click="$store.commit('chat-modul/SET_OPEN_CHAT_MODUL', { showChatModul: true , roomID: notification.roomid })">
|
||||||
|
<p>{{ notification.name }}</p>
|
||||||
|
{{ notification.title }}</div>
|
||||||
|
</ds-space>
|
||||||
|
</div>
|
||||||
|
<!-- <notification-list :notifications="notifications" /> -->
|
||||||
|
</div>
|
||||||
|
<ds-flex class="notifications-link-container">
|
||||||
|
<ds-flex-item class="notifications-link-container-item" :width="{ base: '100%' }" centered>
|
||||||
|
<nuxt-link :to="{ name: 'chat' }">
|
||||||
|
<base-button ghost primary>
|
||||||
|
All Chat Messages
|
||||||
|
</base-button>
|
||||||
|
</nuxt-link>
|
||||||
|
</ds-flex-item>
|
||||||
|
|
||||||
|
</ds-flex>
|
||||||
|
</template>
|
||||||
|
</dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import CounterIcon from '~/components/_new/generic/CounterIcon/CounterIcon'
|
||||||
|
import Dropdown from '~/components/Dropdown'
|
||||||
|
import NotificationList from '../NotificationList/NotificationList'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChatMenu',
|
name: 'ChatNotificationMenu',
|
||||||
|
components: {
|
||||||
|
CounterIcon,
|
||||||
|
Dropdown,
|
||||||
|
NotificationList,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
notifications: [
|
||||||
|
{roomid: 'u1', name: 'Jenny', title: 'last Message from Jenny'},
|
||||||
|
{roomid: 'u2', name: 'Honey', title: 'last Message from Honey'},
|
||||||
|
{roomid: 'u3', name: 'Bob der Baumeister', title: 'last Message from Bob der Baumeister'},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
unreadChatNotificationsCount() {
|
||||||
|
const result = this.notifications.reduce((count, notification) => {
|
||||||
|
return notification.read ? count : count + 1
|
||||||
|
}, 0)
|
||||||
|
return result
|
||||||
|
},
|
||||||
|
hasNotifications() {
|
||||||
|
return this.notifications.length
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.notifications-menu {
|
||||||
|
max-width: 500px;
|
||||||
|
}
|
||||||
|
.vue-popover-theme {
|
||||||
|
|
||||||
|
z-index: 1000000;
|
||||||
|
}
|
||||||
|
|
||||||
.counter-icon {
|
.counter-icon {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
|||||||
@ -14,9 +14,18 @@
|
|||||||
<modal />
|
<modal />
|
||||||
</client-only>
|
</client-only>
|
||||||
<client-only>
|
<client-only>
|
||||||
|
<ds-card space="xx-small" header="sfdfsdf">
|
||||||
<div v-if="$store.getters['chat-modul/showChatModul'].showChatModul" class="chat-modul" >
|
<div v-if="$store.getters['chat-modul/showChatModul'].showChatModul" class="chat-modul" >
|
||||||
<div class="close" @click="$store.commit('chat-modul/SET_OPEN_CHAT_MODUL', false)">x close chat</div>
|
|
||||||
<chat-modul :singleRoom="true"/></div>
|
<ds-text align="right" class="close">
|
||||||
|
RoomID: {{ $store.getters['chat-modul/showChatModul'].roomID }}
|
||||||
|
<ds-button @click="$store.commit('chat-modul/SET_OPEN_CHAT_MODUL', { showChatModul: false , roomID: 'u0' })">x</ds-button>
|
||||||
|
</ds-text>
|
||||||
|
|
||||||
|
<chat-modul :singleRoom="true"/>
|
||||||
|
</div>
|
||||||
|
</ds-card>
|
||||||
|
|
||||||
</client-only>
|
</client-only>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -50,7 +59,7 @@ export default {
|
|||||||
|
|
||||||
.chat-modul {
|
.chat-modul {
|
||||||
background-color: rgb(233, 228, 228);
|
background-color: rgb(233, 228, 228);
|
||||||
height: 634px;
|
height: 667px;
|
||||||
width: 355px;
|
width: 355px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 45px;
|
bottom: 45px;
|
||||||
|
|||||||
@ -80,7 +80,7 @@
|
|||||||
@update="updateFollow"
|
@update="updateFollow"
|
||||||
/>
|
/>
|
||||||
<base-button
|
<base-button
|
||||||
@click="$store.commit('chat-modul/SET_OPEN_CHAT_MODUL', true)"
|
@click="$store.commit('chat-modul/SET_OPEN_CHAT_MODUL', { showChatModul: true , roomID: user.id })"
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
content: $t('notifications.headerMenuButton.chat'),
|
content: $t('notifications.headerMenuButton.chat'),
|
||||||
placement: 'bottom-start',
|
placement: 'bottom-start',
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
export const state = () => {
|
export const state = () => {
|
||||||
return {
|
return {
|
||||||
showChatModul: false,
|
showChatModul: false,
|
||||||
|
roomID: 'u0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
SET_OPEN_CHAT_MODUL(state, ctx) {
|
SET_OPEN_CHAT_MODUL(state, ctx) {
|
||||||
console.log(ctx)
|
console.log('SET_OPEN_CHAT_MODUL', ctx)
|
||||||
state.showChatModul = ctx || false
|
state.showChatModul = ctx.showChatModul || false
|
||||||
|
state.roomID = ctx.roomID || 'u0'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,4 +18,8 @@ export const getters = {
|
|||||||
console.log('getter', state)
|
console.log('getter', state)
|
||||||
return state
|
return state
|
||||||
},
|
},
|
||||||
|
roomID(state) {
|
||||||
|
console.log('getter', state)
|
||||||
|
return state
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user