Stackedit/src/components/menus/WorkspacesMenu.vue

71 lines
1.8 KiB
Vue
Raw Normal View History

2017-12-10 23:49:20 +00:00
<template>
<div class="side-bar__panel side-bar__panel--menu">
<div class="workspace" v-for="(workspace, id) in workspaces" :key="id">
<menu-entry :href="workspace.url" target="_blank">
2017-12-17 15:08:52 +00:00
<icon-provider slot="icon" :provider-id="workspace.providerId"></icon-provider>
<div class="workspace__name"><div class="menu-entry__label" v-if="currentWorkspace === workspace">current</div>{{workspace.name}}</div>
2017-12-10 23:49:20 +00:00
</menu-entry>
</div>
<hr>
<menu-entry @click.native="addGoogleDriveWorkspace">
<icon-provider slot="icon" provider-id="googleDriveWorkspace"></icon-provider>
<span>Add Google Drive workspace</span>
</menu-entry>
<menu-entry @click.native="manageWorkspaces">
<icon-database slot="icon"></icon-database>
<span>Manage workspaces</span>
</menu-entry>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import MenuEntry from './common/MenuEntry';
import googleHelper from '../../services/providers/helpers/googleHelper';
export default {
components: {
MenuEntry,
},
computed: {
...mapGetters('data', [
'workspaces',
]),
2017-12-17 15:08:52 +00:00
...mapGetters('workspace', [
'currentWorkspace',
]),
2017-12-10 23:49:20 +00:00
},
methods: {
addGoogleDriveWorkspace() {
return googleHelper.addDriveAccount()
.then(token => this.$store.dispatch('modal/open', {
type: 'googleDriveWorkspace',
token,
}))
.catch(() => {}); // Cancel
},
manageWorkspaces() {
return this.$store.dispatch('modal/open', 'workspaceManagement');
},
},
};
</script>
<style lang="scss">
2017-12-17 15:08:52 +00:00
@import '../common/variables.scss';
.workspace .menu-entry {
padding-top: 12px;
padding-bottom: 12px;
}
2017-12-10 23:49:20 +00:00
.workspace__name {
font-weight: bold;
2017-12-17 15:08:52 +00:00
line-height: 1.2;
2017-12-10 23:49:20 +00:00
.menu-entry div & {
text-decoration: none;
}
}
</style>