fix(banner): only show when relevant

This commit is contained in:
SabreCat 2023-05-31 16:55:21 -05:00
parent 739016ba01
commit c0cf647873
5 changed files with 44 additions and 10 deletions

View file

@ -1,9 +1,12 @@
<template>
<base-banner
banner-id="chat-banner"
banner-id="chat-warning"
banner-class="chat-banner"
class="chat-banner"
height="3rem"
:show="showChatWarning"
:can-close="false"
:class="{faq: faqPage}"
>
<div
slot="content"
@ -29,6 +32,11 @@
color: $orange-1;
text-decoration: underline;
}
&.faq {
position: fixed;
top: 3.5rem;
}
}
</style>
@ -40,6 +48,16 @@ export default {
components: {
BaseBanner,
},
computed: {
faqPage () {
return (this.$route.fullPath.indexOf('/faq')) !== -1;
},
showChatWarning () {
if (this.$route.fullPath.indexOf('/tavern') !== -1) return true;
if (this.$route.fullPath.indexOf('/groups') !== -1) return true;
return this.faqPage;
},
},
};
</script>

View file

@ -830,9 +830,11 @@ export default {
async mounted () {
await this.getUserGroupPlans();
await this.getUserParty();
Array.from(document.getElementById('menu_collapse').getElementsByTagName('a')).forEach(link => {
link.addEventListener('click', this.closeMenu);
});
if (document.getElementById('menu_collapse')) {
Array.from(document.getElementById('menu_collapse').getElementsByTagName('a')).forEach(link => {
link.addEventListener('click', this.closeMenu);
});
}
Array.from(document.getElementsByClassName('topbar-item')).forEach(link => {
link.addEventListener('mouseenter', this.dropdownDesktop);
link.addEventListener('mouseleave', this.dropdownDesktop);

View file

@ -106,6 +106,7 @@ export default {
preventMultipleWatchExecution: false,
eventPromoBannerHeight: null,
sleepingBannerHeight: null,
warningBannerHeight: null,
};
},
computed: {
@ -133,7 +134,11 @@ export default {
return `${base}${modifier} scroll-${this.scrollY}`;
},
notificationBannerHeight () {
let scrollPosToCheck = 104;
let scrollPosToCheck = 56;
if (this.warningBannerHeight) {
scrollPosToCheck += this.warningBannerHeight;
}
if (this.sleepingBannerHeight) {
scrollPosToCheck += this.sleepingBannerHeight;
@ -361,6 +366,7 @@ export default {
updateBannerHeightAndScrollY () {
this.updateEventBannerHeight();
this.warningBannerHeight = getBannerHeight('chat-warning');
this.sleepingBannerHeight = getBannerHeight('damage-paused');
this.updateScrollY();
},

View file

@ -94,6 +94,11 @@
}
}
.container-fluid {
position: relative;
top: 2rem;
}
@media only screen and (max-width: 768px) {
.container-fluid {
margin: auto;

View file

@ -1,11 +1,12 @@
<template>
<div>
<chat-banner />
<static-header
v-if="showContentWrap"
:class="{
'home-header': ['home', 'front'].indexOf($route.name) !== -1,
'white-header': this.$route.name === 'plans'
}"
v-if="showContentWrap"
:class="{
'home-header': ['home', 'front'].indexOf($route.name) !== -1,
'white-header': this.$route.name === 'plans'
}"
/>
<div class="static-wrapper">
<router-view />
@ -243,11 +244,13 @@
<script>
import AppFooter from '@/components/appFooter';
import ChatBanner from '@/components/header/banners/chatBanner';
import StaticHeader from './header.vue';
export default {
components: {
AppFooter,
ChatBanner,
StaticHeader,
},
computed: {