project creation request notification working

This commit is contained in:
isUnknown 2025-01-23 16:16:51 +01:00
parent c750001a2c
commit c75c5e1d8a
7 changed files with 93 additions and 13 deletions

View file

@ -45,7 +45,7 @@
:is="notificationComponents[notification.type]"
:notification="notification"
:data-status="notification.isRead ? 'read' : 'unread'"
@click="router.push(getHref(notification))"
@click="handleNotificationClick(notification)"
/>
</template>
</section>
@ -64,6 +64,7 @@ import Comment from "../components/notifications/Comment.vue";
import Reply from "../components/notifications/Reply.vue";
import Content from "../components/notifications/Content.vue";
import { useRouter } from "vue-router";
import ProjectRequest from "../components/notifications/ProjectRequest.vue";
dayjs.locale("fr");
@ -95,6 +96,7 @@ const notificationComponents = {
comment: Comment,
"comment-reply": Reply,
content: Content,
"project-request": ProjectRequest,
};
const sortedNotifications = computed(() => {
@ -123,6 +125,14 @@ function readAll() {
}
// Functions
function handleNotificationClick(notification) {
const href = getHref(notification);
if (href.startsWith("http")) {
window.open(href, "_blank");
} else {
router.push(href);
}
}
function getHref(notification) {
const uri = notification.location.page.uri;
@ -138,6 +148,10 @@ function getHref(notification) {
return notification.project.uri + "?dialog=virtual-sample&comments=true";
}
if (notification.location.page.panelurl) {
return notification.location.page.panelurl;
}
return uri;
}
</script>