summaryrefslogtreecommitdiff
path: root/src/client/ui/desktop.vue
blob: 6c5159e83f97d1befb8d923f8531d115aab4f3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
<div class="mk-app" v-hotkey.global="keymap" :class="{ wallpaper }" @contextmenu.prevent="() => {}">
	<XSidebar ref="nav" class="sidebar"/>

	<XCommon/>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { host } from '@/config';
import { search } from '@/scripts/search';
import XCommon from './_common_/common.vue';
import * as os from '@/os';
import XSidebar from '@/components/sidebar.vue';
import { sidebarDef } from '@/sidebar';

export default defineComponent({
	components: {
		XCommon,
		XSidebar
	},

	data() {
		return {
			host: host,
			menuDef: sidebarDef,
			wallpaper: localStorage.getItem('wallpaper') != null,
		};
	},

	computed: {
		keymap(): any {
			return {
				'd': () => {
					if (this.$store.state.device.syncDeviceDarkMode) return;
					this.$store.commit('device/set', { key: 'darkMode', value: !this.$store.state.device.darkMode });
				},
				'p': os.post,
				'n': os.post,
				's': () => search(),
				'h|/': this.help
			};
		},

		menu(): string[] {
			return this.$store.state.deviceUser.menu;
		},
	},

	created() {
		if (window.innerWidth < 1024) {
			localStorage.setItem('ui', 'default');
			location.reload();
		}
	},

	methods: {
		help() {
			this.$router.push('/docs/keyboard-shortcut');
		},
	}
});
</script>

<style lang="scss" scoped>
.mk-app {
	height: 100vh;
	width: 100vw;
}
</style>

<style lang="scss">
</style>