frontend/layouts/app.vue

75 lines
3.1 KiB
Vue
Raw Normal View History

<template>
<div class="from-dark-600 to-dark-900 bg-gradient-to-tl min-h-dvh">
2024-05-12 09:30:02 +02:00
<LazySidebarsNavigation />
2024-05-12 07:26:29 +02:00
<div class="relative md:pl-20 min-h-dvh flex flex-row overflow-hidden justify-center xl:justify-between">
<OverlayScrollbarsComponent :defer="true" class="w-full max-h-dvh overflow-y-auto">
<slot />
2024-05-12 07:26:29 +02:00
</OverlayScrollbarsComponent>
<ClientOnly>
2024-05-12 09:30:02 +02:00
<LazySidebarsCollapsibleAside v-if="width > 1280 && tokenData" direction="right"
2024-05-12 07:26:29 +02:00
class="max-w-md max-h-dvh overflow-y-auto w-full hidden absolute inset-y-0 xl:flex">
2024-05-12 09:30:02 +02:00
<LazyTimelinesTimelineScroller>
<LazyTimelinesNotifications />
2024-05-12 09:30:02 +02:00
</LazyTimelinesTimelineScroller>
<!-- <div class="mt-auto prose prose-invert prose-sm flex flex-col gap-4 px-10 pb-10" v-if="!tokenData">
<div class="text-center">
<strong
class="bg-gradient-to-tr from-pink-300 via-purple-300 to-indigo-400 text-transparent bg-clip-text">Lysand
{{ instance?.lysand_version ?? instance?.version }}</strong> <a
href="https://github.com/lysand-org/lysand" target="_blank">Source Code</a> <a
href="https://github.com/lysand-org/lysand/issues" target="_blank">Report an Issue</a>
</div>
<NuxtLink href="https://github.com/lysand-org/lysand" target="_blank">
<ButtonsSecondary class="w-full">
Create your own instance
</ButtonsSecondary>
</NuxtLink>
<NuxtLink href="/about/apps">
<ButtonsSecondary class="w-full">
Mobile Apps
</ButtonsSecondary>
</NuxtLink>
</div> -->
2024-05-12 09:30:02 +02:00
</LazySidebarsCollapsibleAside>
</ClientOnly>
</div>
</div>
2024-05-12 09:30:02 +02:00
<LazyComposerModal />
</template>
<script setup lang="ts">
2024-05-12 07:26:29 +02:00
import { OverlayScrollbarsComponent } from "#imports";
const { width } = useWindowSize();
const { n, o_i_d_c } = useMagicKeys();
const tokenData = useTokenData();
const client = useMegalodon(tokenData);
const providers = await useOAuthProviders();
watchEffect(async () => {
if (n.value) {
// Wait 50ms
await new Promise((resolve) => setTimeout(resolve, 50));
useEvent("composer:open");
}
if (o_i_d_c.value) {
const response = await fetch(
new URL(
`/oauth/link?issuer=${providers.value[0].id}`,
client.value?.baseUrl,
),
{
headers: {
Authorization: `Bearer ${tokenData.value?.access_token}`,
},
},
);
const json = await response.json();
window.location.href = json.link;
}
});
</script>