Add stuff

This commit is contained in:
2025-07-31 22:50:39 +02:00
parent 07c434dba8
commit 15f4f74cb7
18 changed files with 506 additions and 76 deletions
+34
View File
@@ -0,0 +1,34 @@
<script setup lang="ts">
const { locale, locales } = useI18n();
const switchLocalePath = useSwitchLocalePath();
const availableLocales = computed(() => {
return locales.value.filter((i) => l(i) !== locale.value);
});
const { loggedIn, clear, user } = useUserSession();
const localePath = useLocalePath();
function l(locale: (typeof locales.value)[0]) {
return typeof locale === 'string' ? locale : locale.code;
}
</script>
<template>
<div>
<div class="m-2 flex flex-row gap-4 underline">
<NuxtLink
v-for="loc in availableLocales"
:key="l(loc)"
:to="switchLocalePath(l(loc))"
:title="$t('layouts.switch_lang', { locale: $t(`locales.${l(loc)}`) })"
>{{ $t(`locales.${l(loc)}`) }}
</NuxtLink>
<a v-if="loggedIn" href="#" @click.prevent="clear">Logout</a>
<NuxtLink v-else :to="localePath('/login')">Login</NuxtLink>
<NuxtLink :to="localePath('/')">Home</NuxtLink>
</div>
<Suspense>
<slot />
</Suspense>
</div>
</template>