App.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <v-app :dark="darkMode">
  3. <!-- Application cache reset button -->
  4. <div class="reset-button">
  5. <ResetAppButton />
  6. </div>
  7. <!--/ Application cache reset button -->
  8. <v-slide-y-transition mode="out-in">
  9. <!-- Host connection configuration -->
  10. <host-config v-if="!isHostConfigured" />
  11. <!--/ Host connection configuration -->
  12. <!-- Loading screen -->
  13. <loader v-else-if="loadingMessage" :message="loadingMessage" />
  14. <!--/ Loading screen -->
  15. <div v-else>
  16. <!-- Sidebar menu -->
  17. <v-navigation-drawer
  18. v-model="drawer"
  19. clipped
  20. fixed
  21. app
  22. >
  23. <v-list dense>
  24. <v-list-tile to="/" exact>
  25. <v-list-tile-action>
  26. <v-icon>home</v-icon>
  27. </v-list-tile-action>
  28. <v-list-tile-content>
  29. <v-list-tile-title>Home</v-list-tile-title>
  30. </v-list-tile-content>
  31. </v-list-tile>
  32. <v-list-tile to="/experiencesList" exact>
  33. <v-list-tile-action>
  34. <v-icon>photo_library</v-icon>
  35. </v-list-tile-action>
  36. <v-list-tile-content>
  37. <v-list-tile-title>Experiences list</v-list-tile-title>
  38. </v-list-tile-content>
  39. </v-list-tile>
  40. </v-list>
  41. </v-navigation-drawer>
  42. <!--/ Sidebar menu -->
  43. <!-- Top bar -->
  44. <v-toolbar app fixed clipped-left>
  45. <v-toolbar-side-icon @click.stop="drawer = !drawer" />
  46. <v-toolbar-title>Web experience</v-toolbar-title>
  47. </v-toolbar>
  48. <!--/ Top bar -->
  49. <!-- Pages content -->
  50. <v-content>
  51. <v-container fluid fill-height>
  52. <v-layout justify-center>
  53. <v-scroll-x-reverse-transition mode="out-in">
  54. <!-- View injected here -->
  55. <router-view />
  56. <!--/ View injected here -->
  57. </v-scroll-x-reverse-transition>
  58. </v-layout>
  59. </v-container>
  60. </v-content>
  61. <!--/ Pages content -->
  62. </div>
  63. </v-slide-y-transition>
  64. </v-app>
  65. </template>
  66. <script>
  67. import ResetAppButton from '@/components/ResetAppButton.vue'
  68. import Loader from '@/components/Loader.vue'
  69. import HostConfig from '@/components/HostConfig.vue'
  70. import { mapGetters, mapActions } from 'vuex'
  71. export default {
  72. components: {
  73. ResetAppButton,
  74. Loader,
  75. HostConfig
  76. },
  77. data() {
  78. return {
  79. darkMode: true,
  80. drawer: false,
  81. hostConfigured: false,
  82. loadingMessage: null
  83. }
  84. },
  85. computed: {
  86. ...mapGetters(['isHostConfigured', 'areScenesLoaded'])
  87. },
  88. watch: {
  89. isHostConfigured(value) {
  90. if (!this.areScenesLoaded && value) this.loadAppData()
  91. }
  92. },
  93. mounted() {
  94. if (this.isHostConfigured && !this.areScenesLoaded) this.loadAppData()
  95. },
  96. methods: {
  97. ...mapActions(['loadScenesList']),
  98. async loadAppData() {
  99. if (this.isHostConfigured && !this.areScenesLoaded) {
  100. this.loadingMessage = 'Loading scenes list...'
  101. try {
  102. await this.loadScenesList()
  103. }
  104. catch (err) {
  105. this.loadingErrorMessage = err.message
  106. return
  107. }
  108. finally {
  109. this.loadingMessage = null
  110. }
  111. }
  112. }
  113. }
  114. }
  115. </script>
  116. <style scoped>
  117. .reset-button {
  118. position: absolute;
  119. right: 0;
  120. bottom: 0;
  121. z-index: 999;
  122. }
  123. </style>