dsg
INSERT INTO `cp_filejs` (`id`,`app`,`path`,`modul`,`file_name`,`content`) VALUES ('352','3','u7/collector','auth','js/notifications.js----','import {\r\n getSessionUser\r\n} from \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"./api/auth.js\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\r\nimport {\r\n maybeFollowUser\r\n} from \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"./api/profile.js\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\r\nimport app from \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"./app.js\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\r\nimport store from \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"./store.js\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\r\n\r\nvar $ = Dom7\r\nvar notificationsStore = store.getters.getNotifications\r\nvar refreshed = false\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'page:afterin\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.page[data-name=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"notifications\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {\r\n const data = notificationsStore.value\r\n\r\n if (!data || !data.success) {\r\n return\r\n }\r\n\r\n // a list if all unread notification ids\r\n const unreadNotificationIds = [\r\n ...data.data.recent,\r\n ...data.data.last_week,\r\n ...data.data.last_30_days,\r\n ].filter((item) => item.is_read === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"0\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\").map((item) => item._id);\r\n\r\n if (unreadNotificationIds.length > 0) {\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'markNotificationsAsRead\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', unreadNotificationIds)\r\n }\r\n})\r\n\r\nnotificationsStore.onUpdated(async (data) => {\r\n if (!data || !data.success) {\r\n $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.notification-wrap\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').html(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'

No notifications

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n return\r\n }\r\n\r\n const notifications = data.data\r\n\r\n const recentContainer = document.getElementById(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'recent\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n const thisWeekContainer = document.getElementById(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'this-week\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n\r\n if (refreshed) {\r\n recentContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n thisWeekContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n refreshed = false\r\n }\r\n\r\n document.querySelectorAll(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.app-notification-title\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').forEach(elem => {\r\n elem.innerHTML = elem.getAttribute(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'data-title\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n })\r\n\r\n var user = await getSessionUser()\r\n\r\n if (!notifications.recent.length) {\r\n recentContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'

No recent notifications

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n }\r\n\r\n if (!notifications.last_week.length) {\r\n thisWeekContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'

No notifications from this week

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n }\r\n\r\n notifications.recent.forEach(notification => {\r\n const notificationItem = createNotificationItem(notification, user);\r\n recentContainer.appendChild(notificationItem);\r\n });\r\n\r\n notifications.last_week.forEach(notification => {\r\n const notificationItem = createNotificationItem(notification, user);\r\n thisWeekContainer.appendChild(notificationItem);\r\n });\r\n})\r\n\r\nfunction timeAgo(dateString) {\r\n const now = new Date();\r\n const past = new Date(dateString);\r\n const diffInHours = Math.floor((now - past) / (1000 * 60 * 60));\r\n return diffInHours > 24 ? `${Math.floor(diffInHours / 24)}d ago` : `${diffInHours}h ago`;\r\n}\r\n\r\nfunction createNotificationItem(notification, user) {\r\n const isFollow = notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ? true : false;\r\n const container = document.createElement(isFollow ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n\r\n if (!isFollow) {\r\n container.href = `/post-view/${notification.entity.entity_id}`;\r\n }\r\n\r\n let isReadClass = notification.is_read == \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"0\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"unread-notif\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\";\r\n\r\n container.className = `notification-item ${isReadClass}`;\r\n container.dataset.notificationId = notification._id;\r\n\r\n // Profile image and notification content container\r\n const leftContainer = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n leftContainer.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-left\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n\r\n const imageDiv = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n imageDiv.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'image-square image-rounded\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n imageDiv.style.backgroundImage = `url(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'${notification.entity.initiator_data.profile_image || \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'assets/img/profile-placeholder.jpg\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')`;\r\n imageDiv.href = `/profile-view/${notification.entity.user_id}`;\r\n\r\n const infoDiv = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n infoDiv.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-info\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n\r\n let content = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n\r\n // Conditional content rendering based on the type\r\n if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'like\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n content = `\r\n
\r\n ${notification.entity.initiator_data.display_name} liked your ${notification.entity.entity_type}\r\n ${notification.entity.entity_data.comment ? `: \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"${notification.entity.entity_data.comment}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"` : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}\r\n \r\n
\r\n `;\r\n } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'comment\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n const eclipseComment = notification.entity.entity_data.comment.length > 50 ? notification.entity.entity_data.comment.substring(0, 50) + \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'...\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : notification.entity.entity_data.comment;\r\n\r\n container.href = `/post-view/${notification.entity.entity_data.post_id}?commentId=${notification.entity.entity_id}`;\r\n\r\n content = `\r\n
\r\n ${notification.entity.initiator_data.display_name} commented on your post: \r\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"${eclipseComment}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\r\n \r\n
\r\n `;\r\n } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n content = `\r\n \r\n `;\r\n } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'mention\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n content = `\r\n
\r\n ${notification.entity.initiator_data.display_name} mentioned you in a ${notification.entity.entity_type}\r\n ${notification.entity.entity_data.comment ? `\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"${notification.entity.entity_data.comment}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"` : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}\r\n \r\n
\r\n `;\r\n } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n content = `\r\n
\r\n ${notification.entity.initiator_data.display_name} has posted ${notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"your car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"a post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"} \r\n \r\n ${notification.entity.entity_data?.garage?.make || \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'} ${notification.entity.entity_data?.garage?.model || \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}\r\n \r\n \r\n
\r\n `;\r\n } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'tag\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n content = `\r\n
\r\n ${notification.entity.initiator_data.display_name} ${notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"tagged your car in a post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"tagged you in a post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"}\r\n \r\n
\r\n `;\r\n }\r\n\r\n // Add time ago\r\n const timeSpan = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'span\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n timeSpan.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-time\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n timeSpan.textContent = timeAgo(notification.date);\r\n\r\n\r\n infoDiv.innerHTML = `${content} ${timeSpan.outerHTML}`;\r\n\r\n // Adding profile image and content to the left container\r\n leftContainer.appendChild(imageDiv);\r\n leftContainer.appendChild(infoDiv);\r\n\r\n // Append left container to the main container\r\n container.appendChild(leftContainer);\r\n\r\n if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n const isFollowing = user.following.includes(notification.entity.user_id);\r\n let followBtn = `
\r\n ${isFollowing ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Unfollow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}\r\n
`;\r\n\r\n container.innerHTML += followBtn;\r\n } else {\r\n const rightContainer = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n rightContainer.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-left\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n let path;\r\n\r\n if (notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n rightContainer.href = `/${path}/${notification.entity.entity_id}`;\r\n\r\n } else if (notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n rightContainer.href = `/${path}/${notification.entity.entity_id}`;\r\n\r\n } else if (notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'comment\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n rightContainer.href = `/${path}/${notification.entity.entity_data.post_id}?commentId=${notification.entity.entity_id}`;\r\n } else {\r\n path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n rightContainer.href = `/${path}/${notification.entity.user_id}`;\r\n }\r\n\r\n\r\n const imageDiv = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\r\n imageDiv.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'image-square image-rounded\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n imageDiv.style.backgroundImage = `url(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'${notification.entity.entity_data.media}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')`;\r\n imageDiv.style.backgroundSize = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'cover\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n imageDiv.style.backgroundPosition = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'center\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n imageDiv.style.backgroundColor = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'#f1f1f1\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n\r\n rightContainer.appendChild(imageDiv);\r\n container.appendChild(rightContainer)\r\n }\r\n\r\n return container;\r\n}\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'click\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.toggle-follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {\r\n const userId = e.target.dataset.userId;\r\n const isFollowing = e.target.dataset.isFollowing === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'true\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n\r\n // update the button text\r\n e.target.textContent = isFollowing ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Unfollow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';\r\n e.target.dataset.isFollowing = !isFollowing;\r\n\r\n await maybeFollowUser(userId);\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'updateUserDetails\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n});\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'ptr:refresh\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.notification-page.ptr-content\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {\r\n refreshed = true\r\n\r\n try {\r\n await store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notificationCount\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n await store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'fetchNotifications\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n\r\n app.ptr.get(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.notification-page.ptr-content\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').done()\r\n})');
Copy This

Warning: file_get_contents(/home/u340524018/domains/agniaga.com/public_html/sub/u7/collector/js/notifications.js----): Failed to open stream: No such file or directory in /home/u340524018/domains/agniaga.com/public_html/sub/u2/cp/inc.filejs.php on line 190
import {
    getSessionUser
} from \\\\\\\\\\\\\\\"./api/auth.js\\\\\\\\\\\\\\\"
import {
    maybeFollowUser
} from \\\\\\\\\\\\\\\"./api/profile.js\\\\\\\\\\\\\\\"
import app from \\\\\\\\\\\\\\\"./app.js\\\\\\\\\\\\\\\"
import store from \\\\\\\\\\\\\\\"./store.js\\\\\\\\\\\\\\\"

var $ = Dom7
var notificationsStore = store.getters.getNotifications
var refreshed = false

$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'page:afterin\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.page[data-name=\\\\\\\\\\\\\\\"notifications\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {
    const data = notificationsStore.value

    if (!data || !data.success) {
        return
    }

    // a list if all unread notification ids
    const unreadNotificationIds = [
        ...data.data.recent,
        ...data.data.last_week,
        ...data.data.last_30_days,
    ].filter((item) => item.is_read === \\\\\\\\\\\\\\\"0\\\\\\\\\\\\\\\").map((item) => item._id);

    if (unreadNotificationIds.length > 0) {
        store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'markNotificationsAsRead\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', unreadNotificationIds)
    }
})

notificationsStore.onUpdated(async (data) => {
    if (!data || !data.success) {
        $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.notification-wrap\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').html(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'<p class=\\\\\\\\\\\\\\\"text-center\\\\\\\\\\\\\\\">No notifications</p>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
        return
    }

    const notifications = data.data

    const recentContainer = document.getElementById(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'recent\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
    const thisWeekContainer = document.getElementById(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'this-week\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');

    if (refreshed) {
        recentContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
        thisWeekContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
        refreshed = false
    }

    document.querySelectorAll(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.app-notification-title\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').forEach(elem => {
        elem.innerHTML = elem.getAttribute(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'data-title\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
    })

    var user = await getSessionUser()

    if (!notifications.recent.length) {
        recentContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'<p class=\\\\\\\\\\\\\\\"text-center\\\\\\\\\\\\\\\">No recent notifications</p>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
    }

    if (!notifications.last_week.length) {
        thisWeekContainer.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'<p class=\\\\\\\\\\\\\\\"text-center\\\\\\\\\\\\\\\">No notifications from this week</p>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
    }

    notifications.recent.forEach(notification => {
        const notificationItem = createNotificationItem(notification, user);
        recentContainer.appendChild(notificationItem);
    });

    notifications.last_week.forEach(notification => {
        const notificationItem = createNotificationItem(notification, user);
        thisWeekContainer.appendChild(notificationItem);
    });
})

function timeAgo(dateString) {
    const now = new Date();
    const past = new Date(dateString);
    const diffInHours = Math.floor((now - past) / (1000 * 60 * 60));
    return diffInHours > 24 ? `${Math.floor(diffInHours / 24)}d ago` : `${diffInHours}h ago`;
}

function createNotificationItem(notification, user) {
    const isFollow = notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ? true : false;
    const container = document.createElement(isFollow ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');

    if (!isFollow) {
        container.href = `/post-view/${notification.entity.entity_id}`;
    }

    let isReadClass = notification.is_read == \\\\\\\\\\\\\\\"0\\\\\\\\\\\\\\\" ? \\\\\\\\\\\\\\\"unread-notif\\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\";

    container.className = `notification-item ${isReadClass}`;
    container.dataset.notificationId = notification._id;

    // Profile image and notification content container
    const leftContainer = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
    leftContainer.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-left\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';

    const imageDiv = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
    imageDiv.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'image-square image-rounded\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
    imageDiv.style.backgroundImage = `url(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'${notification.entity.initiator_data.profile_image || \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'assets/img/profile-placeholder.jpg\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')`;
    imageDiv.href = `/profile-view/${notification.entity.user_id}`;

    const infoDiv = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
    infoDiv.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-info\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';

    let content = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';

    // Conditional content rendering based on the type
    if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'like\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
        content = `
            <div class=\\\\\\\\\\\\\\\"notification-text\\\\\\\\\\\\\\\">
                <a href=\\\\\\\\\\\\\\\"/profile-view/${notification.entity.user_id}\\\\\\\\\\\\\\\"><strong>${notification.entity.initiator_data.display_name}</strong></a> liked your ${notification.entity.entity_type}
                ${notification.entity.entity_data.comment ? `<span class=\\\\\\\\\\\\\\\"inline font-semibold text-black\\\\\\\\\\\\\\\">: \\\\\\\\\\\\\\\"${notification.entity.entity_data.comment}\\\\\\\\\\\\\\\"</span>` : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}
                <span class=\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"></span>
            </div>
        `;
    } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'comment\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
        const eclipseComment = notification.entity.entity_data.comment.length > 50 ? notification.entity.entity_data.comment.substring(0, 50) + \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'...\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : notification.entity.entity_data.comment;

        container.href = `/post-view/${notification.entity.entity_data.post_id}?commentId=${notification.entity.entity_id}`;

        content = `
            <div class=\\\\\\\\\\\\\\\"notification-text\\\\\\\\\\\\\\\">
                <a href=\\\\\\\\\\\\\\\"/profile-view/${notification.entity.user_id}\\\\\\\\\\\\\\\"><strong>${notification.entity.initiator_data.display_name}</strong></a> commented on your post: 
                <span class=\\\\\\\\\\\\\\\"font-semibold text-black\\\\\\\\\\\\\\\">\\\\\\\\\\\\\\\"${eclipseComment}\\\\\\\\\\\\\\\"</span>
                <span class=\\\\\\\\\\\\\\\"${isReadClass}\\\\\\\\\\\\\\\"></span>
            </div>
        `;
    } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
        content = `
            <div class=\\\\\\\\\\\\\\\"notification-text\\\\\\\\\\\\\\\">
                <a href=\\\\\\\\\\\\\\\"/profile-view/${notification.entity.user_id}\\\\\\\\\\\\\\\"><strong>${notification.entity.initiator_data.display_name}</strong></a> followed you
                <span class=\\\\\\\\\\\\\\\"${isReadClass}\\\\\\\\\\\\\\\"></span>
            </div>
        `;
    } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'mention\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
        content = `
            <div class=\\\\\\\\\\\\\\\"notification-text\\\\\\\\\\\\\\\">
                <a href=\\\\\\\\\\\\\\\"/profile-view/${notification.entity.user_id}\\\\\\\\\\\\\\\"><strong>${notification.entity.initiator_data.display_name}</strong></a> mentioned you in a ${notification.entity.entity_type}
                ${notification.entity.entity_data.comment ? `<span class=\\\\\\\\\\\\\\\"block font-semibold text-black\\\\\\\\\\\\\\\">\\\\\\\\\\\\\\\"${notification.entity.entity_data.comment}\\\\\\\\\\\\\\\"</span>` : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}
                <span class=\\\\\\\\\\\\\\\"${isReadClass}\\\\\\\\\\\\\\\"></span>
            </div>
        `;
    } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
        content = `
            <div class=\\\\\\\\\\\\\\\"notification-text\\\\\\\\\\\\\\\">
                <a href=\\\\\\\\\\\\\\\"/profile-view/${notification.entity.user_id}\\\\\\\\\\\\\\\"><strong>${notification.entity.initiator_data.display_name}</strong></a> has posted ${notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ? \\\\\\\\\\\\\\\"your car\\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\\"a post\\\\\\\\\\\\\\\"} 
                <a href=\\\\\\\\\\\\\\\"/profile/garage/${notification.entity.entity_data?.garage?.id}\\\\\\\\\\\\\\\" class=\\\\\\\\\\\\\\\"font-semibold hover:cursor-pointer hover:text-customblue\\\\\\\\\\\\\\\">
                    ${notification.entity.entity_data?.garage?.make || \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'} ${notification.entity.entity_data?.garage?.model || \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}
                </a>
                <span class=\\\\\\\\\\\\\\\"${isReadClass}\\\\\\\\\\\\\\\"></span>
            </div>
        `;
    } else if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'tag\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
        content = `
            <div class=\\\\\\\\\\\\\\\"notification-text\\\\\\\\\\\\\\\">
                <a href=\\\\\\\\\\\\\\\"/profile-view/${notification.entity.user_id}\\\\\\\\\\\\\\\"><strong>${notification.entity.initiator_data.display_name}</strong></a> ${notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ? \\\\\\\\\\\\\\\"tagged your car in a post\\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\\"tagged you in a post\\\\\\\\\\\\\\\"}
                <span class=\\\\\\\\\\\\\\\"${isReadClass}\\\\\\\\\\\\\\\"></span>
            </div>
        `;
    }

    // Add time ago
    const timeSpan = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'span\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
    timeSpan.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-time\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
    timeSpan.textContent = timeAgo(notification.date);


    infoDiv.innerHTML = `${content} ${timeSpan.outerHTML}`;

    // Adding profile image and content to the left container
    leftContainer.appendChild(imageDiv);
    leftContainer.appendChild(infoDiv);

    // Append left container to the main container
    container.appendChild(leftContainer);

    if (notification.type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
        const isFollowing = user.following.includes(notification.entity.user_id);
        let followBtn = `<div class=\\\\\\\\\\\\\\\"btn btn-primary btn-sm toggle-follow\\\\\\\\\\\\\\\" data-is-following=\\\\\\\\\\\\\\\"${isFollowing}\\\\\\\\\\\\\\\" data-user-id=\\\\\\\\\\\\\\\"${notification.entity.user_id}\\\\\\\\\\\\\\\">
            ${isFollowing ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Unfollow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'}
        </div>`;

        container.innerHTML += followBtn;
    } else {
        const rightContainer = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
        rightContainer.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notification-left\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
        let path;

        if (notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
            path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'car\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
            rightContainer.href = `/${path}/${notification.entity.entity_id}`;

        } else if (notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
            path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
            rightContainer.href = `/${path}/${notification.entity.entity_id}`;

        } else if (notification.entity.entity_type === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'comment\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {
            path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'post-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
            rightContainer.href = `/${path}/${notification.entity.entity_data.post_id}?commentId=${notification.entity.entity_id}`;
        } else {
            path = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
            rightContainer.href = `/${path}/${notification.entity.user_id}`;
        }


        const imageDiv = document.createElement(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'div\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');
        imageDiv.className = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'image-square image-rounded\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
        imageDiv.style.backgroundImage = `url(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'${notification.entity.entity_data.media}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')`;
        imageDiv.style.backgroundSize = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'cover\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
        imageDiv.style.backgroundPosition = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'center\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
        imageDiv.style.backgroundColor = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'#f1f1f1\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';

        rightContainer.appendChild(imageDiv);
        container.appendChild(rightContainer)
    }

    return container;
}

$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'click\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.toggle-follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {
    const userId = e.target.dataset.userId;
    const isFollowing = e.target.dataset.isFollowing === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'true\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';

    // update the button text
    e.target.textContent = isFollowing ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Unfollow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
    e.target.dataset.isFollowing = !isFollowing;

    await maybeFollowUser(userId);
    store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'updateUserDetails\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
});

$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'ptr:refresh\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.notification-page.ptr-content\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {
    refreshed = true

    try {
        await store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'notificationCount\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
        await store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'fetchNotifications\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
    } catch (error) {
        console.log(error);
    }

    app.ptr.get(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.notification-page.ptr-content\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').done()
})
Add JS Function Name