diff --git a/apps/chat/apps/web/src/routes/(protected)/+layout.svelte b/apps/chat/apps/web/src/routes/(protected)/+layout.svelte index dcfee28bf..99b236a9e 100644 --- a/apps/chat/apps/web/src/routes/(protected)/+layout.svelte +++ b/apps/chat/apps/web/src/routes/(protected)/+layout.svelte @@ -24,11 +24,6 @@ import { getPillAppItems } from '@manacore/shared-branding'; import { getLanguageDropdownItems, getCurrentLanguageLabel } from '@manacore/shared-i18n'; import { setLocale, supportedLocales } from '$lib/i18n'; - import { - AuthGateModal, - GuestWelcomeModal, - shouldShowGuestWelcome, - } from '@manacore/shared-auth-ui'; import type { LayoutData } from './$types'; // App switcher items @@ -40,17 +35,6 @@ let isSidebarMode = $state(false); let isCollapsed = $state(false); - // Guest mode state - let showAuthGateModal = $state(false); - let authGateAction = $state<'save' | 'sync' | 'ai' | 'feature'>('ai'); - - // Guest welcome modal state - let showGuestWelcome = $state(false); - - // Check if in guest mode - let isGuestMode = $derived(!authStore.isAuthenticated); - let sessionConversationCount = $derived(sessionConversationsStore.count); - // Use theme store's isDark directly let isDark = $derived(theme.isDark); @@ -170,8 +154,15 @@ goto('/login'); } - // Initialize on mount - supports both authenticated and guest mode + // Initialize on mount - enforce login onMount(async () => { + // Initialize auth and redirect if not authenticated + await authStore.initialize(); + if (!authStore.isAuthenticated) { + goto('/login'); + return; + } + // Initialize theme theme.initialize(); @@ -189,27 +180,18 @@ collapsedStore.set(true); } - await authStore.initialize(); + // Load user settings + await userSettings.load(); - // Show guest welcome modal for unauthenticated users - if (!authStore.isAuthenticated && shouldShowGuestWelcome('chat')) { - showGuestWelcome = true; + // Check for session conversations to migrate + if (conversationsStore.hasSessionConversations) { + await conversationsStore.migrateSessionConversations(); } - // Load user settings if authenticated - if (authStore.isAuthenticated) { - await userSettings.load(); - - // Check for session conversations to migrate - if (conversationsStore.hasSessionConversations) { - await conversationsStore.migrateSessionConversations(); - } - - // Redirect to start page if on /chat and a custom start page is set - const currentPath = window.location.pathname; - if (currentPath === '/chat' && userSettings.startPage && userSettings.startPage !== '/chat') { - goto(userSettings.startPage, { replaceState: true }); - } + // Redirect to start page if on /chat and a custom start page is set + const currentPath = window.location.pathname; + if (currentPath === '/chat' && userSettings.startPage && userSettings.startPage !== '/chat') { + goto(userSettings.startPage, { replaceState: true }); } isChecking = false; @@ -229,22 +211,8 @@ {:else} - - {#if isGuestMode} -
- - Du bist im Gast-Modus. - {#if sessionConversationCount > 0} - {sessionConversationCount} - {sessionConversationCount === 1 ? 'Unterhaltung' : 'Unterhaltungen'} in dieser Session. - {/if} - - -
- {/if} - -
+
- - - (showAuthGateModal = false)} - onLogin={() => { - showAuthGateModal = false; - if (typeof sessionStorage !== 'undefined') { - sessionStorage.setItem('auth-return-url', window.location.pathname); - } - goto('/login'); - }} - onRegister={() => { - showAuthGateModal = false; - if (typeof sessionStorage !== 'undefined') { - sessionStorage.setItem('auth-return-url', window.location.pathname); - } - goto('/register'); - }} - action={authGateAction} - migrationCount={sessionConversationCount} - locale={currentLocale === 'en' ? 'en' : 'de'} - /> - - - (showGuestWelcome = false)} - onLogin={() => { - showGuestWelcome = false; - goto('/login'); - }} - onRegister={() => { - showGuestWelcome = false; - goto('/register'); - }} - helpHref="/help" - locale={currentLocale === 'en' ? 'en' : 'de'} - /> {/if}