Skip to content

Commit 70fec92

Browse files
committed
added new notification types
1 parent 2c8702e commit 70fec92

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed
1.95 KB
Loading
3.86 KB
Loading

frontend/src/components/shared/NavBarBell.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
'word-break': true,
2727
'border-b': true,
2828
'font-bold': !notification.is_seen,}"
29-
v-for="(notification, index) in notifications" :key="index">
29+
v-for="(notification, index) in notifications" :key="index + notification.is_seen.toString()">
3030
<router-link
31-
v-bind:to="notification.link_to"
31+
v-bind:to="getRouterLink(notification.link_to)"
3232
class="py-4 flex items-center word-break cursor-pointer">
3333
<img v-bind:src="getImage(notification.type)" class="w-4 h-4">
3434
<h1 class="ml-4">{{notification.content}}</h1>
@@ -45,6 +45,8 @@ import heartBroken from '../../assets/brokenHeart.png';
4545
import message from '../../assets/message.png';
4646
import view from '../../assets/eye.png';
4747
import match from '../../assets/linkBlack.png';
48+
import superlike from '../../assets/superlikeNotification.png';
49+
import messageLike from '../../assets/likeComment.png';
4850
4951
/* eslint-disable object-curly-newline */
5052
/* eslint-disable consistent-return */
@@ -71,6 +73,12 @@ export default {
7173
showNotifications: false,
7274
}),
7375
methods: {
76+
getRouterLink(link) {
77+
if (!link) {
78+
return '/';
79+
}
80+
return link;
81+
},
7482
async makeNotificationsSeen() {
7583
const length = this.notifications.length;
7684
for (let i = 0; i < length; i += 1) {
@@ -87,17 +95,18 @@ export default {
8795
}
8896
this.showNotifications = !this.showNotifications;
8997
},
90-
close(event) {
98+
async close(event) {
9199
if (!event.currentTarget.contains(event.relatedTarget)) {
92100
this.showNotifications = false;
93101
this.notify = false;
102+
await this.makeNotificationsSeen();
94103
}
95104
},
96105
getImage(type) {
97106
if (type === 'like') {
98107
return heart;
99108
}
100-
if (type === 'dislike') {
109+
if (type === 'unlike') {
101110
return heartBroken;
102111
}
103112
if (type === 'match') {
@@ -109,6 +118,12 @@ export default {
109118
if (type === 'message') {
110119
return message;
111120
}
121+
if (type === 'superlike') {
122+
return superlike;
123+
}
124+
if (type === 'message_like') {
125+
return messageLike;
126+
}
112127
},
113128
async fetchNotifications() {
114129
const notificationsRequest = await this.$http.get('/notifications');

0 commit comments

Comments
 (0)