2018-10-19 05:15:28 +00:00
|
|
|
<template>
|
2019-11-08 20:34:06 +00:00
|
|
|
<div
|
|
|
|
id="app"
|
|
|
|
:dir="dir"
|
2021-02-09 18:54:52 +00:00
|
|
|
v-shortkey="KEYBOARD_SHORTCUTS"
|
|
|
|
@shortkey="handleShortcutAction"
|
2019-11-08 20:34:06 +00:00
|
|
|
>
|
2021-02-22 01:20:33 +00:00
|
|
|
<dock v-if="user || isPublicRoute" />
|
2021-02-01 21:16:03 +00:00
|
|
|
<global-modals />
|
2020-10-31 17:44:15 +00:00
|
|
|
|
2021-02-03 05:35:19 +00:00
|
|
|
<main :class="{
|
|
|
|
'authorizing': !user,
|
2021-02-21 18:14:46 +00:00
|
|
|
'bg-dark text-white': darkTheme,
|
2021-02-03 05:35:19 +00:00
|
|
|
'offset': !isBoard,
|
|
|
|
}"
|
|
|
|
>
|
2020-09-26 00:09:20 +00:00
|
|
|
<router-view />
|
|
|
|
</main>
|
2019-11-08 20:34:06 +00:00
|
|
|
</div>
|
2018-10-19 05:15:28 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-01-10 19:55:45 +00:00
|
|
|
import Dock from '@/components/Dock';
|
2021-02-01 21:16:03 +00:00
|
|
|
import GlobalModals from '@/components/GlobalModals';
|
2018-11-05 02:28:29 +00:00
|
|
|
import firebase from 'firebase/app';
|
2020-10-14 00:38:35 +00:00
|
|
|
import { mapState, mapGetters } from 'vuex';
|
2021-02-18 19:40:53 +00:00
|
|
|
import { KEYBOARD_SHORTCUTS, FIREBASE_CONFIG } from '@/constants';
|
2018-10-25 06:33:15 +00:00
|
|
|
|
2021-02-18 19:40:53 +00:00
|
|
|
firebase.initializeApp(FIREBASE_CONFIG);
|
2018-10-25 06:33:15 +00:00
|
|
|
|
2018-10-19 05:15:28 +00:00
|
|
|
export default {
|
2019-11-08 19:56:03 +00:00
|
|
|
name: 'App',
|
2018-10-19 05:15:28 +00:00
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
components: {
|
2021-01-10 19:55:45 +00:00
|
|
|
Dock,
|
2021-02-01 21:16:03 +00:00
|
|
|
GlobalModals,
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
2018-10-25 06:33:15 +00:00
|
|
|
|
2020-08-11 04:16:43 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
debugUserId: null,
|
2021-02-09 18:54:52 +00:00
|
|
|
KEYBOARD_SHORTCUTS,
|
2020-08-11 04:16:43 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
computed: {
|
2021-02-27 03:01:11 +00:00
|
|
|
...mapState(['user', 'settings', 'sessionExpired']),
|
2021-02-21 18:14:46 +00:00
|
|
|
...mapGetters(['darkTheme']),
|
2018-11-21 02:43:10 +00:00
|
|
|
|
2020-08-11 04:16:43 +00:00
|
|
|
userId() {
|
|
|
|
return this.debugUserId || this.user.uid;
|
|
|
|
},
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
dir() {
|
2021-02-22 01:20:33 +00:00
|
|
|
const { settings } = this;
|
2021-02-22 01:02:07 +00:00
|
|
|
|
2021-02-22 01:20:33 +00:00
|
|
|
return settings && settings.language === 'ar' ? 'rtl' : 'ltr';
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
2020-10-05 18:42:28 +00:00
|
|
|
|
2021-02-22 01:20:33 +00:00
|
|
|
isPublicRoute() {
|
2020-10-05 18:42:28 +00:00
|
|
|
return this.$route.meta && this.$route.meta.public;
|
|
|
|
},
|
2020-11-18 05:55:35 +00:00
|
|
|
|
|
|
|
isBoard() {
|
2021-01-06 21:42:33 +00:00
|
|
|
return ['public-board', 'board'].includes(this.$route.name);
|
2020-11-18 05:55:35 +00:00
|
|
|
},
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
|
|
|
|
2020-10-15 23:15:09 +00:00
|
|
|
async mounted() {
|
|
|
|
await this.$store.dispatch('GET_TWITCH_TOKEN');
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
this.init();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2021-02-09 18:54:52 +00:00
|
|
|
handleShortcutAction(data) {
|
|
|
|
this.$bus.$emit('HANDLE_SHORTCUT', data);
|
|
|
|
},
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
init() {
|
2021-02-22 01:20:33 +00:00
|
|
|
if (this.isPublicRoute) {
|
2020-10-05 18:42:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
if (this.user) {
|
2020-09-09 23:36:04 +00:00
|
|
|
this.load();
|
2020-09-28 23:27:08 +00:00
|
|
|
} else if (this.$route.name !== 'auth') {
|
|
|
|
this.$router.replace({ name: 'auth' });
|
2019-11-08 19:56:03 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-09-09 23:36:04 +00:00
|
|
|
load() {
|
2021-03-03 23:14:57 +00:00
|
|
|
this.$store.dispatch('LOAD_RELEASES');
|
|
|
|
this.$store.dispatch('LOAD_WALLPAPERS');
|
|
|
|
this.$store.dispatch('SYNC_LOAD_SETTINGS');
|
|
|
|
this.$store.dispatch('SYNC_LOAD_TAGS');
|
|
|
|
this.$store.dispatch('SYNC_LOAD_NOTES');
|
|
|
|
this.$store.dispatch('SYNC_LOAD_PROGRESSES');
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
|
|
|
},
|
2018-10-19 05:15:28 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss">
|
2020-08-25 23:41:57 +00:00
|
|
|
@import "~styles/styles";
|
2018-10-19 05:15:28 +00:00
|
|
|
</style>
|
2019-02-15 22:58:32 +00:00
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
2020-09-26 00:09:20 +00:00
|
|
|
main {
|
|
|
|
height: 100vh;
|
|
|
|
overflow-y: auto;
|
2020-09-28 23:27:08 +00:00
|
|
|
|
|
|
|
&.authorizing {
|
|
|
|
width: 100%;
|
|
|
|
left: 0;
|
|
|
|
}
|
2020-11-18 05:55:35 +00:00
|
|
|
|
|
|
|
&.offset {
|
2021-02-03 05:35:19 +00:00
|
|
|
padding-left: calc(58px + .5rem);
|
2020-11-18 05:55:35 +00:00
|
|
|
}
|
2019-11-08 20:34:06 +00:00
|
|
|
}
|
2019-02-15 22:58:32 +00:00
|
|
|
</style>
|