Parcourir la source

Resolve "add settings option to inflate sidebar in wide mode"

Eric Tröbs il y a 4 ans
Parent
commit
889818cf2f

+ 2 - 1
settings.json

@@ -1,6 +1,7 @@
 {
 {
   "frontend": {
   "frontend": {
     "host": "",
     "host": "",
-    "port": 5000
+    "port": 5000,
+    "collapse": false
   }
   }
 }
 }

+ 5 - 1
webui/src/App.vue

@@ -10,7 +10,9 @@
       <!-- side navigation bar -->
       <!-- side navigation bar -->
       <side-navigation-bar :window="window"
       <side-navigation-bar :window="window"
                            :socket="socket"
                            :socket="socket"
-                           :project-path="currentProjectPath"></side-navigation-bar>
+                           :status="status"
+                           :project-path="currentProjectPath"
+                           v-on:close="window.menu = false"></side-navigation-bar>
 
 
       <!-- actual content -->
       <!-- actual content -->
       <div class="content">
       <div class="content">
@@ -23,6 +25,7 @@
           <project-settings-window v-if="window.content === 'settings'"
           <project-settings-window v-if="window.content === 'settings'"
                                    :current-project="currentProject"
                                    :current-project="currentProject"
                                    :current-project-path="currentProjectPath"
                                    :current-project-path="currentProjectPath"
+                                   :status="status"
                                    :socket="socket"/>
                                    :socket="socket"/>
         </template>
         </template>
       </div>
       </div>
@@ -118,6 +121,7 @@ export default {
   flex-grow: 1;
   flex-grow: 1;
   flex-direction: row;
   flex-direction: row;
   width: 100%;
   width: 100%;
+  position: relative;
 }
 }
 
 
 .content {
 .content {

+ 5 - 3
webui/src/assets/style/main.css

@@ -2,13 +2,15 @@
     box-sizing: border-box;
     box-sizing: border-box;
 }
 }
 
 
+html, body {
+    width: 100%;
+    height: 100%;
+}
+
 body {
 body {
     margin: 0;
     margin: 0;
     padding: 0;
     padding: 0;
     font-family: "Roboto";
     font-family: "Roboto";
 
 
-    width: 100vw;
-    height: 100vh;
-
     overflow: hidden;
     overflow: hidden;
 }
 }

+ 33 - 4
webui/src/components/window/side-navigation-bar.vue

@@ -1,6 +1,11 @@
 <template>
 <template>
   <div class="side-navigation"
   <div class="side-navigation"
-       :class="{ wide: window.wide, narrow: !window.wide, active: window.menu }">
+       :class="{
+         wide: window.wide,
+         narrow: !window.wide,
+         active: window.menu ,
+         collapsed: collapsed
+       }">
     <!-- project settings -->
     <!-- project settings -->
     <div class="item"
     <div class="item"
          :class="{active: window.content === 'settings', inactive: !projectPath}"
          :class="{active: window.content === 'settings', inactive: !projectPath}"
@@ -13,13 +18,27 @@
          @click="close">
          @click="close">
       Close
       Close
     </div>
     </div>
+
+    <div v-if="window.wide"
+         class="item"
+         @click="collapse">
+      Collapse
+    </div>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 export default {
 export default {
   name: "side-navigation-bar",
   name: "side-navigation-bar",
-  props: ['window', 'socket', 'projectPath'],
+  props: ['window', 'socket', 'status', 'projectPath'],
+  computed: {
+    collapsed: function() {
+      if (!this.status)
+        return false;
+
+      return this.status.settings.frontend.collapse;
+    }
+  },
   methods: {
   methods: {
     ifProjectIsOpened: function(fun, ...args) {
     ifProjectIsOpened: function(fun, ...args) {
       if (this.projectPath)
       if (this.projectPath)
@@ -27,10 +46,16 @@ export default {
     },
     },
     show: function(value) {
     show: function(value) {
       this.window.content = value;
       this.window.content = value;
+      this.$emit('close', null);
     },
     },
     close: function() {
     close: function() {
-      if (this.projectPath)
+      if (this.projectPath) {
         this.socket.set(this.projectPath + '/status', 'save');
         this.socket.set(this.projectPath + '/status', 'save');
+        this.$emit('close', null);
+      }
+    },
+    collapse: function() {
+      this.socket.set('settings/frontend/collapse', !this.collapsed);
     }
     }
   }
   }
 }
 }
@@ -61,11 +86,15 @@ export default {
 }
 }
 
 
 .side-navigation .item {
 .side-navigation .item {
-  padding: 1rem 3rem 1rem 1rem;
+  padding: 1rem 4rem 1rem 1rem;
   cursor: pointer;
   cursor: pointer;
   white-space: nowrap;
   white-space: nowrap;
 }
 }
 
 
+.side-navigation.wide.collapsed .item {
+  width: 10px;
+}
+
 .side-navigation .item:hover:not(.inactive) {
 .side-navigation .item:hover:not(.inactive) {
   background-color: #292929;
   background-color: #292929;
 }
 }