forked from BeamMW/beam-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
236 lines (218 loc) · 6.09 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<script lang="ts" setup>
import { linkElements } from "@/utils/linkElements";
import { UserInteractionEvents, eventBus } from "~/utils/emitter";
import { scrollToComponent } from "~/utils/scrollToComponent";
import { SupportedPlatforms, ExternalLinks } from "@/app.config";
const platformDetails = await usePlatformDetails();
const localePath = useLocalePath();
const windowLocked = useState("windowLocked", () => false);
const windowBlurred = useState("windowBlurred", () => false);
const currentRoute = useState("currentRoute", () => "");
const fileVersion = 3;
const baseURL = useRuntimeConfig().public.baseURL;
const route = useRoute();
const router = useRouter();
watch(
() => route.fullPath,
(_routeFullPath) => {
currentRoute.value = getRouteName(route.name);
},
{ immediate: true },
);
defineRobotMeta();
// Scroll to "Where to buy" called but unable to scroll, redirect to homepage
const whereToBuyScroll = async () => {
const targetComponentBuy = document.getElementById("targetComponentBuy");
if (!targetComponentBuy) {
await router.push(localePath("index"));
// ToDo: find a more reliable way than a settimeout
setTimeout(() => {
const homepageBuyComponent =
document.getElementById("targetComponentBuy");
scrollToComponent(homepageBuyComponent);
}, 600);
} else {
scrollToComponent(targetComponentBuy);
}
};
onMounted(() =>
eventBus.on(UserInteractionEvents.SCROLL_TO_WHERE_TO_BUY, whereToBuyScroll),
);
onUnmounted(() =>
eventBus.off(UserInteractionEvents.SCROLL_TO_WHERE_TO_BUY, whereToBuyScroll),
);
</script>
<template>
<main
:class="{
locked: windowLocked,
blurred: windowBlurred,
}"
>
<Head>
<Link
v-for="linkElement in linkElements"
:key="linkElement.href"
:rel="linkElement.rel"
:href="linkElement.href"
:as="linkElement.as"
:type="linkElement.type"
:crossorigin="linkElement.crossorigin ? 'anonymous' : undefined"
/>
<Link
rel="apple-touch-icon"
sizes="180x180"
:href="`/apple-touch-icon.png?v=${fileVersion}`"
/>
<Link
rel="icon"
type="image/png"
sizes="32x32"
:href="`/favicon-32x32.png?v=${fileVersion}`"
/>
<Link
rel="icon"
type="image/png"
sizes="16x16"
:href="`/favicon-16x16.png?v=${fileVersion}`"
/>
<Link rel="manifest" :href="`/site.webmanifest?v=${fileVersion}`" />
<Link rel="mask-icon" :href="`/safari-pinned-tab.svg?v=${fileVersion}`" />
<Link rel="shortcut icon" :href="`/favicon.ico?v=${fileVersion}`" />
<Meta
content="width=device-width, initial-scale=1, maximum-scale=5"
name="viewport"
/>
<Meta
name="twitter:site"
:content="extractTwitterUsername(ExternalLinks.TWITTER) as string"
/>
<Meta
v-if="
platformDetails[SupportedPlatforms.IOS] &&
platformDetails[SupportedPlatforms.IOS].links &&
platformDetails[SupportedPlatforms.IOS].links.store
"
name="apple-itunes-app"
:content="`app-id=${extractAppStoreAppId(
platformDetails[SupportedPlatforms.IOS].links.store as string,
)}`"
/>
<Meta
name="twitter:image:src"
:content="`${baseURL}/card.png?v=${fileVersion}`"
/>
<Meta name="twitter:card" content="summary_large_image" />
<Meta property="og:type" content="object" />
<Meta
property="og:image"
:content="`${baseURL}/card.png?v=${fileVersion}`"
/>
<Meta property="og:image:type" content="image/png" />
<Meta property="og:image:width" content="1200" />
<Meta property="og:image:height" content="630" />
<Meta property="og:url" :content="baseURL" />
</Head>
<NuxtLayout>
<NuxtLoadingIndicator
color="repeating-linear-gradient(to right,var(--beam-green-dark) 0%,var(--beam-pink) 100%)"
class="will-change-auto"
/>
<LanguageHandler>
<template
#default="{ /*onBeforeEnter, */ onAfterEnter, languageChanged }"
>
<NuxtPage
:transition="{
name:
languageChanged || currentRoute == 'docs-slug' ? '' : 'page',
mode: 'out-in',
//onBeforeEnter,
onAfterEnter,
}"
/>
</template>
</LanguageHandler>
</NuxtLayout>
</main>
</template>
<style>
.page-enter-active,
.page-leave-active {
transition: all 0.2s;
}
.page-leave-to,
.page-enter-from {
opacity: 0;
}
.page-leave-to {
@apply origin-center scale-[1.02];
}
.page-enter-from {
@apply origin-center scale-[.98];
}
@font-face {
font-family: "ProximaNova";
src:
url("/fonts/ProximaNova-Regular.woff2") format("woff2"),
url("/fonts/ProximaNova-Regular.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "ProximaNova-Italic";
src:
url("/fonts/ProximaNova-RegularIt.woff2") format("woff2"),
url("/fonts/ProximaNova-RegularIt.woff") format("woff");
font-weight: normal;
font-style: italic;
font-display: swap;
}
@font-face {
font-family: "ProximaNova-Bold";
src:
url("/fonts/ProximaNova-Bold.woff2") format("woff2"),
url("/fonts/ProximaNova-Bold.woff") format("woff");
font-weight: bold;
font-style: normal;
font-display: swap;
}
:root {
--beam-blue: #25c1ff;
--beam-blue-dark: #0b76ff;
--beam-purple: #9d6eff;
--beam-purple-dark: #ab37e6;
--beam-pink: #fe52ff;
--beam-green: #39fff2;
--beam-green-dark: #00e2c2;
@apply min-h-screen
min-w-full
overflow-x-hidden
font-medium
not-italic
text-[#fff]
antialiased;
::selection {
@apply bg-[#39FFF2] text-[#042548];
}
}
</style>
<style scoped>
main {
transition:
opacity 225ms ease-in-out,
filter 225ms ease-in-out;
&.locked,
&.blurred {
@apply pointer-events-none select-none;
}
&.locked {
@apply overflow-hidden h-screen touch-none overscroll-none;
-webkit-overflow-scrolling: none;
}
&.blurred {
@apply blur-sm opacity-50;
}
}
</style>