refactor: ♻️ Rewrite state system to use Pinia for composer and auth

This commit is contained in:
Jesse Wierzbinski 2025-08-28 07:41:51 +02:00
parent a6db9e059d
commit b510782a30
No known key found for this signature in database
80 changed files with 999 additions and 1011 deletions

View file

@ -1,15 +1,15 @@
<template>
<SidebarProvider>
<AppSidebar>
<slot v-if="!route.meta.requiresAuth || identity" />
<slot v-if="!route.meta.requiresAuth || authStore.isSignedIn" />
<div class="mx-auto max-w-4xl p-4" v-else>
<AuthRequired />
</div>
</AppSidebar>
</SidebarProvider>
<MobileNavbar v-if="identity" />
<MobileNavbar v-if="authStore.isSignedIn" />
<Preferences />
<ComposerDialog v-if="identity" />
<ComposerDialog v-if="authStore.isSignedIn" />
</template>
<script setup lang="ts">
@ -23,6 +23,7 @@ import { SidebarProvider } from "~/components/ui/sidebar";
const colorMode = useColorMode();
const { n, d } = useMagicKeys();
const activeElement = useActiveElement();
const authStore = useAuthStore();
const notUsingInput = computed(
() =>
activeElement.value?.tagName !== "INPUT" &&

11
app/layouts/auth.vue Normal file
View file

@ -0,0 +1,11 @@
<template>
<div class="flex h-svh items-center justify-center px-6 py-12 lg:px-8 bg-center bg-no-repeat bg-cover" :style="{
backgroundImage: 'url(/images/banner.webp)',
}">
<slot />
</div>
</template>
<script lang="ts" setup>
</script>

View file

@ -1,8 +1,10 @@
<template>
<slot />
<ComposerDialog v-if="identity" />
<ComposerDialog v-if="authStore.isSignedIn" />
</template>
<script lang="ts" setup>
import ComposerDialog from "~/components/composer/dialog.vue";
const authStore = useAuthStore();
</script>