2024-04-15 03:16:57 +02:00
|
|
|
<template>
|
2024-12-02 12:33:53 +01:00
|
|
|
<TooltipProvider>
|
2024-12-04 12:53:43 +01:00
|
|
|
<Component is="style">
|
2025-04-30 18:03:14 +02:00
|
|
|
{{ preferences.custom_css }}
|
2024-12-04 12:53:43 +01:00
|
|
|
</Component>
|
2024-12-02 12:33:53 +01:00
|
|
|
<NuxtPwaAssets />
|
2024-12-04 12:53:43 +01:00
|
|
|
<NuxtLayout>
|
|
|
|
|
<NuxtPage />
|
|
|
|
|
</NuxtLayout>
|
|
|
|
|
<ConfirmationModal />
|
|
|
|
|
<!-- pointer-events-auto fixes https://github.com/unovue/shadcn-vue/issues/462 -->
|
|
|
|
|
<Toaster class="pointer-events-auto" />
|
2024-12-02 12:33:53 +01:00
|
|
|
</TooltipProvider>
|
2024-04-15 03:16:57 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-05-12 08:13:35 +02:00
|
|
|
import { convert } from "html-to-text";
|
2025-07-16 07:48:39 +02:00
|
|
|
import { overwriteGetLocale } from "../paraglide/runtime";
|
2024-12-01 17:20:21 +01:00
|
|
|
import ConfirmationModal from "./components/modals/confirm.vue";
|
2024-11-30 18:21:40 +01:00
|
|
|
import { Toaster } from "./components/ui/sonner";
|
2025-03-28 01:16:24 +01:00
|
|
|
import { TooltipProvider } from "./components/ui/tooltip";
|
2025-06-26 22:39:02 +02:00
|
|
|
|
2024-12-04 15:43:31 +01:00
|
|
|
// Sin
|
|
|
|
|
//import "~/styles/mcdonalds.css";
|
2024-04-27 06:50:30 +02:00
|
|
|
|
2024-12-07 22:17:22 +01:00
|
|
|
const lang = useLanguage();
|
2025-03-27 22:20:04 +01:00
|
|
|
overwriteGetLocale(() => lang.value);
|
2024-12-07 22:17:22 +01:00
|
|
|
|
2024-04-27 06:50:30 +02:00
|
|
|
const code = useRequestURL().searchParams.get("code");
|
2025-01-29 04:39:33 +01:00
|
|
|
const origin = useRequestURL().searchParams.get("origin");
|
2024-04-28 09:54:13 +02:00
|
|
|
const appData = useAppData();
|
2024-05-17 08:25:59 +02:00
|
|
|
const instance = useInstance();
|
2024-05-12 08:13:35 +02:00
|
|
|
const description = useExtendedDescription(client);
|
2024-12-02 23:32:13 +01:00
|
|
|
const route = useRoute();
|
2024-04-27 06:50:30 +02:00
|
|
|
|
2024-12-07 13:46:19 +01:00
|
|
|
// Theme switcher
|
|
|
|
|
const colorMode = useColorMode();
|
2025-04-30 18:03:14 +02:00
|
|
|
const radius = useCssVar("--radius");
|
2024-12-07 13:46:19 +01:00
|
|
|
|
2025-04-30 18:03:14 +02:00
|
|
|
watch(preferences.color_theme, (newVal) => {
|
2024-12-25 17:39:07 +01:00
|
|
|
// Add theme-changing class to html to trigger transition
|
|
|
|
|
document.documentElement.classList.add("theme-changing");
|
2025-04-30 18:03:14 +02:00
|
|
|
colorMode.preference = newVal;
|
2024-12-25 17:39:07 +01:00
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// Remove theme-changing class after transition
|
|
|
|
|
document.documentElement.classList.remove("theme-changing");
|
|
|
|
|
}, 1000);
|
2024-12-07 13:46:19 +01:00
|
|
|
});
|
|
|
|
|
|
2025-04-30 18:03:14 +02:00
|
|
|
watch(
|
|
|
|
|
preferences.border_radius,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
radius.value = `${newVal}rem`;
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
immediate: true,
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2024-05-12 08:13:35 +02:00
|
|
|
useSeoMeta({
|
|
|
|
|
titleTemplate: (titleChunk) => {
|
2024-08-28 00:23:29 +02:00
|
|
|
return titleChunk ? `${titleChunk} · Versia` : "Versia";
|
2024-05-12 08:13:35 +02:00
|
|
|
},
|
|
|
|
|
title: computed(() => instance.value?.title ?? ""),
|
2025-01-29 02:36:58 +01:00
|
|
|
ogImage: computed(() => instance.value?.banner?.url),
|
2024-05-12 08:13:35 +02:00
|
|
|
twitterTitle: computed(() => instance.value?.title ?? ""),
|
|
|
|
|
twitterDescription: computed(() =>
|
2025-03-28 01:16:24 +01:00
|
|
|
convert(description.value?.content ?? ""),
|
2024-05-12 08:13:35 +02:00
|
|
|
),
|
2025-01-29 02:36:58 +01:00
|
|
|
twitterImage: computed(() => instance.value?.banner?.url),
|
2024-05-12 08:13:35 +02:00
|
|
|
description: computed(() => convert(description.value?.content ?? "")),
|
|
|
|
|
ogDescription: computed(() => convert(description.value?.content ?? "")),
|
2024-08-28 00:23:29 +02:00
|
|
|
ogSiteName: "Versia",
|
2024-05-12 08:13:35 +02:00
|
|
|
colorScheme: "dark",
|
2024-05-12 09:30:02 +02:00
|
|
|
themeColor: "#f9a8d4",
|
2024-05-12 08:13:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
useHead({
|
|
|
|
|
htmlAttrs: {
|
|
|
|
|
lang: "en",
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2025-01-29 04:39:33 +01:00
|
|
|
if (code && origin && appData.value && route.path !== "/oauth/code") {
|
|
|
|
|
const newOrigin = new URL(
|
2025-03-28 01:16:24 +01:00
|
|
|
URL.canParse(origin) ? origin : `https://${origin}`,
|
2025-01-29 04:39:33 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
signInWithCode(code, appData.value, newOrigin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (origin && !code) {
|
|
|
|
|
const newOrigin = new URL(
|
2025-03-28 01:16:24 +01:00
|
|
|
URL.canParse(origin) ? origin : `https://${origin}`,
|
2025-01-29 04:39:33 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
signIn(appData, newOrigin);
|
2024-04-27 06:50:30 +02:00
|
|
|
}
|
2024-04-28 09:54:13 +02:00
|
|
|
|
2024-06-10 05:24:55 +02:00
|
|
|
useListen("identity:change", (newIdentity) => {
|
|
|
|
|
identity.value = newIdentity;
|
|
|
|
|
window.location.pathname = "/";
|
|
|
|
|
});
|
|
|
|
|
|
2024-05-17 08:25:59 +02:00
|
|
|
useCacheRefresh(client);
|
2024-04-22 09:38:51 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
2025-04-10 13:55:56 +02:00
|
|
|
@import "tailwindcss";
|
|
|
|
|
@import "./styles/index.css";
|
|
|
|
|
|
2024-04-22 09:38:51 +02:00
|
|
|
body {
|
|
|
|
|
font-family: Inter, sans-serif;
|
|
|
|
|
}
|
2024-12-25 17:39:07 +01:00
|
|
|
|
|
|
|
|
html.theme-changing * {
|
|
|
|
|
/* Stroke and fill aren't animatable */
|
2025-03-27 22:20:04 +01:00
|
|
|
transition: background-color 1s ease, border 1s ease, color 1s ease,
|
|
|
|
|
box-shadow 1s ease !important;
|
2024-12-25 17:39:07 +01:00
|
|
|
}
|
2025-03-28 01:16:24 +01:00
|
|
|
|
2025-05-01 01:45:46 +02:00
|
|
|
.slide-up-enter-active,
|
|
|
|
|
.slide-up-leave-active {
|
2025-03-28 01:16:24 +01:00
|
|
|
transition: transform 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 01:45:46 +02:00
|
|
|
.slide-up-enter-from,
|
|
|
|
|
.slide-up-leave-to {
|
|
|
|
|
transform: translateY(100%);
|
2025-03-28 01:16:24 +01:00
|
|
|
}
|
2024-12-25 17:39:07 +01:00
|
|
|
</style>
|