|
@@ -1,36 +1,52 @@
|
|
|
<template>
|
|
|
<div id="app">
|
|
|
- <!-- <img alt="Ape" src="/logo.png"> -->
|
|
|
+ <!-- top navigation bar -->
|
|
|
+ <top-navigation-bar :window="window"
|
|
|
+ :current-project="currentProject"
|
|
|
+ v-on:side="window.menu = !window.menu"></top-navigation-bar>
|
|
|
|
|
|
- <project-open-dialog v-if="showProjectOpenDialog"
|
|
|
- :status="status" :socket="socket"
|
|
|
- @create="showProjectCreationDialog=true"/>
|
|
|
- <project-creation-dialog v-if="showProjectCreationDialog"
|
|
|
- :status="status" :socket="socket"
|
|
|
- @cancel="showProjectCreationDialog=false"/>
|
|
|
- <project-main-window v-if="showProjectMainWindow"
|
|
|
- :status="status" :socket="socket"/>
|
|
|
+ <!-- bottom content -->
|
|
|
+ <div class="bottom">
|
|
|
+ <!-- side navigation bar -->
|
|
|
+ <side-navigation-bar :window="window"
|
|
|
+ :socket="socket"
|
|
|
+ :project-path="currentProjectPath"></side-navigation-bar>
|
|
|
|
|
|
- <pre style="text-align: left; font-size: 80%">{{ this.status }}</pre>
|
|
|
+ <!-- actual content -->
|
|
|
+ <div class="content">
|
|
|
+ <project-open-window v-if="!currentProject"
|
|
|
+ :projects="projects"
|
|
|
+ :status="status"
|
|
|
+ :socket="socket"
|
|
|
+ v-on:open="show('settings')"/>
|
|
|
+ <template v-else>
|
|
|
+ <project-settings-window v-if="window.content === 'settings'"
|
|
|
+ :current-project="currentProject"
|
|
|
+ :current-project-path="currentProjectPath"
|
|
|
+ :socket="socket"/>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import io from "socket.io-client";
|
|
|
-import ProjectOpenDialog from "@/components/projects/project-open-dialog";
|
|
|
-import ProjectMainWindow from "@/components/projects/project-main-window";
|
|
|
-import ProjectCreationDialog from "@/components/projects/project-creation-dialog";
|
|
|
+import ProjectOpenWindow from "@/components/projects/project-open-window";
|
|
|
+import TopNavigationBar from "@/components/window/top-navigation-bar";
|
|
|
+import SideNavigationBar from "@/components/window/side-navigation-bar";
|
|
|
+import ProjectSettingsWindow from "@/components/projects/project-settings-window";
|
|
|
|
|
|
export default {
|
|
|
name: 'App',
|
|
|
components: {
|
|
|
- ProjectCreationDialog,
|
|
|
- ProjectMainWindow,
|
|
|
- ProjectOpenDialog
|
|
|
+ ProjectSettingsWindow,
|
|
|
+ SideNavigationBar,
|
|
|
+ TopNavigationBar,
|
|
|
+ ProjectOpenWindow
|
|
|
},
|
|
|
data: function() {
|
|
|
return {
|
|
|
- status: null,
|
|
|
// initialize socket.io connection
|
|
|
socket: {
|
|
|
io: io('http://' + window.location.hostname + ':5000'),
|
|
@@ -41,22 +57,49 @@ export default {
|
|
|
this.io.emit('add', {path: path, value: value});
|
|
|
}
|
|
|
},
|
|
|
- showProjectCreationDialog: false
|
|
|
+ status: null,
|
|
|
+ window: {
|
|
|
+ wide: true,
|
|
|
+ menu: false,
|
|
|
+ content: 'settings',
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- showProjectOpenDialog: function() {
|
|
|
- return this.status != null
|
|
|
- && this.status.projects.filter(x => ['open', 'load'].includes(x.status)).length === 0
|
|
|
- && !this.showProjectCreationDialog;
|
|
|
+ projects: function() {
|
|
|
+ return this.status == null ? [] : this.status.projects;
|
|
|
+ },
|
|
|
+ currentProject: function() {
|
|
|
+ for (let i = 0; i < this.projects.length; i++)
|
|
|
+ if (this.projects[i].status === 'open')
|
|
|
+ return this.projects[i];
|
|
|
+
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ currentProjectPath: function() {
|
|
|
+ for (let i = 0; i < this.projects.length; i++)
|
|
|
+ if (this.projects[i].status === 'open')
|
|
|
+ return 'projects/' + i;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ resize: function() {
|
|
|
+ this.window.wide = (document.body.offsetWidth > 1024);
|
|
|
},
|
|
|
- showProjectMainWindow: function() {
|
|
|
- return this.status != null && this.status.projects.filter(x => ['open'].includes(x.status)).length > 0
|
|
|
- && !this.showProjectCreationDialog;
|
|
|
+ show: function(value) {
|
|
|
+ this.window.content = value;
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ created: function() {
|
|
|
this.socket.io.on('app_status', status => this.status = status);
|
|
|
+
|
|
|
+ window.addEventListener('resize', this.resize);
|
|
|
+ this.resize();
|
|
|
+ },
|
|
|
+ destroyed: function() {
|
|
|
+ window.removeEventListener('resize', this.resize);
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -65,5 +108,25 @@ export default {
|
|
|
#app {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
+
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
+
|
|
|
+.bottom {
|
|
|
+ display: flex;
|
|
|
+ flex-grow: 1;
|
|
|
+ flex-direction: row;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.content {
|
|
|
+ flex-grow: 1;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+
|
|
|
+.content > * {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
</style>
|