rudeshark.net/src/client/app/desktop/views/components/ui.vue

75 lines
1.3 KiB
Vue
Raw Normal View History

2018-02-10 06:56:33 +01:00
<template>
<div class="mk-ui" :style="style" v-hotkey.global="keymap">
2018-06-08 13:34:44 +02:00
<x-header class="header" v-show="!zenMode"/>
2018-02-12 11:59:24 +01:00
<div class="content">
<slot></slot>
</div>
2018-05-27 06:49:09 +02:00
<mk-stream-indicator v-if="$store.getters.isSignedIn"/>
2018-02-10 06:56:33 +01:00
</div>
</template>
2018-02-12 11:59:24 +01:00
<script lang="ts">
import Vue from 'vue';
2018-02-20 14:53:34 +01:00
import XHeader from './ui.header.vue';
2018-02-12 11:59:24 +01:00
export default Vue.extend({
2018-02-20 14:53:34 +01:00
components: {
2018-02-20 17:39:51 +01:00
XHeader
2018-02-20 14:53:34 +01:00
},
2018-06-08 13:34:44 +02:00
data() {
return {
zenMode: false
};
},
2018-06-06 22:14:37 +02:00
computed: {
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 })`
};
},
keymap(): any {
return {
'p': this.post,
'n': this.post,
'z': this.toggleZenMode
};
2018-06-06 22:14:37 +02:00
}
},
2018-02-12 11:59:24 +01:00
methods: {
post() {
(this as any).apis.post();
},
2018-06-08 13:34:44 +02:00
toggleZenMode() {
this.zenMode = !this.zenMode;
2018-02-12 11:59:24 +01:00
}
}
});
</script>
2018-05-31 09:44:11 +02:00
<style lang="stylus" scoped>
.mk-ui
2018-06-05 14:36:21 +02:00
display flex
flex-direction column
flex 1
2018-06-06 22:14:37 +02:00
background-size cover
background-position center
background-attachment fixed
2018-06-05 14:36:21 +02:00
2018-05-31 09:44:11 +02:00
> .header
@media (max-width 1000px)
display none
2018-06-05 14:36:21 +02:00
> .content
display flex
flex-direction column
flex 1
2018-06-06 19:06:32 +02:00
overflow hidden
2018-05-31 09:44:11 +02:00
</style>