Notifications

Settings Notifications
User Panel
This commit is contained in:
Paolo Arena
2022-07-23 17:44:44 +02:00
parent 6ae82f14cc
commit e2006e683b
18 changed files with 328 additions and 69 deletions

View File

@@ -42,7 +42,7 @@ export default defineComponent({
})
}
watch(() => userStore.isLogged,(to, from) => {
watch(() => userStore.isLogged || finishLoading.value,(to, from) => {
myroutes.value = []
myroutes.value = static_data.routes
})

View File

@@ -17,7 +17,12 @@
}
.unread {
font-weight: bold;
}
.unread-date {
color: royalblue;
font-weight: 600;
}
.read {

View File

@@ -5,6 +5,8 @@ import {
IMessage, IMsgUsers, INotif,
} from '@model'
import { date } from 'quasar'
import { tools } from '@src/store/Modules/tools'
import { useRouter } from 'vue-router'
@@ -53,7 +55,7 @@ export default defineComponent({
datenotif: new Date()
})
const { getNumNotifUnread, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeNotif } = MixinUsers()
const { getNumNotifUnread, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeDirNotif, getTypeIdNotif } = MixinUsers()
// function lasts_notifs (state: IUserState) => IMessage[] {
//
@@ -79,8 +81,8 @@ export default defineComponent({
})
function clickNotif(notif: INotif) {
if (notif.link) {
let mylink = tools.updateQueryStringParameter(notif.link, 'idnotif', notif._id)
if (notif.openUrl) {
let mylink = tools.updateQueryStringParameter(notif.openUrl, 'idnotif', notif._id)
console.log('mylink', mylink, notif._id)
if (mylink) {
$router.replace(mylink)
@@ -155,7 +157,8 @@ export default defineComponent({
getUsernameChatByNotif,
getImgByNotif,
getNotifText,
getTypeNotif,
getTypeDirNotif,
getTypeIdNotif,
tools,
usernotifs,
shared_consts,

View File

@@ -28,6 +28,12 @@
</q-item-section>
<q-item-section>{{ $t('notifs.setallread') }}</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="notifStore.deleteAll(username)">
<q-item-section side>
<q-icon name="fas fa-trash-alt"/>
</q-item-section>
<q-item-section>{{ $t('notifs.deleteall') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
@@ -65,11 +71,11 @@
</div>
<q-item clickable v-for="(notif, index) in lasts_notifs" :key="index" @click="clickNotif(notif)">
<q-item clickable v-for="(notif, index) in lasts_notifs" :key="index">
<!--<q-item-section avatar>
<q-avatar>
<q-item-label lines="1">{{ getTypeNotif(notif) }}</q-item-label>
<q-item-label lines="1">{{ getTypeDirNotif(notif) }}</q-item-label>
</q-avatar>
</q-item-section>-->
@@ -79,19 +85,19 @@
</q-avatar>
</q-item-section>
<q-item-section v-ripple >
<q-item-section v-ripple @click="clickNotif(notif)">
<q-item-label lines="1" :class="(!notif.read) ? 'unread' : 'read'">{{ getNotifText(notif, false) }}</q-item-label>
<q-item-label caption lines="2">
{{ tools.getstrDateTimeShort(notif.datenotif) }}
<q-item-label caption lines="2" :class="(!notif.read) ? 'unread-date' : 'read-date'">
{{ tools.timeAgo(notif.datenotif) }}
<!--{{ // getUsernameChatByNotif(notif) }}-->
</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label>
<q-btn rounded icon="fas fa-pencil-alt">
<q-btn rounded icon="fas fa-ellipsis-h">
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable v-close-popup @click="notifStore.deleteRec(notif._id)">
<q-item clickable v-close-popup @click="notifStore.deleteRec(username, notif._id)">
<q-item-section side>
<q-icon name="fas fa-trash-alt"/>
</q-item-section>
@@ -99,7 +105,7 @@
</q-item>
<q-item clickable v-close-popup @click="notifStore.deactivateRec(notif._id)">
<q-item-section side>
<q-icon name="fas fa-trash-alt"/>
<q-icon name="fas fa-bell-slash"/>
</q-item-section>
<q-item-section>{{ $t('notifs.deactivate_notif') }}</q-item-section>
</q-item>