2018-02-09 23:56:33 -06:00
|
|
|
<template>
|
2018-09-22 05:59:37 -05:00
|
|
|
<div class="mk-ui" v-hotkey.global="keymap">
|
|
|
|
<div class="bg" v-if="$store.getters.isSignedIn && $store.state.i.wallpaperUrl" :style="style"></div>
|
2018-10-14 05:44:30 -05:00
|
|
|
<x-header class="header" v-if="navbar == 'top'" v-show="!zenMode" ref="header"/>
|
|
|
|
<x-sidebar class="sidebar" v-if="navbar != 'top'" ref="sidebar"/>
|
|
|
|
<div class="content" :class="[{ sidebar: navbar != 'top' }, navbar]">
|
2018-02-12 04:59:24 -06:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
2018-05-26 23:49:09 -05:00
|
|
|
<mk-stream-indicator v-if="$store.getters.isSignedIn"/>
|
2018-02-09 23:56:33 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
2018-02-12 04:59:24 -06:00
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-02-20 07:53:34 -06:00
|
|
|
import XHeader from './ui.header.vue';
|
2018-10-14 05:44:30 -05:00
|
|
|
import XSidebar from './ui.sidebar.vue';
|
2018-02-12 04:59:24 -06:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-02-20 07:53:34 -06:00
|
|
|
components: {
|
2018-10-14 05:44:30 -05:00
|
|
|
XHeader,
|
|
|
|
XSidebar
|
2018-02-20 07:53:34 -06:00
|
|
|
},
|
2018-09-17 15:35:06 -05:00
|
|
|
|
2018-06-08 06:34:44 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
zenMode: false
|
|
|
|
};
|
|
|
|
},
|
2018-09-17 15:35:06 -05:00
|
|
|
|
2018-06-06 15:14:37 -05:00
|
|
|
computed: {
|
2018-10-14 05:44:30 -05:00
|
|
|
navbar(): string {
|
|
|
|
return this.$store.state.device.navbar;
|
|
|
|
},
|
|
|
|
|
2018-06-06 15:14:37 -05:00
|
|
|
style(): any {
|
|
|
|
if (!this.$store.getters.isSignedIn || this.$store.state.i.wallpaperUrl == null) return {};
|
|
|
|
return {
|
|
|
|
backgroundColor: this.$store.state.i.wallpaperColor && this.$store.state.i.wallpaperColor.length == 3 ? `rgb(${ this.$store.state.i.wallpaperColor.join(',') })` : null,
|
|
|
|
backgroundImage: `url(${ this.$store.state.i.wallpaperUrl })`
|
|
|
|
};
|
2018-09-17 15:35:06 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
keymap(): any {
|
|
|
|
return {
|
|
|
|
'p': this.post,
|
|
|
|
'n': this.post,
|
|
|
|
'z': this.toggleZenMode
|
|
|
|
};
|
2018-06-06 15:14:37 -05:00
|
|
|
}
|
|
|
|
},
|
2018-02-12 04:59:24 -06:00
|
|
|
|
2018-09-22 05:59:37 -05:00
|
|
|
watch: {
|
|
|
|
'$store.state.uiHeaderHeight'() {
|
|
|
|
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
|
2018-10-14 05:44:30 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
navbar() {
|
|
|
|
if (this.navbar != 'top') {
|
|
|
|
this.$store.commit('setUiHeaderHeight', 0);
|
|
|
|
}
|
2018-09-22 05:59:37 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
|
|
|
|
},
|
|
|
|
|
2018-09-17 15:35:06 -05:00
|
|
|
methods: {
|
|
|
|
post() {
|
|
|
|
(this as any).apis.post();
|
|
|
|
},
|
2018-06-08 06:34:44 -05:00
|
|
|
|
2018-09-17 15:35:06 -05:00
|
|
|
toggleZenMode() {
|
|
|
|
this.zenMode = !this.zenMode;
|
2018-09-22 06:11:13 -05:00
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$store.commit('setUiHeaderHeight', this.$refs.header.$el.offsetHeight);
|
|
|
|
});
|
2018-02-12 04:59:24 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2018-05-31 02:44:11 -05:00
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.mk-ui
|
2018-09-22 05:59:37 -05:00
|
|
|
min-height 100vh
|
|
|
|
padding-top 48px
|
|
|
|
|
|
|
|
> .bg
|
|
|
|
position fixed
|
|
|
|
top 0
|
|
|
|
left 0
|
|
|
|
width 100%
|
|
|
|
height 100vh
|
|
|
|
background-size cover
|
|
|
|
background-position center
|
|
|
|
background-attachment fixed
|
|
|
|
opacity 0.3
|
2018-06-05 07:36:21 -05:00
|
|
|
|
2018-10-14 05:44:30 -05:00
|
|
|
> .content.sidebar.left
|
2018-10-14 16:03:15 -05:00
|
|
|
padding-left 68px
|
2018-10-14 05:44:30 -05:00
|
|
|
|
|
|
|
> .content.sidebar.right
|
2018-10-14 16:03:15 -05:00
|
|
|
padding-right 68px
|
2018-10-14 05:44:30 -05:00
|
|
|
|
2018-05-31 02:44:11 -05:00
|
|
|
</style>
|