phase-10.5: market screener ui enhancements

This commit is contained in:
saikiranvella
2026-06-09 01:21:02 -04:00
parent 3c321a4a79
commit 5c8cd8935a
45 changed files with 3054 additions and 539 deletions
+26 -4
View File
@@ -1,7 +1,9 @@
<script lang="ts">
import { page, navigating } from '$app/stores';
import { goto } from '$app/navigation';
import '../styles/app.scss';
import Spinner from '$lib/components/shared/Spinner.svelte';
import { authStore } from '$lib/stores/auth.store.svelte.js';
import type { Snippet } from 'svelte';
let { children }: { children: Snippet } = $props();
@@ -9,6 +11,14 @@
// so the nav link highlights immediately on click, not after load completes.
const activePath = $derived($navigating?.to?.url?.pathname ?? $page.url.pathname);
// All routes except /auth/* require login
$effect(() => {
const path = $page.url.pathname;
if (!path.startsWith('/auth/') && !authStore.isLoggedIn) {
goto('/auth/login');
}
});
const navLabel = $derived(
activePath === '/portfolio' ? 'Loading portfolio…' :
activePath?.startsWith('/calls') ? 'Loading market calls…' :
@@ -21,10 +31,22 @@
<nav>
<span class="brand">📊 Market Screener</span>
<div class="links">
<a href="/" class:active={activePath === '/'}>Screener</a>
<a href="/portfolio" class:active={activePath === '/portfolio'}>Portfolio</a>
<a href="/calls" class:active={activePath?.startsWith('/calls')}>Market Calls</a>
<a href="/safe-buys" class:active={activePath === '/safe-buys'}>🛡 Safe Buys</a>
{#if authStore.isLoggedIn}
<a href="/" class:active={activePath === '/'}>Screener</a>
<a href="/portfolio" class:active={activePath === '/portfolio'}>Portfolio</a>
<a href="/calls" class:active={activePath?.startsWith('/calls')}>Market Calls</a>
<a href="/safe-buys" class:active={activePath === '/safe-buys'}>🛡 Safe Buys</a>
{/if}
</div>
<div class="nav-auth">
{#if authStore.isLoggedIn}
<span class="nav-user">{authStore.user?.email}</span>
<button class="btn-ghost btn-sm" onclick={() => { authStore.clearAuth(); goto('/auth/login'); }}>
Sign out
</button>
{:else}
<a href="/auth/login" class="btn-ghost btn-sm">Sign in</a>
{/if}
</div>
</nav>