2
0
mirror of https://github.com/frappe/books.git synced 2025-01-26 08:38:27 +00:00
books/src/App.vue

88 lines
2.1 KiB
Vue
Raw Normal View History

2018-06-01 18:05:51 +05:30
<template>
<div id="app" class="h-screen flex flex-col font-sans">
<Desk class="flex-1" v-if="showDesk" />
2018-10-23 18:12:36 +05:30
<database-selector v-if="showDatabaseSelector" @file="connectToDBFile" />
<setup-wizard v-if="showSetupWizard" />
2019-10-19 19:56:13 +05:30
<Settings v-if="showSettings" />
<portal-target name="popovers" multiple></portal-target>
2018-06-01 18:05:51 +05:30
</div>
</template>
<script>
import './styles/index.css';
2018-10-22 23:32:47 +05:30
import frappe from 'frappejs';
2018-10-23 18:12:36 +05:30
import Desk from './pages/Desk';
2018-10-05 11:05:20 +05:30
import SetupWizard from './pages/SetupWizard/SetupWizard';
2018-10-23 18:12:36 +05:30
import DatabaseSelector from './pages/DatabaseSelector';
2019-11-19 23:20:00 +05:30
import Settings from '@/pages/Settings/Settings.vue';
import { remote } from 'electron';
2018-06-01 18:05:51 +05:30
export default {
name: 'App',
data() {
return {
2018-10-23 18:12:36 +05:30
showDatabaseSelector: false,
showDesk: false,
2019-10-19 19:56:13 +05:30
showSetupWizard: false,
showSettings: false
};
},
watch: {
showDatabaseSelector(newValue) {
if (newValue) {
remote.getCurrentWindow().setSize(600, 600);
}
},
showSetupWizard(newValue) {
if (newValue) {
remote.getCurrentWindow().setSize(600, 600);
}
},
2019-10-19 19:56:13 +05:30
showSettings(newValue) {
if (newValue) {
remote.getCurrentWindow().setSize(460, 577);
}
},
showDesk(newValue) {
if (newValue) {
remote.getCurrentWindow().setSize(1200, 907);
}
2019-10-19 19:56:13 +05:30
}
},
2018-06-01 18:05:51 +05:30
components: {
2018-10-23 18:12:36 +05:30
Desk,
2018-10-22 23:40:22 +05:30
SetupWizard,
2019-10-19 19:56:13 +05:30
DatabaseSelector,
Settings
},
2018-10-23 18:12:36 +05:30
mounted() {
2019-10-24 16:09:57 +05:30
if (!localStorage.dbPath) {
2018-10-23 18:12:36 +05:30
this.showDatabaseSelector = true;
} else {
frappe.events.trigger('connect-database', localStorage.dbPath);
}
2018-10-22 23:32:47 +05:30
frappe.events.on('show-setup-wizard', () => {
2018-10-23 18:12:36 +05:30
this.showSetupWizard = true;
2018-10-05 11:05:20 +05:30
this.showDesk = false;
2018-10-23 18:12:36 +05:30
this.showDatabaseSelector = false;
});
2018-10-05 11:05:20 +05:30
2018-10-22 23:32:47 +05:30
frappe.events.on('show-desk', () => {
2019-11-19 23:20:00 +05:30
if (this.$route.path.startsWith('/settings')) {
2019-10-24 16:09:57 +05:30
this.showSettings = true;
} else {
this.showDesk = true;
}
2018-10-23 18:12:36 +05:30
this.showSetupWizard = false;
this.showDatabaseSelector = false;
});
2018-10-23 18:12:36 +05:30
},
methods: {
connectToDBFile(filePath) {
frappe.events.trigger('DatabaseSelector:file-selected', filePath);
}
2018-06-01 18:05:51 +05:30
}
};
2018-06-01 18:05:51 +05:30
</script>