_id.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <LayoutContainer>
  3. <header class="mb-4">
  4. <v-layout>
  5. <v-btn
  6. :to="{path: '/events', query: query}"
  7. nuxt
  8. plain
  9. >
  10. <font-awesome-icon class="icon mr-1" :icon="['fas', 'chevron-left']" />
  11. {{ $t('go_back') }}
  12. </v-btn>
  13. </v-layout>
  14. </header>
  15. <v-container class="content">
  16. <v-row>
  17. <v-col cols="12" sm="6" class="pr-6">
  18. <v-img
  19. :src="publicEvent.imageUrl || '/images/event-default.jpg'"
  20. alt="banner"
  21. max-width="100%"
  22. max-height="100%"
  23. lazy-src="/images/event-default.jpg"
  24. />
  25. </v-col>
  26. <v-col cols="12" sm="6" class="pl-6">
  27. <div class="d-flex flex-column" style="min-height: 100%">
  28. <v-row class="py-2">
  29. <h2>{{ publicEvent.name }}</h2>
  30. </v-row>
  31. <v-row class="py-2">
  32. <table class="infos">
  33. <tr v-if="publicEvent.datetimeStart" class="pa-1">
  34. <td class="pt-1">
  35. <font-awesome-icon :icon="['fas', 'calendar']" class="icon mr-2" />
  36. </td>
  37. <td class="pa-1">
  38. <span>
  39. {{ dateUtils.formatDateIntervalFor(new Date(publicEvent.datetimeStart), new Date(publicEvent.datetimeEnd)) }}
  40. </span>
  41. </td>
  42. </tr>
  43. <tr v-if="publicEvent.address.addressCity">
  44. <td class="pt-1">
  45. <font-awesome-icon class="icon" :icon="['fas', 'map-marker-alt']" />
  46. </td>
  47. <td class="pa-1">
  48. <span v-if="publicEvent.roomName" style="white-space: pre-line;">{{ publicEvent.roomName }}<br></span>
  49. <span v-if="publicEvent.address.streetAddress" style="white-space: pre-line;">{{ publicEvent.address.streetAddress }}<br></span>
  50. <span>{{ publicEvent.address.addressCity }}</span>
  51. </td>
  52. </tr>
  53. </table>
  54. </v-row>
  55. <v-row v-if="publicEvent.description" class="py-2 flex d-flex flex-column">
  56. <h4 class="mt-2 mb-3" style="height: fit-content;">
  57. {{ $t('description') }}
  58. </h4>
  59. <p class="flex">
  60. {{ publicEvent.description }}
  61. </p>
  62. </v-row>
  63. <div class="flex"></div>
  64. <v-row v-if="publicEvent.url" justify="end" align-content="end" class="py-2">
  65. <v-btn :href="publicEvent.url" target="_blank">{{ $t("more_to_know") }}</v-btn>
  66. </v-row>
  67. </div>
  68. </v-col>
  69. </v-row>
  70. <v-row>
  71. <v-col
  72. cols="12"
  73. v-if="publicEvent.address.latitude && publicEvent.address.longitude"
  74. >
  75. <v-responsive width="100%" height="300px">
  76. <no-ssr>
  77. <l-map
  78. id="map"
  79. :zoom="16"
  80. :center="[publicEvent.address.latitude, publicEvent.address.longitude]"
  81. :options="{ scrollWheelZoom: false, zoomSnap: 0.25 }"
  82. >
  83. <l-tile-layer
  84. url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
  85. attribution="&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors"
  86. />
  87. <l-marker
  88. :key="publicEvent.uuid"
  89. :lat-lng="[publicEvent.address.latitude, publicEvent.address.longitude]"
  90. >
  91. <l-popup>
  92. <b>{{ publicEvent.name }}</b><br>
  93. <span>
  94. {{ publicEvent.address.postalCode }} {{ publicEvent.address.addressCity }}
  95. </span><br>
  96. </l-popup>
  97. </l-marker>
  98. </l-map>
  99. </no-ssr>
  100. </v-responsive>
  101. </v-col>
  102. </v-row>
  103. <v-row>
  104. <v-spacer />
  105. <v-col cols="12" md="6" class="d-flex flex-column align-end">
  106. <table>
  107. <tr>
  108. <td>
  109. <h5 class="ma-2">
  110. {{ $t('share') }}
  111. </h5>
  112. </td>
  113. </tr>
  114. <tr>
  115. <td>
  116. <div class="d-flex flex-row align-items-start flex-wrap">
  117. <ShareNetwork
  118. v-for="socialNetwork in socialNetworks"
  119. :key="socialNetwork.network"
  120. :network="socialNetwork.network"
  121. :url="localUrl"
  122. :title="publicEvent.name"
  123. :description="publicEvent.description"
  124. hashtags="opentalent,event"
  125. :media="publicEvent.imageUrl || '/images/event-default.jpg'"
  126. class="social-link"
  127. >
  128. <a
  129. :title="$t('share_on') + ' ' + socialNetwork.name"
  130. :style="{color: socialNetwork.color}"
  131. >
  132. <font-awesome-icon
  133. class="icon social-icon"
  134. :icon="socialNetwork.icon"
  135. />
  136. </a>
  137. </ShareNetwork>
  138. </div>
  139. </td>
  140. </tr>
  141. </table>
  142. </v-col>
  143. </v-row>
  144. </v-container>
  145. </LayoutContainer>
  146. </template>
  147. <script lang="ts">
  148. import Vue from 'vue'
  149. import EventsProvider from '~/services/data/EventsProvider'
  150. import DatesUtils from "~/services/utils/dateUtils";
  151. export default Vue.extend({
  152. data () {
  153. return {
  154. theme: this.$route.query.theme ?? 'orange',
  155. organization: this.$route.query.organization ?? null,
  156. publicEvent: null as PublicEvent | null,
  157. dateUtils: new DatesUtils(this.$dateFns, this.$t, this.$i18n),
  158. localUrl: location.href,
  159. socialNetworks: [
  160. { network: 'facebook', name: 'Facebook', icon: ['fab', 'facebook-f'], color: '#1877f2' },
  161. { network: 'messenger', name: 'Messenger', icon: ['fab', 'facebook-messenger'], color: '#0084ff' },
  162. { network: 'twitter', name: 'Twitter', icon: ['fab', 'twitter'], color: '#1da1f2' },
  163. { network: 'reddit', name: 'Reddit', icon: ['fab', 'reddit-alien'], color: '#ff4500' },
  164. { network: 'telegram', name: 'Telegram', icon: ['fab', 'telegram-plane'], color: '#0088cc' },
  165. { network: 'whatsapp', name: 'Whatsapp', icon: ['fab', 'whatsapp'], color: '#25d366' },
  166. { network: 'email', name: 'Email', icon: ['fa', 'envelope'], color: '#333333' },
  167. ] // @see https://nicolasbeauvais.github.io/vue-social-sharing/?path=/story/vuesocialsharing--multiple-share-networks
  168. }
  169. },
  170. computed: {
  171. query () {
  172. const q: any = { theme: this.theme }
  173. if (this.organization !== null) {
  174. q.organization = this.organization
  175. }
  176. return q
  177. }
  178. },
  179. async asyncData ({params, $axios}): Promise<{ publicEvent: PublicEvent }> {
  180. return await new EventsProvider($axios).getById(params.id).then((res) => {
  181. return { publicEvent: res }
  182. })
  183. }
  184. })
  185. </script>
  186. <style scoped lang="scss">
  187. @import 'assets/style/variables.scss';
  188. .content {
  189. margin: 18px 10%;
  190. max-width: 80%;
  191. }
  192. h2 {
  193. color: var(--v-primary-base);
  194. font-size: 22px;
  195. text-transform: uppercase;
  196. }
  197. h4 {
  198. color: #666;
  199. border-bottom: solid 1px var(--v-primary-base);
  200. font-size: 22px;
  201. }
  202. .content {
  203. color: #4d4d4d;
  204. }
  205. .infos {
  206. text-transform: uppercase;
  207. font-weight: 700;
  208. }
  209. @media screen and (min-width: 600px) {
  210. .description {
  211. border-right: solid 2px var(--v-primary-base);
  212. width: 45%;
  213. padding-right: 5%;
  214. }
  215. .contact {
  216. width: 45%;
  217. padding-left: 5%;
  218. }
  219. }
  220. @media screen and (max-width: 600px) {
  221. .content {
  222. max-width: 100%;
  223. margin: 10px 0;
  224. }
  225. }
  226. .contact td {
  227. padding: 6px 12px;
  228. }
  229. .contact .icon {
  230. color: var(--v-primary-base);
  231. }
  232. .social-link {
  233. display: flex;
  234. flex-direction: row;
  235. justify-content: center;
  236. padding: 6px;
  237. text-decoration: none;
  238. position:relative;
  239. }
  240. .social-link:hover {
  241. text-decoration: underline;
  242. }
  243. .social-icon {
  244. font-size: 22px;
  245. margin: auto 6px;
  246. }
  247. .social-link:before {
  248. display:block;
  249. content:" ";
  250. position:absolute;
  251. z-index:100;
  252. background:rgba(255, 255, 255, 0.3);
  253. top:0;
  254. left:0;
  255. right:0;
  256. bottom:0;
  257. opacity:0;
  258. }
  259. .social-link:hover:before {
  260. opacity:1;
  261. }
  262. </style>