Gallery.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="gallery">
  3. <b-button v-b-toggle.gallery-map-side variant="creation" class="btn-side left">
  4. {{ $t('map') }}
  5. </b-button>
  6. <side-view id="gallery-map-side" :visible="mapIsVisible">
  7. <template #default="{ hide, visible }">
  8. <gallery-map
  9. v-if="creations && creation"
  10. :nodes="creations" :node="creation"
  11. :visible="visible"
  12. @open-creation="openCreation($event, hide)"
  13. />
  14. </template>
  15. </side-view>
  16. <gallery-view
  17. v-if="creation"
  18. :node="creation" :key="creation ? creation.id : 0"
  19. @open-creation="openCreation"
  20. @view-origin="openLibrary"
  21. />
  22. <b-button v-b-toggle.gallery-index variant="creation" class="btn-side right">
  23. {{ $t('index') }}
  24. </b-button>
  25. <side-view id="gallery-index" right>
  26. <template #default="{ hide }">
  27. <page-view
  28. v-if="intro"
  29. :page="intro" no-close slug="intro"
  30. class="small"
  31. />
  32. <ul v-if="creations">
  33. <li v-for="crea in creations" :key="crea.id">
  34. <node-view-title
  35. :node="crea"
  36. tag="h4" link no-date
  37. @open-node="openCreation(crea.id, hide)"
  38. />
  39. </li>
  40. </ul>
  41. </template>
  42. </side-view>
  43. <b-modal
  44. v-if="creation && creation.mediaItem"
  45. :id="'modal-creation' + creation.id"
  46. class="modal-creation"
  47. static hide-footer hide-header
  48. >
  49. <template #default="{ hide, visible }">
  50. <button-expand expanded @click="hide()" />
  51. <template v-if="visible">
  52. <embed-video
  53. v-bind="creation.mediaItem"
  54. full
  55. />
  56. </template>
  57. </template>
  58. </b-modal>
  59. <b-overlay
  60. :show="!creations || !creation"
  61. spinner-variant="creation"
  62. no-wrap
  63. />
  64. </div>
  65. </template>
  66. <script>
  67. import { mapGetters } from 'vuex'
  68. import { getRelation } from '@/store/utils'
  69. import { PageView, SideView } from '@/components/layouts'
  70. import { NodeViewTitle } from '@/components/nodes'
  71. import { GalleryView, GalleryMap } from '@/pages/gallery'
  72. export default {
  73. name: 'Gallery',
  74. components: {
  75. PageView,
  76. SideView,
  77. GalleryView,
  78. GalleryMap,
  79. NodeViewTitle
  80. },
  81. props: {
  82. id: { type: [Number, String], default: undefined }
  83. },
  84. data () {
  85. return {
  86. intro: null,
  87. mapIsVisible: false
  88. }
  89. },
  90. computed: {
  91. ...mapGetters(['creations', 'creation'])
  92. },
  93. methods: {
  94. openCreation (id, hideSideView) {
  95. this.$store.dispatch('OPEN_CREATION', { id })
  96. if (hideSideView) hideSideView()
  97. },
  98. openLibrary () {
  99. this.$store.dispatch('OPEN_NODE', getRelation(this.creation))
  100. }
  101. },
  102. watch: {
  103. id (id, prev) {
  104. this.$store.dispatch('DISPLAY_CREATION', parseInt(this.id))
  105. }
  106. },
  107. created () {
  108. if (this.$route.hash === '#map') {
  109. this.mapIsVisible = true
  110. }
  111. this.$store.dispatch('INIT_GALLERY', parseInt(this.id))
  112. this.$store.dispatch('QUERY_PAGE', 'gallery').then(page => {
  113. this.intro = page
  114. })
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .gallery {
  120. position: relative;
  121. width: 100%;
  122. height: 100%;
  123. display: flex;
  124. flex-direction: column;
  125. justify-content: space-between;
  126. @media (orientation: landscape) {
  127. flex-direction: row;
  128. }
  129. .btn-side {
  130. position: absolute;
  131. border-radius: 0 !important;
  132. align-self: center;
  133. min-height: 35px;
  134. min-width: 65px;
  135. text-align: center;
  136. border: $line;
  137. font-weight: $font-weight-bold;
  138. line-height: 0;
  139. @include media-breakpoint-up($size-bp) {
  140. min-height: 50px;
  141. min-width: 80px;
  142. }
  143. &.left {
  144. border-top: 0;
  145. @media (orientation: portrait) {
  146. top: 0;
  147. }
  148. @media (orientation: landscape) {
  149. transform: rotate(-90deg) translate(0, -15px);
  150. margin-right: -30px;
  151. }
  152. }
  153. &.right {
  154. @media (orientation: portrait) {
  155. bottom: 0;
  156. border-bottom: 0;
  157. }
  158. @media (orientation: landscape) {
  159. border-top: 0;
  160. transform: rotate(90deg) translate(0, -15px);
  161. margin-left: -30px;
  162. right: 0;
  163. }
  164. }
  165. }
  166. }
  167. ::v-deep #gallery-map-side {
  168. width: 100%;
  169. .btn-close {
  170. float: unset;
  171. }
  172. }
  173. #gallery-index {
  174. ul {
  175. padding: 0;
  176. list-style: none;
  177. font-family: $font-family-text;
  178. }
  179. }
  180. .modal-creation {
  181. z-index: 1100 !important;
  182. width: 100%;
  183. height: 100%;
  184. pointer-events: none;
  185. ::v-deep .modal {
  186. position: absolute;
  187. background-color: transparent;
  188. width: 100%;
  189. max-height: 100%;
  190. overflow: hidden;
  191. &-dialog {
  192. max-width: 100%;
  193. height: 100%;
  194. margin: 0;
  195. }
  196. &-content {
  197. height: 100%;
  198. border: 0;
  199. }
  200. &-body {
  201. padding: 0;
  202. display: flex;
  203. }
  204. &-backdrop {
  205. display: none;
  206. }
  207. iframe {
  208. border: 0;
  209. }
  210. .btn-expand {
  211. position: absolute;
  212. top: 0;
  213. right: 0;
  214. }
  215. audio {
  216. width: 80%;
  217. margin: auto;
  218. }
  219. video {
  220. width: 100%;
  221. height: 100%;
  222. }
  223. }
  224. }
  225. </style>