antares/src/renderer/App.vue

147 lines
4.5 KiB
Vue
Raw Normal View History

2020-04-30 17:48:53 +02:00
<template>
<div id="wrapper" :class="[`theme-${applicationTheme}`, !disableBlur || 'no-blur']">
2020-06-02 19:13:57 +02:00
<TheTitleBar />
<div id="window-content">
<TheSettingBar />
<div id="main-content" class="container">
2021-07-08 17:43:33 +02:00
<div class="columns col-gapless">
2020-06-03 20:56:44 +02:00
<Workspace
2020-06-02 19:13:57 +02:00
v-for="connection in connections"
:key="connection.uid"
:connection="connection"
/>
<div class="connection-panel-wrapper">
<WorkspaceAddConnectionPanel v-if="selectedWorkspace === 'NEW'" />
</div>
2020-06-02 19:13:57 +02:00
</div>
2021-07-08 17:43:33 +02:00
<TheFooter />
<TheNotificationsBoard />
<TheScratchpad v-if="isScratchpad" />
<ModalSettings v-if="isSettingModal" />
<BaseTextEditor class="d-none" value="" />
2020-05-14 15:21:57 +02:00
</div>
2020-05-07 17:45:04 +02:00
</div>
2020-04-30 17:48:53 +02:00
</div>
</template>
<script>
2022-04-21 14:39:24 +02:00
import { defineAsyncComponent } from 'vue';
2020-05-12 18:27:31 +02:00
import { mapActions, mapGetters } from 'vuex';
import { ipcRenderer } from 'electron';
import { Menu, getCurrentWindow } from '@electron/remote';
2022-04-21 14:39:24 +02:00
import TheSettingBar from '@/components/TheSettingBar';
2020-04-30 17:48:53 +02:00
export default {
name: 'App',
components: {
2022-04-21 14:39:24 +02:00
TheTitleBar: defineAsyncComponent(() => import(/* webpackChunkName: "TheTitleBar" */'@/components/TheTitleBar')),
TheSettingBar,
TheFooter: defineAsyncComponent(() => import(/* webpackChunkName: "TheFooter" */'@/components/TheFooter')),
TheNotificationsBoard: defineAsyncComponent(() => import(/* webpackChunkName: "TheNotificationsBoard" */'@/components/TheNotificationsBoard')),
Workspace: defineAsyncComponent(() => import(/* webpackChunkName: "Workspace" */'@/components/Workspace')),
WorkspaceAddConnectionPanel: defineAsyncComponent(() => import(/* webpackChunkName: "WorkspaceAddConnectionPanel" */'@/components/WorkspaceAddConnectionPanel')),
ModalSettings: defineAsyncComponent(() => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings')),
TheScratchpad: defineAsyncComponent(() => import(/* webpackChunkName: "TheScratchpad" */'@/components/TheScratchpad')),
BaseTextEditor: defineAsyncComponent(() => import(/* webpackChunkName: "BaseTextEditor" */'@/components/BaseTextEditor'))
2020-05-07 17:45:04 +02:00
},
computed: {
2020-05-12 18:27:31 +02:00
...mapGetters({
2021-07-08 17:43:33 +02:00
selectedWorkspace: 'workspaces/getSelected',
2020-05-12 18:27:31 +02:00
isLoading: 'application/isLoading',
2020-05-30 12:54:05 +02:00
isSettingModal: 'application/isSettingModal',
isScratchpad: 'application/isScratchpad',
2020-12-04 11:19:16 +01:00
connections: 'connections/getConnections',
2021-04-03 11:21:58 +02:00
applicationTheme: 'settings/getApplicationTheme',
disableBlur: 'settings/getDisableBlur',
2020-12-04 11:19:16 +01:00
isUnsavedDiscardModal: 'workspaces/isUnsavedDiscardModal'
2020-05-08 18:02:18 +02:00
})
2020-05-07 17:45:04 +02:00
},
2020-06-19 18:03:52 +02:00
mounted () {
ipcRenderer.send('check-for-updates');
2021-04-11 12:35:16 +02:00
this.checkVersionUpdate();
const InputMenu = Menu.buildFromTemplate([
{
label: this.$t('word.cut'),
role: 'cut'
},
{
label: this.$t('word.copy'),
role: 'copy'
},
{
label: this.$t('word.paste'),
role: 'paste'
},
{
type: 'separator'
},
{
label: this.$t('message.selectAll'),
role: 'selectall'
}
]);
document.body.addEventListener('contextmenu', (e) => {
e.preventDefault();
e.stopPropagation();
let node = e.target;
while (node) {
if (node.nodeName.match(/^(input|textarea)$/i) || node.isContentEditable) {
InputMenu.popup(getCurrentWindow());
break;
}
node = node.parentNode;
}
});
2020-06-19 18:03:52 +02:00
},
2020-05-07 17:45:04 +02:00
methods: {
2020-05-08 18:02:18 +02:00
...mapActions({
2021-04-11 12:35:16 +02:00
showNewConnModal: 'application/showNewConnModal',
checkVersionUpdate: 'application/checkVersionUpdate'
2020-05-08 18:02:18 +02:00
})
2020-04-30 17:48:53 +02:00
}
};
</script>
2020-05-14 15:21:57 +02:00
<style lang="scss">
2020-08-03 18:07:08 +02:00
html,
body {
height: 100%;
}
2020-05-08 18:02:18 +02:00
2020-08-03 18:07:08 +02:00
#wrapper {
height: 100vh;
position: relative;
}
2020-05-08 18:02:18 +02:00
2020-08-03 18:07:08 +02:00
#window-content {
display: flex;
position: relative;
overflow: hidden;
}
2020-06-02 19:13:57 +02:00
2020-08-03 18:07:08 +02:00
#main-content {
padding: 0;
justify-content: flex-start;
height: calc(100vh - #{$excluding-size});
width: calc(100% - #{$settingbar-width});
2020-05-14 15:21:57 +02:00
2020-08-03 18:07:08 +02:00
> .columns {
height: calc(100vh - #{$footer-height});
}
.connection-panel-wrapper{
height: calc(100vh - #{$excluding-size});
width: 100%;
padding-top: 15vh;
display: flex;
justify-content: center;
align-items: flex-start;
overflow: auto;
}
2020-08-03 18:07:08 +02:00
}
2020-04-30 17:48:53 +02:00
</style>