forked from BeamMW/beam-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.vue
256 lines (228 loc) · 6.28 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<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 router = useRouter();
const XUsername = extractXUsername(ExternalLinks.X) as string;
defineRobotMeta();
const scrollToIdOnPage = async (
pageName: string,
componentId: string,
eventToWait: UserInteractionEvents,
) => {
const targetComponent = document.getElementById(componentId);
if (!targetComponent) {
const pageLoadedAndMounted = () => {
eventBus.off(eventToWait, pageLoadedAndMounted);
setTimeout(() => {
const targetComponent = document.getElementById(componentId);
scrollToComponent(targetComponent);
}, 1);
};
eventBus.on(eventToWait, pageLoadedAndMounted);
await router.push(localePath(pageName));
} else {
scrollToComponent(targetComponent);
}
};
// Scroll to "Where to buy" called but unable to scroll, redirect to homepage
const whereToBuyScroll = async () =>
await scrollToIdOnPage(
"/",
"targetComponentBuy",
UserInteractionEvents.BUY_WHERE_COMPONENT_READY,
);
const roadmapScroll = async () =>
await scrollToIdOnPage(
"/",
"targetComponentRoadmap",
UserInteractionEvents.ROADMAP_COMPONENT_READY,
);
onMounted(() => {
eventBus.on(UserInteractionEvents.SCROLL_TO_WHERE_TO_BUY, whereToBuyScroll);
eventBus.on(UserInteractionEvents.SCROLL_TO_ROADMAP, roadmapScroll);
});
onUnmounted(() => {
eventBus.off(UserInteractionEvents.SCROLL_TO_WHERE_TO_BUY, whereToBuyScroll);
eventBus.off(UserInteractionEvents.SCROLL_TO_ROADMAP, roadmapScroll);
});
</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"
/>
<Meta
content="width=device-width, initial-scale=1, maximum-scale=5"
name="viewport"
/>
<Meta name="twitter:site" :content="XUsername" />
<Meta name="twitter:creator" :content="XUsername" />
<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,
)}`"
/>
</Head>
<NuxtLayout>
<NuxtLoadingIndicator
color="repeating-linear-gradient(to right,var(--beam-green-dark) 0%,var(--beam-pink) 100%)"
class="will-change-auto"
/>
<LanguageHandler>
<div>
<NuxtPage :transition="false" />
</div>
</LanguageHandler>
</NuxtLayout>
</main>
</template>
<style>
@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: #99ecff;
--beam-blue-dark: #0b76ff;
--beam-purple: #9d6eff;
--beam-purple-dark: #ab37e6;
--beam-pink: #a69eff;
--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];
}
}
.custom-swipe-arrow {
@apply absolute z-10 cursor-pointer md:from-[#041D3C] h-full w-7 md:w-10 flex items-center transition-opacity;
&.swiper-button-disabled {
@apply opacity-0 pointer-events-none;
}
&.next-button {
@apply right-0 md:bg-gradient-to-l justify-end transition-opacity;
}
&.prev-button {
@apply left-0 md:bg-gradient-to-r justify-start transition-opacity;
}
}
.background-radial-defaults {
@apply bg-[length:1024px_576px] md:bg-[length:1280px_720px] lg:bg-[length:1600px_900px] xl:bg-[length:1920px_1080px] bg-[center_top] bg-no-repeat;
}
@keyframes moveGradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.specialGradient {
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
animation: moveGradient 5s linear infinite;
&.specialGradientPurple {
background-image: radial-gradient(
78.77% 78.77% at 71.71% 30.77%,
#f7f2ff 0%,
#d8bfff 67.21%,
#c8afff 76.04%,
#a789ff 84.9%,
#8b5dff 94.79%
);
}
&.specialGradientGreen {
background-image: radial-gradient(
78.77% 78.77% at 71.71% 30.77%,
#ffffff 0%,
#b9ffc9 67.21%,
#94e8b1 76.04%,
#5ae69d 84.9%,
#2cb277 94.79%
);
}
&.specialGradientBlue {
background-image: radial-gradient(
78.77% 78.77% at 71.71% 30.77%,
#f0fcff 0%,
#9bedff 67.21%,
#98ecff 76.04%,
#5be1ff 84.9%,
#00bae2 94.79%
);
}
}
</style>
<style scoped>
main {
@apply transition-transform duration-[225ms] origin-[50%_300px];
&.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-40 scale-90;
}
}
</style>