fix: intercom bubble colliding with notifications (#3810)

This commit is contained in:
IMB11 2025-06-19 16:18:10 +01:00 committed by GitHub
parent 125207880d
commit d4864deac5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,8 @@
<template> <template>
<div class="vue-notification-group experimental-styles-within"> <div
class="vue-notification-group experimental-styles-within"
:class="{ 'intercom-present': isIntercomPresent }"
>
<transition-group name="notifs"> <transition-group name="notifs">
<div <div
v-for="(item, index) in notifications" v-for="(item, index) in notifications"
@ -80,6 +83,8 @@ import {
} from "@modrinth/assets"; } from "@modrinth/assets";
const notifications = useNotifications(); const notifications = useNotifications();
const isIntercomPresent = ref(false);
function stopTimer(notif) { function stopTimer(notif) {
clearTimeout(notif.timer); clearTimeout(notif.timer);
} }
@ -106,6 +111,27 @@ const createNotifText = (notif) => {
return text; return text;
}; };
function checkIntercomPresence() {
isIntercomPresent.value = !!document.querySelector(".intercom-lightweight-app");
}
onMounted(() => {
checkIntercomPresence();
const observer = new MutationObserver(() => {
checkIntercomPresence();
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
onBeforeUnmount(() => {
observer.disconnect();
});
});
function copyToClipboard(notif) { function copyToClipboard(notif) {
const text = createNotifText(notif); const text = createNotifText(notif);
@ -130,6 +156,10 @@ function copyToClipboard(notif) {
bottom: 0.75rem; bottom: 0.75rem;
} }
&.intercom-present {
bottom: 5rem;
}
.vue-notification-wrapper { .vue-notification-wrapper {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;