wip: Desktop UI
This commit is contained in:
parent
0d4d7c9c0c
commit
d7085b17fe
6 changed files with 100 additions and 13 deletions
|
@ -10,7 +10,7 @@ import { faExpandAlt, faColumns, faExternalLinkAlt, faLink, faWindowMaximize } f
|
|||
import * as os from '@/os';
|
||||
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
||||
import { router } from '@/router';
|
||||
import { deckmode, url } from '@/config';
|
||||
import { ui, url } from '@/config';
|
||||
import { popout } from '@/scripts/popout';
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -114,7 +114,10 @@ export default defineComponent({
|
|||
if (this.$store.state.device.defaultSideView && this.sideViewHook && this.to !== '/') {
|
||||
return this.sideViewHook(this.to);
|
||||
}
|
||||
if (this.$store.state.device.deckNavWindow && deckmode && this.to !== '/') {
|
||||
if (this.$store.state.device.deckNavWindow && (ui === 'deck') && this.to !== '/') {
|
||||
return this.window();
|
||||
}
|
||||
if (ui === 'desktop') {
|
||||
return this.window();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,5 +13,5 @@ export const langs = _LANGS_;
|
|||
export const getLocale = async () => Object.fromEntries((await entries(clientDb.i18n)) as [string, string][]);
|
||||
export const version = _VERSION_;
|
||||
export const instanceName = siteName === 'Misskey' ? host : siteName;
|
||||
export const deckmode = localStorage.getItem('deckmode') === 'true';
|
||||
export const ui = localStorage.getItem('ui');
|
||||
export const debug = localStorage.getItem('debug') === 'true';
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
import '@/style.scss';
|
||||
|
||||
import { createApp, defineAsyncComponent } from 'vue';
|
||||
import { createApp } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
import widgets from './widgets';
|
||||
import directives from './directives';
|
||||
import components from '@/components';
|
||||
import { version, apiUrl, deckmode } from '@/config';
|
||||
import { version, apiUrl, ui } from '@/config';
|
||||
import { store } from './store';
|
||||
import { router } from './router';
|
||||
import { applyTheme } from '@/scripts/theme';
|
||||
|
@ -154,7 +154,8 @@ stream.init(store.state.i);
|
|||
const app = createApp(await (
|
||||
window.location.search === '?zen' ? import('@/ui/zen.vue') :
|
||||
!store.getters.isSignedIn ? import('@/ui/visitor.vue') :
|
||||
deckmode ? import('@/ui/deck.vue') :
|
||||
ui === 'deck' ? import('@/ui/deck.vue') :
|
||||
ui === 'desktop' ? import('@/ui/desktop.vue') :
|
||||
import('@/ui/default.vue')
|
||||
).then(x => x.default));
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import { faBell, faComments, faEnvelope } from '@fortawesome/free-regular-svg-ic
|
|||
import { faAt, faBroadcastTower, faCloud, faColumns, faDoorClosed, faFileAlt, faFireAlt, faGamepad, faHashtag, faListUl, faSatellite, faSatelliteDish, faSearch, faStar, faTerminal, faUserClock, faUsers } from '@fortawesome/free-solid-svg-icons';
|
||||
import { computed } from 'vue';
|
||||
import { store } from '@/store';
|
||||
import { deckmode } from '@/config';
|
||||
import { search } from '@/scripts/search';
|
||||
import * as os from '@/os';
|
||||
|
||||
export const sidebarDef = {
|
||||
notifications: {
|
||||
|
@ -119,12 +119,29 @@ export const sidebarDef = {
|
|||
show: computed(() => store.getters.isSignedIn),
|
||||
to: computed(() => `/@${store.state.i.username}/room`),
|
||||
},
|
||||
deck: {
|
||||
title: deckmode ? 'undeck' : 'deck',
|
||||
ui: {
|
||||
title: 'switchUi',
|
||||
icon: faColumns,
|
||||
action: () => {
|
||||
localStorage.setItem('deckmode', (!deckmode).toString());
|
||||
location.reload();
|
||||
action: (ev) => {
|
||||
os.modalMenu([{
|
||||
text: 'Default',
|
||||
action: () => {
|
||||
localStorage.setItem('ui', 'default');
|
||||
location.reload();
|
||||
}
|
||||
}, {
|
||||
text: 'Deck',
|
||||
action: () => {
|
||||
localStorage.setItem('ui', 'deck');
|
||||
location.reload();
|
||||
}
|
||||
}, {
|
||||
text: 'Desktop',
|
||||
action: () => {
|
||||
localStorage.setItem('ui', 'desktop');
|
||||
location.reload();
|
||||
}
|
||||
}], ev.currentTarget || ev.target);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ export const defaultDeviceUserSettings = {
|
|||
'announcements',
|
||||
'search',
|
||||
'-',
|
||||
'deck',
|
||||
'ui',
|
||||
],
|
||||
deck: {
|
||||
columns: [],
|
||||
|
|
66
src/client/ui/desktop.vue
Normal file
66
src/client/ui/desktop.vue
Normal file
|
@ -0,0 +1,66 @@
|
|||
<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;
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
help() {
|
||||
this.$router.push('/docs/keyboard-shortcut');
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mk-app {
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
Loading…
Reference in a new issue