Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions e2e/test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,20 @@ export async function loginWithNsec(page: Page, nsec: string = TEST_NSEC) {
await page.getByPlaceholder('nsec1...').fill(nsec);
await page.getByRole('button', { name: 'Mit nsec anmelden' }).click();

// Wait for auth avatar to become visible
await expect(page.getByTestId('auth-user-avatar')).toBeVisible({ timeout: 10000 });

// CRITICAL: Wait for any dialogs and overlays to fully close
// The dialog should auto-close via $effect, but we need to wait for the animation
await page.waitForTimeout(1000); // Wait for close animation and any async work

// Verify no overlays are blocking the UI
const dialogOverlay = page.locator('[data-dialog-overlay][data-state="open"]');
const overlayCount = await dialogOverlay.count();
if (overlayCount > 0) {
console.warn(`Warning: ${overlayCount} dialog overlay(s) still open after login, waiting longer...`);
await page.waitForTimeout(2000);
}
}

/**
Expand Down
16 changes: 16 additions & 0 deletions src/routes/cardsboard/LeftSidebarFooter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import SettingsPanel from "$lib/components/settings/SettingsPanel.svelte";
import RelayStatusInfo from "./RelayStatusInfo.svelte";
import FAQDialog from "./FAQDialog.svelte";
import PublicBoardsDialog from "./PublicBoardsDialog.svelte";
import LogInIcon from "@lucide/svelte/icons/log-in";
import LogOutIcon from "@lucide/svelte/icons/log-out";
import PlayIcon from "@lucide/svelte/icons/play";
Expand All @@ -28,6 +29,7 @@
import BookIcon from "@lucide/svelte/icons/book";
import InfoIcon from "@lucide/svelte/icons/info";
import HelpCircleIcon from "@lucide/svelte/icons/help-circle";
import GlobeIcon from "@lucide/svelte/icons/globe";
import { ProfileEditor } from '$lib/components/auth/index.js';


Expand All @@ -46,6 +48,7 @@
let uiSettingsOpen = $state(false);
let llmSettingsOpen = $state(false);
let defaultsSettingsOpen = $state(false);
let publicBoardsDialogOpen = $state(false);
let faqDialogOpen = $state(false);

// Demo-Error Message
Expand Down Expand Up @@ -154,6 +157,14 @@
<span>Wissenswertes</span>
</DropdownMenu.SubTrigger>
<DropdownMenu.SubContent class="w-48">
<DropdownMenu.Item
onclick={() => publicBoardsDialogOpen = true}
class="gap-2 editor-menu-item"
>
<GlobeIcon class="h-4 w-4" />
<span>Öffentliche Boards</span>
</DropdownMenu.Item>
<DropdownMenu.Separator />
<DropdownMenu.Item
onclick={() => window.open(settingsStore.settings.sourceCodeUrl, "_blank")}
class="gap-2 editor-menu-item"
Expand Down Expand Up @@ -248,6 +259,11 @@
<!-- FAQ Dialog -->
<FAQDialog bind:open={faqDialogOpen} />

<!-- Public Boards Dialog - only render when opened to avoid interference -->
{#if publicBoardsDialogOpen}
<PublicBoardsDialog bind:open={publicBoardsDialogOpen} />
{/if}

<ProfileEditor
open={showProfileEditor}
onClose={() => showProfileEditor = false}
Expand Down
26 changes: 26 additions & 0 deletions src/routes/cardsboard/LoginDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,32 @@
let nsecInput = $state('');
let isLoading = $derived(authStore.isLoading);
let errorMessage = $derived(authStore.errorMessage);
let isAuthenticated = $derived(authStore.isAuthenticated);

// Track if dialog was open when auth was NOT active, then close after fresh auth // This prevents premature closing if user was already authenticated
let wasUnauthenticatedWhenOpened = $state(false);

$effect(() => {
if (open && !isAuthenticated) {
wasUnauthenticatedWhenOpened = true;
} else if (!open) {
// Reset when dialog closes
wasUnauthenticatedWhenOpened = false;
}
});

// Auto-close after successful login (with small delay to avoid race conditions)
$effect(() => {
if (wasUnauthenticatedWhenOpened && isAuthenticated && open && !isLoading) {
// Small delay to ensure all UI updates complete before closing
setTimeout(() => {
console.log('[LoginDialog] Closing after successful auth');
open = false;
nsecInput = '';
wasUnauthenticatedWhenOpened = false;
}, 500);
}
});

// Browser detection
let browserType = $state<'chrome' | 'firefox' | 'safari' | 'edge' | 'opera' | 'brave' | 'unknown'>('unknown');
Expand Down
Loading