project-main-window.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="project-main-window">
  3. <div class="top-navigation">
  4. <img class="burger"
  5. src="@/assets/icons/three-bars.svg"
  6. alt="Menü"
  7. v-if="!wide"
  8. :class="{ rotation: menu }"
  9. @click="invertMenu">
  10. <div class="name">
  11. {{ project.name }}
  12. </div>
  13. </div>
  14. <div class="bottom">
  15. <div class="side-navigation"
  16. :class="{ wide: wide, narrow: !wide, active: menu }">
  17. <div class="item"
  18. :class="{active: activeContent === 'settings'}"
  19. @click="activeContent = 'settings'">
  20. Project Settings
  21. </div>
  22. <div class="item" @click="socket.set(projectPath, 'save')">
  23. Close
  24. </div>
  25. </div>
  26. <div class="content">
  27. <project-main-window-settings v-if="activeContent === 'settings'"
  28. :status="status" :socket="socket"/>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import ProjectMainWindowSettings from "@/components/projects/project-main-window-settings";
  35. export default {
  36. name: "project-main-window",
  37. components: {ProjectMainWindowSettings},
  38. props: ['status', 'socket'],
  39. data: function() {
  40. return {
  41. wide: true,
  42. menu: false,
  43. activeContent: 'settings'
  44. }
  45. },
  46. computed: {
  47. project: function() {
  48. return this.status.projects.filter(x => (x.status === 'open'))[0];
  49. },
  50. projectPath: function() {
  51. for (let i = 0; i < this.status.projects.length; i++)
  52. if (this.status.projects[i].status === 'open')
  53. return 'projects/' + i + '/status';
  54. return null;
  55. }
  56. },
  57. methods: {
  58. resize: function() {
  59. this.wide = (document.body.offsetWidth > 1024);
  60. },
  61. invertMenu: function() {
  62. this.menu = !this.menu;
  63. }
  64. },
  65. created: function() {
  66. window.addEventListener('resize', this.resize);
  67. this.resize();
  68. },
  69. destroyed: function() {
  70. window.removeEventListener('resize', this.resize);
  71. }
  72. }
  73. </script>
  74. <style scoped>
  75. .project-main-window {
  76. width: 100%;
  77. height: 100%;
  78. display: flex;
  79. flex-direction: column;
  80. }
  81. .top-navigation {
  82. background-color: #3f3f3f;
  83. color: whitesmoke;
  84. display: flex;
  85. padding: 1rem;
  86. flex-direction: row;
  87. align-items: center;
  88. }
  89. .top-navigation .burger {
  90. transition: transform 0.5s;
  91. filter: invert(1);
  92. width: 2rem;
  93. margin-right: 0.75rem;
  94. }
  95. .top-navigation .burger.rotation {
  96. transform: rotate(90deg);
  97. }
  98. .top-navigation .name {
  99. font-weight: bold;
  100. font-family: "Roboto Condensed";
  101. }
  102. .bottom {
  103. display: flex;
  104. flex-grow: 1;
  105. flex-direction: row;
  106. position: relative;
  107. }
  108. .side-navigation {
  109. background-color: #2f2f2f;
  110. color: whitesmoke;
  111. }
  112. .side-navigation.wide {
  113. flex-grow: 0;
  114. height: 100%;
  115. }
  116. .side-navigation.narrow {
  117. width: 85vw;
  118. left: -85vw;
  119. position: absolute;
  120. top: 0;
  121. bottom: 0;
  122. transition: 0.3s ease-out;
  123. }
  124. .side-navigation.narrow.active {
  125. left: 0;
  126. }
  127. .side-navigation .item {
  128. padding: 1rem 3rem 1rem 1rem;
  129. cursor: pointer;
  130. }
  131. .side-navigation .item:hover {
  132. background-color: #292929;
  133. }
  134. .side-navigation .item.active {
  135. background-color: #1f1f1f;
  136. }
  137. .side-navigation .item:not(:last-child) {
  138. border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  139. }
  140. .content {
  141. flex-grow: 1;
  142. }
  143. </style>