-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
175 lines (163 loc) · 5.36 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<script setup lang="ts">
useHead({
// Do not index for now
meta: [{ name: "robots", content: "noindex" }],
});
const strings = {
sk: {
title: "Na detailoch záleží",
tagline: "Preskúmajte reliéf Adorácie Ježiša zblízka",
},
en: {
title: "Details matter",
tagline: "Explore the relief of the Adoration of Jesus up close",
},
};
const tourRunning = ref(false);
const showIntro = ref(true);
const showLangSwitch = ref(true);
const lang = ref<"en" | "sk">("sk");
// Show intro after timeout if no marker is selected
const showIntroTimer = useTimer(5000, () => {
showIntro.value = true;
});
onMounted(() => {
//Prevent right-click actions
document.addEventListener("contextmenu", (e) => e.preventDefault());
});
watch(tourRunning, (tourRunning) => {
if (tourRunning) {
showIntro.value = false;
showIntroTimer.cancel();
return;
}
if (!tourRunning) {
showIntroTimer.reset();
showLangSwitch.value = true;
return;
}
});
// Micrio only emits tour-started when the camera has settled
// so we use marker-open as a proxy event
function onMarkerOpen() {
showIntro.value = false;
showLangSwitch.value = false;
}
function onMicrioError() {
window.location.reload();
}
</script>
<template>
<div class="bg-black absolute inset-0 overflow-hidden font-body select-none">
<div class="h-full w-full">
<ClientOnly>
<NuxtErrorBoundary @error="onMicrioError">
<Micrio
id="aYdqm"
:cancel-tour-after-ms="60000"
:lang="lang"
:coordinates="showIntro ? [0.06, 0.5] : undefined"
v-slot="micrio"
@marker-open="onMarkerOpen"
@tour-started="tourRunning = true"
@tour-stop="tourRunning = false"
>
<!-- Controls -->
<div
class="absolute inset-x-0 bottom-0 flex justify-end p-16 pointer-events-none overflow-hidden"
>
<Transition
enter-from-class="opacity-0"
enter-to-class="opacity-100"
enter-active-class="transition-all duration-200 ease-out"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
leave-active-class="transition-all duration-100 ease-in"
>
<div
v-if="tourRunning"
class="p-4 bg-white grid grid-cols-3 rounded-[5rem] gap-4 pointer-events-auto drop-shadow-lg shadow-black/70"
>
<button
class="w-14 h-14 bg-black/5 active:bg-black/10 flex items-center justify-center rounded-full"
@click="micrio.cancelTour"
>
<img src="~/assets/img/x-mark.svg" />
</button>
<button
class="w-14 h-14 bg-black/5 active:bg-black/10 flex items-center justify-center rounded-full"
@click="micrio.previousMarker"
>
<img src="~/assets/img/arrow-left.svg" />
</button>
<button
class="w-14 h-14 bg-black/5 active:bg-black/10 flex items-center justify-center rounded-full"
@click="micrio.nextMarker"
>
<img src="~/assets/img/arrow-left.svg" class="rotate-180" />
</button>
</div>
</Transition>
</div>
</Micrio>
</NuxtErrorBoundary>
</ClientOnly>
</div>
<!-- Intro text -->
<Transition
appear
enter-from-class="opacity-0 translate-y-24"
enter-to-class="opacity-100"
enter-active-class="transition-all duration-[2000ms] delay-1000 ease-out"
leave-from-class="opacity-100"
leave-to-class="opacity-0 translate-y-full"
leave-active-class="transition-all duration-500"
>
<div
v-if="showIntro"
class="absolute bottom-32 left-32 whitespace-nowrap"
>
<Transition
appear
mode="out-in"
enter-from-class="opacity-0"
enter-to-class="opacity-100"
enter-active-class="transition-opacity duration-300 delay-300 ease-out"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
leave-active-class="transition-opacity duration-300"
>
<div :key="lang">
<h1
class="text-white font-bold text-[4.5rem] drop-shadow-lg font-display"
>
{{ strings[lang].title }}
</h1>
<p class="text-white text-2xl drop-shadow-sm">
{{ strings[lang].tagline }}
</p>
</div>
</Transition>
</div>
</Transition>
<!-- Lang switcher -->
<Transition
appear
enter-from-class="opacity-0 translate-y-12"
enter-to-class="opacity-100"
enter-active-class="transition-all duration-300 delay-200 ease-out"
leave-from-class="opacity-100"
leave-to-class="opacity-0 translate-y-12"
leave-active-class="transition-all duration-300"
>
<div v-if="showLangSwitch" class="absolute top-0 right-0">
<button
class="text-white font-display text-3xl uppercase p-12"
@click="lang = lang === 'sk' ? 'en' : 'sk'"
>
{{ lang }}
</button>
</div>
</Transition>
</div>
</template>