-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
96 lines (83 loc) · 2.76 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
<template>
<TooltipProvider>
<Component is="style">
{{ customCss.value }}
</Component>
<NuxtPwaAssets />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<ConfirmationModal />
<!-- pointer-events-auto fixes https://github.com/unovue/shadcn-vue/issues/462 -->
<Toaster class="pointer-events-auto" />
</TooltipProvider>
</template>
<script setup lang="ts">
import "~/styles/index.css";
import { convert } from "html-to-text";
import ConfirmationModal from "./components/modals/confirm.vue";
import { Toaster } from "./components/ui/sonner";
import { setLanguageTag } from "./paraglide/runtime";
import { type EnumSetting, SettingIds } from "./settings";
// Sin
//import "~/styles/mcdonalds.css";
const lang = useLanguage();
setLanguageTag(lang.value);
const code = useRequestURL().searchParams.get("code");
const appData = useAppData();
const instance = useInstance();
const description = useExtendedDescription(client);
const customCss = useSetting(SettingIds.CustomCSS);
const route = useRoute();
// Theme switcher
const theme = useSetting(SettingIds.Theme) as Ref<EnumSetting>;
const colorMode = useColorMode();
watch(theme.value, () => {
// Add theme-changing class to html to trigger transition
document.documentElement.classList.add("theme-changing");
colorMode.preference = theme.value.value;
setTimeout(() => {
// Remove theme-changing class after transition
document.documentElement.classList.remove("theme-changing");
}, 1000);
});
useSeoMeta({
titleTemplate: (titleChunk) => {
return titleChunk ? `${titleChunk} · Versia` : "Versia";
},
title: computed(() => instance.value?.title ?? ""),
ogImage: computed(() => instance.value?.banner.url),
twitterTitle: computed(() => instance.value?.title ?? ""),
twitterDescription: computed(() =>
convert(description.value?.content ?? ""),
),
twitterImage: computed(() => instance.value?.banner.url),
description: computed(() => convert(description.value?.content ?? "")),
ogDescription: computed(() => convert(description.value?.content ?? "")),
ogSiteName: "Versia",
colorScheme: "dark",
themeColor: "#f9a8d4",
});
useHead({
htmlAttrs: {
lang: "en",
},
});
if (code && appData.value && route.path !== "/oauth/code") {
signInWithCode(code, appData.value);
}
useListen("identity:change", (newIdentity) => {
identity.value = newIdentity;
window.location.pathname = "/";
});
useCacheRefresh(client);
</script>
<style>
body {
font-family: Inter, sans-serif;
}
html.theme-changing * {
/* Stroke and fill aren't animatable */
transition: background-color 1s ease, border 1s ease, color 1s ease, box-shadow 1s ease !important;
}
</style>