-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.vue
115 lines (98 loc) · 2.86 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
<template>
<div id="app">
<WWTViewSSR ref="wwt" v-show="showWWT" />
<NuxtLayout class="page">
<NuxtPage />
</NuxtLayout>
<CookieControl locale="en">
<template #bar>
<h3>Cookie Consent</h3>
<p>This website uses cookies. Click ‘Accept’ to allow cookies from all
sources, ‘Decline’ to reject all nonessential cookies, or the ‘Learn more …’
button for details. For more information, see our
<NuxtLink to="https://numfocus.org/privacy-policy" target="_blank">Privacy Policy</NuxtLink>.
</p>
</template>
<template #cookie="{ config }">
<span v-for="c in config" :key="c.id" v-text="c.cookies" />
</template>
</CookieControl>
<VueAxePopup v-if="showAxePopup" />
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { VueAxePopup } from 'vue-axe';
import { useConstellationsStore } from "~/stores/constellations";
import { initializeSession } from "~/utils/apis";
const constellationsStore = useConstellationsStore();
const { loggedIn, showWWT } = storeToRefs(constellationsStore);
const { $keycloak, $backendCall } = useNuxtApp();
const showAxePopup = ref(false);
onMounted(() => {
initializeSession($backendCall);
showAxePopup.value = process.env.NODE_ENV !== 'production';
// In most cases we need to initialize the Keycloak state, but it is possible
// that a middleware has already done it.
//
// See the example of silent SSO checking at
// https://www.keycloak.org/docs/latest/securing_apps/index.html#_javascript_adapter
if (!$keycloak.refreshToken) {
$keycloak.init({
onLoad: "check-sso",
silentCheckSsoRedirectUri: makeRedirectUrl(window.location, "/silent-check-sso"),
}).then(() => {
loggedIn.value = $keycloak.authenticated ?? false;
});
}
});
</script>
<style lang="less">
#app {
width: 100vw;
// We need to use 100% for the height, not 100vh, because on mobile the latter
// will include any area dedicated to a browser address bar overlay, so some
// of our UI might get obscured. 100%, on the other hand, gives us the height
// of the view area not including any overlays.
height: 100%;
margin: 0;
overflow: hidden;
position: fixed;
.wwtelescope-component {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-style: none;
border-width: 0;
margin: 0;
padding: 0;
pointer-events: all;
}
}
.page {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
// Don't eat up WWT events by default. Children should re-enable pointer
// events as needed.
pointer-events: none;
}
a {
text-decoration: none;
color: #7fe7c4;
&:hover {
color: #5acea7;
text-decoration: underline;
}
&:visited {
color: #7fe7c4;
}
}
.cookieControl__ModalClose {
display: none;
}
</style>