1+ <template >
2+ <v-container class =" py-0" >
3+ <v-app-bar app flat dense fixed color =" background" >
4+ <v-icon class =" mr-2" v-on:click =" goBack()" >mdi-arrow-left</v-icon >
5+ <v-img :src =" item.iconUrl" max-height =" 48" max-width =" 48" class =" mr-2" ></v-img >
6+ <v-toolbar-title >{{item ? item.name : 'Hazard Information'}}</v-toolbar-title >
7+ </v-app-bar >
8+ <v-row dense >
9+ <v-col cols =" 12" >
10+ <p class =" pa-2 headline" >{{item.description}}</p >
11+ </v-col >
12+ <v-col cols =" 12" >
13+ <v-img v-if =" mediaUrlIsImage" :src =" item.mediaUrl" ></v-img >
14+ <!-- TODO: Add option for videos once we have some sample videos -->
15+ </v-col >
16+ <v-col cols =" 12" class =" text-center" >
17+ <h2 >{{item.name}} Safety</h2 >
18+ </v-col >
19+ <v-col cols =" 12" class =" text-center" >
20+ <v-btn x-large color =" primary" width =" 80%" @click =" beforeDialog = true" >Before</v-btn >
21+ </v-col >
22+ <v-col cols =" 12" class =" text-center" >
23+ <v-btn x-large color =" primary" width =" 80%" @click =" duringDialog = true" >During</v-btn >
24+ </v-col >
25+ <v-col cols =" 12" class =" text-center" >
26+ <v-btn x-large color =" primary" width =" 80%" @click =" afterDialog = true" >After</v-btn >
27+ </v-col >
28+ <v-col cols =" 12" class =" text-center" >
29+ <h2 >{{item.name}} Resources</h2 >
30+ </v-col >
31+ <v-col cols =" 12" >
32+ <ul class =" mb-6" >
33+ <li v-for =" link in item.externalLinks" :key ={link} class =" pa-1" >
34+ <a :href =" link" target =" _blank" >{{link}}</a ><v-icon small class =" ml-2" >mdi-open-in-new</v-icon ></li >
35+ </ul >
36+ </v-col >
37+ </v-row >
38+ <v-dialog
39+ v-model =" beforeDialog"
40+ fullscreen
41+ hide-overlay
42+ transition =" dialog-bottom-transition"
43+ scrollable
44+ >
45+ <v-card tile color =" background" >
46+ <v-toolbar class =" flex-grow-0 mb-3"
47+ flat
48+ dark
49+ color =" primary"
50+ >
51+ <v-btn
52+ icon
53+ dark
54+ @click =" beforeDialog = false"
55+ >
56+ <v-icon >mdi-close</v-icon >
57+ </v-btn >
58+ <v-toolbar-title >{{item.name}} Safety: Before</v-toolbar-title >
59+ </v-toolbar >
60+ <v-card-text v-html =" item.beforeSafetyDetails" >
61+ </v-card-text >
62+ </v-card >
63+ </v-dialog >
64+ <v-dialog
65+ v-model =" duringDialog"
66+ fullscreen
67+ hide-overlay
68+ transition =" dialog-bottom-transition"
69+ scrollable
70+ >
71+ <v-card tile color =" background" >
72+ <v-toolbar class =" flex-grow-0 mb-3"
73+ flat
74+ dark
75+ color =" primary"
76+ >
77+ <v-btn
78+ icon
79+ dark
80+ @click =" duringDialog = false"
81+ >
82+ <v-icon >mdi-close</v-icon >
83+ </v-btn >
84+ <v-toolbar-title >{{item.name}} Safety: During</v-toolbar-title >
85+ </v-toolbar >
86+ <v-card-text v-html =" item.duringSafetyDetails" >
87+ </v-card-text >
88+ </v-card >
89+ </v-dialog >
90+ <v-dialog
91+ v-model =" afterDialog"
92+ fullscreen
93+ hide-overlay
94+ transition =" dialog-bottom-transition"
95+ scrollable
96+ >
97+ <v-card tile color =" background" >
98+ <v-toolbar class =" flex-grow-0 mb-3"
99+ flat
100+ dark
101+ color =" primary"
102+ >
103+ <v-btn
104+ icon
105+ dark
106+ @click =" afterDialog = false"
107+ >
108+ <v-icon >mdi-close</v-icon >
109+ </v-btn >
110+ <v-toolbar-title >{{item.name}} Safety: After</v-toolbar-title >
111+ </v-toolbar >
112+ <v-card-text v-html =" item.afterSafetyDetails" >
113+ </v-card-text >
114+ </v-card >
115+ </v-dialog >
116+ </v-container >
117+ </template >
118+
119+ <script >
120+ import { mapState } from ' vuex' ;
121+
122+ export default {
123+ data : () => {
124+ return {
125+ beforeDialog: false ,
126+ duringDialog: false ,
127+ afterDialog: false
128+ };
129+ },
130+ computed: {
131+ ... mapState ({
132+ item : (state ) => state .hazardHuntStore .item ,
133+ }),
134+ mediaUrlIsImage : function () {
135+ const mediaUrl = this .item ? .mediaUrl ? .toLowerCase ();
136+ if (! mediaUrl) return false ;
137+
138+ return mediaUrl .endsWith (" .png" ) ||
139+ mediaUrl .endsWith (" .jpg" ) ||
140+ mediaUrl .endsWith (" .jpeg" ) ||
141+ mediaUrl .endsWith (" .webp" ) ||
142+ mediaUrl .endsWith (" .pjpeg" ) ||
143+ mediaUrl .endsWith (" .svg" ) ||
144+ mediaUrl .endsWith (" .pjp" );
145+ }
146+ },
147+ mounted: function () {
148+ // Load the thing
149+ this .$store .dispatch (
150+ ` hazardHuntStore/getHazardHuntAsync` ,
151+ this .$route .params .id
152+ );
153+ },
154+ methods: {
155+ goBack () {
156+ window .history .length > 1 ? this .$router .go (- 1 ) : this .$router .push (' /' );
157+ }
158+ }
159+ }
160+ < / script>
161+
162+ < style>
163+
164+ < / style>
0 commit comments