forked from DebaucheryLibrarian/traxxx
Added content warning dialog.
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
class="container"
|
||||
:class="theme"
|
||||
>
|
||||
<Warning
|
||||
v-if="showWarning"
|
||||
class="warning-container"
|
||||
@enter="closeWarning"
|
||||
/>
|
||||
|
||||
<transition name="slide">
|
||||
<Sidebar
|
||||
v-if="showSidebar"
|
||||
@@ -23,6 +29,7 @@ import { mapState } from 'vuex';
|
||||
|
||||
import EventBus from '../../js/event-bus';
|
||||
|
||||
import Warning from './warning.vue';
|
||||
import Header from '../header/header.vue';
|
||||
import Sidebar from '../sidebar/sidebar.vue';
|
||||
|
||||
@@ -34,6 +41,11 @@ function toggleSidebar(state) {
|
||||
this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar;
|
||||
}
|
||||
|
||||
function closeWarning() {
|
||||
this.showWarning = false;
|
||||
sessionStorage.setItem('warning', 'warned');
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
document.addEventListener('click', () => {
|
||||
EventBus.$emit('blur');
|
||||
@@ -44,10 +56,12 @@ export default {
|
||||
components: {
|
||||
Header,
|
||||
Sidebar,
|
||||
Warning,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSidebar: false,
|
||||
showWarning: sessionStorage.getItem('warning') !== 'warned',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -58,6 +72,7 @@ export default {
|
||||
mounted,
|
||||
methods: {
|
||||
toggleSidebar,
|
||||
closeWarning,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user