1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-19 09:08:31 +09:00

wip: Desktop UI

This commit is contained in:
syuilo 2020-11-03 17:00:47 +09:00
parent 0d4d7c9c0c
commit d7085b17fe
6 changed files with 100 additions and 13 deletions

View File

@ -10,7 +10,7 @@ import { faExpandAlt, faColumns, faExternalLinkAlt, faLink, faWindowMaximize } f
import * as os from '@/os'; import * as os from '@/os';
import copyToClipboard from '@/scripts/copy-to-clipboard'; import copyToClipboard from '@/scripts/copy-to-clipboard';
import { router } from '@/router'; import { router } from '@/router';
import { deckmode, url } from '@/config'; import { ui, url } from '@/config';
import { popout } from '@/scripts/popout'; import { popout } from '@/scripts/popout';
export default defineComponent({ export default defineComponent({
@ -114,7 +114,10 @@ export default defineComponent({
if (this.$store.state.device.defaultSideView && this.sideViewHook && this.to !== '/') { if (this.$store.state.device.defaultSideView && this.sideViewHook && this.to !== '/') {
return 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(); return this.window();
} }

View File

@ -13,5 +13,5 @@ export const langs = _LANGS_;
export const getLocale = async () => Object.fromEntries((await entries(clientDb.i18n)) as [string, string][]); export const getLocale = async () => Object.fromEntries((await entries(clientDb.i18n)) as [string, string][]);
export const version = _VERSION_; export const version = _VERSION_;
export const instanceName = siteName === 'Misskey' ? host : siteName; 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'; export const debug = localStorage.getItem('debug') === 'true';

View File

@ -4,13 +4,13 @@
import '@/style.scss'; import '@/style.scss';
import { createApp, defineAsyncComponent } from 'vue'; import { createApp } from 'vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import widgets from './widgets'; import widgets from './widgets';
import directives from './directives'; import directives from './directives';
import components from '@/components'; import components from '@/components';
import { version, apiUrl, deckmode } from '@/config'; import { version, apiUrl, ui } from '@/config';
import { store } from './store'; import { store } from './store';
import { router } from './router'; import { router } from './router';
import { applyTheme } from '@/scripts/theme'; import { applyTheme } from '@/scripts/theme';
@ -154,7 +154,8 @@ stream.init(store.state.i);
const app = createApp(await ( const app = createApp(await (
window.location.search === '?zen' ? import('@/ui/zen.vue') : window.location.search === '?zen' ? import('@/ui/zen.vue') :
!store.getters.isSignedIn ? import('@/ui/visitor.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') import('@/ui/default.vue')
).then(x => x.default)); ).then(x => x.default));

View File

@ -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 { 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 { computed } from 'vue';
import { store } from '@/store'; import { store } from '@/store';
import { deckmode } from '@/config';
import { search } from '@/scripts/search'; import { search } from '@/scripts/search';
import * as os from '@/os';
export const sidebarDef = { export const sidebarDef = {
notifications: { notifications: {
@ -119,12 +119,29 @@ export const sidebarDef = {
show: computed(() => store.getters.isSignedIn), show: computed(() => store.getters.isSignedIn),
to: computed(() => `/@${store.state.i.username}/room`), to: computed(() => `/@${store.state.i.username}/room`),
}, },
deck: { ui: {
title: deckmode ? 'undeck' : 'deck', title: 'switchUi',
icon: faColumns, icon: faColumns,
action: (ev) => {
os.modalMenu([{
text: 'Default',
action: () => { action: () => {
localStorage.setItem('deckmode', (!deckmode).toString()); localStorage.setItem('ui', 'default');
location.reload(); location.reload();
}
}, {
text: 'Deck',
action: () => {
localStorage.setItem('ui', 'deck');
location.reload();
}
}, {
text: 'Desktop',
action: () => {
localStorage.setItem('ui', 'desktop');
location.reload();
}
}], ev.currentTarget || ev.target);
}, },
}, },
}; };

View File

@ -36,7 +36,7 @@ export const defaultDeviceUserSettings = {
'announcements', 'announcements',
'search', 'search',
'-', '-',
'deck', 'ui',
], ],
deck: { deck: {
columns: [], columns: [],

66
src/client/ui/desktop.vue Normal file
View 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>