App.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div id="app">
  3. <!-- loading screen -->
  4. <loading-overlay v-if="!$root.connected"/>
  5. <!-- top navigation bar -->
  6. <top-navigation-bar :window="window"
  7. v-on:side="window.menu = !window.menu"
  8. @close="closeProject"></top-navigation-bar>
  9. <!-- bottom content -->
  10. <div class="bottom">
  11. <!-- side navigation bar -->
  12. <side-navigation-bar :window="window"
  13. v-on:close="window.menu = false"/>
  14. <!-- actual content -->
  15. <div class="content">
  16. <project-open-window v-if="currentPage === 'projects'"
  17. v-on:open="openProject"/>
  18. <project-settings-window v-if="currentPage === 'settings'"
  19. v-on:close="closeProject"/>
  20. <project-data-add-window v-if="currentPage === 'add_data'"/>
  21. <project-labels-window v-if="currentPage === 'labels'"/>
  22. <project-data-view-window v-if="currentPage === 'view_data'"/>
  23. <about-window v-if="currentPage === 'about'"/>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import ProjectOpenWindow from "@/components/projects/project-open-window";
  30. import TopNavigationBar from "@/components/window/top-navigation-bar";
  31. import SideNavigationBar from "@/components/window/side-navigation-bar";
  32. import ProjectSettingsWindow from "@/components/projects/project-settings-window";
  33. import AboutWindow from "@/components/other/about-window";
  34. import ProjectDataAddWindow from "@/components/projects/project-data-add-window";
  35. import ProjectDataViewWindow from "@/components/projects/project-data-view-window";
  36. import LoadingOverlay from "@/components/other/loading-overlay";
  37. import ProjectLabelsWindow from "@/components/projects/project-labels-window";
  38. export default {
  39. name: 'App',
  40. components: {
  41. ProjectLabelsWindow,
  42. LoadingOverlay,
  43. ProjectDataAddWindow,
  44. ProjectDataViewWindow,
  45. AboutWindow,
  46. ProjectSettingsWindow,
  47. SideNavigationBar,
  48. TopNavigationBar,
  49. ProjectOpenWindow
  50. },
  51. data: function () {
  52. return {
  53. window: {
  54. wide: true,
  55. menu: false,
  56. content: 'settings'
  57. }
  58. }
  59. },
  60. created: function () {
  61. window.addEventListener('resize', this.resize);
  62. this.resize();
  63. },
  64. destroyed: function () {
  65. window.removeEventListener('resize', this.resize);
  66. },
  67. computed: {
  68. currentPage: function () {
  69. if (!this.$root.project) {
  70. if (this.window.content === 'about')
  71. return this.window.content;
  72. else
  73. return 'projects';
  74. } else
  75. return this.window.content;
  76. }
  77. },
  78. methods: {
  79. resize: function () {
  80. this.window.wide = (document.body.offsetWidth > 1024);
  81. },
  82. show: function (value) {
  83. this.window.content = value;
  84. },
  85. openProject: function () {
  86. this.show('settings');
  87. },
  88. closeProject: function () {
  89. this.$root.project = null;
  90. this.show('settings');
  91. }
  92. },
  93. watch: {
  94. currentPage: function (newVal) {
  95. if (newVal === 'projects')
  96. this.window.content = 'settings';
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped>
  102. #app {
  103. width: 100%;
  104. height: 100%;
  105. display: flex;
  106. flex-direction: column;
  107. }
  108. .bottom {
  109. display: flex;
  110. flex-grow: 1;
  111. flex-direction: row;
  112. width: 100%;
  113. overflow: hidden;
  114. position: relative;
  115. }
  116. .content {
  117. flex-grow: 1;
  118. }
  119. .content > * {
  120. width: 100%;
  121. height: 100%;
  122. }
  123. /deep/ .headline {
  124. width: 100%;
  125. font-family: "Roboto Condensed", sans-serif;
  126. text-overflow: ellipsis;
  127. white-space: nowrap;
  128. overflow: hidden;
  129. margin: 0 0 1rem;
  130. padding-bottom: 0.5rem;
  131. border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  132. }
  133. </style>