phase-5: code maintenance
This commit is contained in:
@@ -115,11 +115,33 @@ server/
|
||||
calls.js ← CRUD for market calls + GET /api/calls/calendar (earnings/dividend events)
|
||||
|
||||
ui/ ← SvelteKit dashboard (lives inside this repo, not a separate repo)
|
||||
src/routes/
|
||||
+page.svelte ← main screener UI
|
||||
calls/ ← market calls list + detail views
|
||||
portfolio/ ← portfolio advice view
|
||||
safe-buys/ ← filtered strong-buy view
|
||||
src/
|
||||
styles/ ← global SCSS design-token system (Phase 4)
|
||||
app.scss ← root file — @use all partials
|
||||
_tokens.scss ← CSS custom properties generated from SCSS maps ($bg, $text, $blues, $signals…)
|
||||
_reset.scss ← box-sizing reset + body base
|
||||
_layout.scss ← shell, nav, .links, main, nav-progress, .loading-area
|
||||
_section.scss ← .section, .section-header, .count, .mode-tabs, .error-banner
|
||||
_table.scss ← table, thead/tbody, .table-wrap, .col-ticker, .ticker, .num, .tag
|
||||
_buttons.scss ← button base, .btn-primary, .btn-catalyst, .btn-ghost, .btn-screen, .btn-analyze
|
||||
_badges.scss ← .verdict-pill, .sentiment-pill, .text-* helpers (SCSS @each maps)
|
||||
lib/
|
||||
api.js ← typed fetch wrappers for all API routes
|
||||
utils.ts ← shared pure functions: sigOrd, sorted, verdictShort, vClass, fmtPE, fmt…
|
||||
MarketContext.svelte ← collapsible card-grid context (used in portfolio + safe-buys)
|
||||
MarketContextStrip.svelte ← horizontal chip strip (used in screener — Phase 5)
|
||||
AssetTable.svelte ← STOCK/ETF/BOND section: mode tabs + Analyze + table (Phase 5)
|
||||
AnalysisSidebar.svelte ← LLM analysis slide-over panel (Phase 5)
|
||||
VerdictPill.svelte ← verdict-pill span; props: label (Phase 5)
|
||||
SignalBadge.svelte ← signal emoji + label badge
|
||||
Spinner.svelte ← sm: dot-pulse | md/lg: chart-line animation
|
||||
routes/
|
||||
+page.js ← SvelteKit load (ssr:false) — fetches catalysts + screens on mount (Phase 5)
|
||||
+page.svelte ← main screener UI (~230 lines after Phase 5 decomposition)
|
||||
+layout.svelte ← shell, nav, nav-progress bar, nav-overlay with Spinner
|
||||
calls/ ← market calls list + detail views
|
||||
portfolio/ ← portfolio advice view
|
||||
safe-buys/ ← filtered strong-buy view
|
||||
|
||||
market-calls.json ← persisted market thesis calls (written by MarketCallStore)
|
||||
portfolio.json ← user's holdings: ticker, shares, costBasis, source, type
|
||||
@@ -358,6 +380,12 @@ Test output: silent on pass, shows only failures + one summary line (`scripts/su
|
||||
|
||||
**Key unit:** `ytm` in `Bond.metrics` is stored as a percentage (e.g. `6.5` = 6.5%). `BondScorer._sanitize` divides by 100 before spread calculation.
|
||||
|
||||
**Coverage gaps (known):**
|
||||
- `MarketCallStore.js` — no tests; CRUD against `market-calls.json` is untested
|
||||
- `LLMAnalyst.test.js` — tests a local copy of the fence-stripping regex rather than importing from source; will silently drift if the regex changes
|
||||
- API routes (`server/server/routes/`) — no integration tests; covered implicitly by manual testing only
|
||||
- UI components — not tested at the unit level (Phases 4–5 are pure UI; no server logic changed)
|
||||
|
||||
---
|
||||
|
||||
## Conventions
|
||||
@@ -412,28 +440,31 @@ All items completed. Additional features delivered alongside cleanup:
|
||||
- Renamed `src/` to `server/` — `src/server/` is now `server/server/`
|
||||
- Updated all import paths in `bin/`, `tests/`, and `CLAUDE.md`
|
||||
|
||||
### Phase 4 — SCSS Migration
|
||||
Replace per-component `<style>` blocks with a shared token system in `ui/src/styles/`:
|
||||
```
|
||||
_tokens.scss ← all color variables, spacing, font-size scale
|
||||
_reset.scss ← current 3-line app.css
|
||||
_layout.scss ← shell, nav, main (from +layout.svelte)
|
||||
_table.scss ← shared table/thead/.ticker/.num styles (used across 4 pages)
|
||||
_buttons.scss ← btn-primary, btn-ghost, btn-analyze, btn-catalyst
|
||||
_badges.scss ← verdict-pill, tag, sentiment-pill (resolves verdict-pill vs vpill inconsistency)
|
||||
_section.scss ← section card + section-header pattern
|
||||
app.scss ← root file, @uses all partials
|
||||
```
|
||||
Component `<style>` blocks should only contain styles genuinely unique to that component.
|
||||
### Phase 4 — SCSS Migration ✅ COMPLETE
|
||||
|
||||
### Phase 5 — Decompose `+page.svelte`
|
||||
At 962 lines it is the biggest maintenance liability. Extract into:
|
||||
- `AssetTable.svelte` — accepts `type`, `rows`, `mode`; renders STOCK/ETF/BOND table with mode tabs and Analyze button
|
||||
- `AnalysisSidebar.svelte` — owns open/close/loading state, takes `type` + `onAnalyze` as props
|
||||
- `VerdictPill.svelte` — single component replacing both `.verdict-pill` and `.vpill` usages
|
||||
- `MarketContextStrip.svelte` — consolidates the inline version in `+page.svelte` with the existing `MarketContext.svelte` in `$lib/`
|
||||
**Done:**
|
||||
- Created `ui/src/styles/` with 7 partials + `app.scss` root (imported by `+layout.svelte`)
|
||||
- `_tokens.scss` uses SCSS maps (`$bg`, `$borders`, `$text`, `$blues`, `$signals`) with `@each` loops to emit CSS custom properties — adding a token is one line in the map
|
||||
- `_badges.scss` uses `@each` + `map.get` for verdict/sentiment color variants and `.text-*` helpers; shared `%pill-base` placeholder
|
||||
- `_buttons.scss` uses `%btn-disabled` / `%btn-inline-flex` placeholders + nested `&:hover` / `&:disabled`
|
||||
- `_section.scss`, `_table.scss`, `_layout.scss` use SCSS nesting throughout
|
||||
- `.vpill` (safe-buys) unified with `.verdict-pill` (screener) — inconsistency resolved
|
||||
- All component `<style>` blocks trimmed to component-unique rules only; `+layout.svelte` style block removed entirely
|
||||
- Nav links now highlight immediately on click via `activePath` derived from `$navigating` (not `$page`)
|
||||
- `+layout.svelte` nav-overlay uses `<Spinner>` component instead of legacy CSS spinner
|
||||
|
||||
Also: split `loadCatalysts()` into two functions (fetch tickers / screen tickers). Replace the `_booted` / `$effect` hack with a proper `+page.js` load function.
|
||||
**Note:** `sass` must be installed in `ui/` (`npm install -D sass --legacy-peer-deps`). Map keys that are CSS color names (`'green'`, `'red'`, `'blue'`, etc.) must be quoted to avoid Sass color-value interpolation warnings.
|
||||
|
||||
### Phase 5 — Decompose `+page.svelte` ✅ COMPLETE
|
||||
|
||||
**Done:**
|
||||
- `VerdictPill.svelte` — wraps `<span class="verdict-pill {vClass(label)}">`. Used in screener summary, detail tables, and safe-buys (replacing inline spans + removing `verdictShort`/`vClass` imports from safe-buys)
|
||||
- `MarketContextStrip.svelte` — horizontal chip strip extracted from `+page.svelte`. Uses a `$derived` chips array so the template is declarative (no repeated markup blocks)
|
||||
- `AssetTable.svelte` — full STOCK/ETF/BOND section: section-header, mode tabs (owns `mode` state internally), Analyze button, complete table per type. Props: `type`, `rows`, `analyzeLoading`, `onAnalyze`
|
||||
- `AnalysisSidebar.svelte` — LLM slide-over panel. Props: `sidebar` (state object from parent), `onClose`. All `sb-*` styles live here
|
||||
- `+page.js` — `export const ssr = false`; `load()` fetches catalysts then screens them. Component receives `data.results` + `data.catalystInput` as props — replaces `_booted` / `$effect` hack entirely
|
||||
- `loadCatalysts()` split: initial load handled by `+page.js`, user-triggered refresh is `reloadCatalysts()` in the component
|
||||
- `+page.svelte` reduced from ~600 lines to ~230 lines
|
||||
|
||||
### Phase 6 — TypeScript
|
||||
Convert server first (no framework coupling), then `$lib/utils`, then Svelte components.
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
<script>
|
||||
import Spinner from '$lib/Spinner.svelte';
|
||||
|
||||
let { sidebar, onClose } = $props();
|
||||
</script>
|
||||
|
||||
{#if sidebar.open}
|
||||
<!-- Backdrop -->
|
||||
<div
|
||||
class="sidebar-backdrop"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
aria-label="Close sidebar"
|
||||
onclick={onClose}
|
||||
onkeydown={(e) => e.key === 'Escape' && onClose()}
|
||||
></div>
|
||||
|
||||
<!-- Panel -->
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="sidebar-title">
|
||||
<span>🤖 LLM Analysis</span>
|
||||
{#if sidebar.type}<span class="sidebar-type">{sidebar.type}S</span>{/if}
|
||||
</div>
|
||||
<button class="sidebar-close" onclick={onClose}>✕</button>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-body">
|
||||
{#if sidebar.loading}
|
||||
<div class="sidebar-loading">
|
||||
<Spinner size="lg" label="Analyzing tickers…" />
|
||||
</div>
|
||||
|
||||
{:else if sidebar.error}
|
||||
<div class="sidebar-error">{sidebar.error}</div>
|
||||
|
||||
{:else if sidebar.analysis}
|
||||
{@const a = sidebar.analysis}
|
||||
<div class="sb-sentiment-row">
|
||||
<span class="sentiment-pill" data-sentiment={a.sentiment}>{a.sentiment}</span>
|
||||
</div>
|
||||
|
||||
<p class="sb-summary">{a.summary}</p>
|
||||
|
||||
<h3 class="sb-sub">Affected Industries</h3>
|
||||
<div class="sb-list">
|
||||
{#each a.affectedIndustries ?? [] as ind}
|
||||
<div class="sb-item">
|
||||
<span class="sb-name">{ind.name}</span>
|
||||
<span class="sb-reason">{ind.reason}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<h3 class="sb-sub">Related Tickers to Watch</h3>
|
||||
<div class="sb-list">
|
||||
{#each a.relatedTickers ?? [] as rt}
|
||||
<div class="sb-item">
|
||||
<span class="sb-name ticker">{rt.ticker}</span>
|
||||
<span class="sb-reason">{rt.reason}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</aside>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.sidebar-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: #00000055;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
top: 0; right: 0; bottom: 0;
|
||||
width: 380px;
|
||||
background: var(--bg-surface);
|
||||
border-left: 1px solid var(--blue-surface);
|
||||
z-index: 101;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px var(--space-xl);
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--blue-badge);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: var(--fs-md);
|
||||
font-weight: 700;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.sidebar-type {
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
background: var(--blue-surface);
|
||||
color: var(--blue-muted);
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--radius-pill);
|
||||
}
|
||||
|
||||
.sidebar-close {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-dimmer);
|
||||
font-size: 14px;
|
||||
padding: 4px 8px;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-xs);
|
||||
|
||||
&:hover { color: var(--text-muted); background: var(--bg-card); }
|
||||
}
|
||||
|
||||
.sidebar-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: var(--space-xl);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.sidebar-loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
padding: 60px 0;
|
||||
}
|
||||
|
||||
.sidebar-error {
|
||||
color: var(--red);
|
||||
background: var(--red-bg);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 12px var(--space-lg);
|
||||
font-size: var(--fs-md);
|
||||
}
|
||||
|
||||
.sb-sentiment-row { display: flex; align-items: center; gap: 8px; }
|
||||
|
||||
.sb-summary {
|
||||
font-size: var(--fs-md);
|
||||
color: var(--text-muted);
|
||||
line-height: 1.6;
|
||||
border-left: 3px solid var(--blue-surface);
|
||||
padding-left: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sb-sub {
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--text-dimmer);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sb-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
.sb-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding: 10px 12px;
|
||||
background: var(--bg-elevated);
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.sb-name {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.sb-reason {
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--text-dim);
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,108 @@
|
||||
<script>
|
||||
import { sigOrd, sorted, verdictShort, vClass } from '$lib/utils.js';
|
||||
import VerdictPill from '$lib/VerdictPill.svelte';
|
||||
import SignalBadge from '$lib/SignalBadge.svelte';
|
||||
import Spinner from '$lib/Spinner.svelte';
|
||||
|
||||
let { type, rows, analyzeLoading = false, onAnalyze } = $props();
|
||||
|
||||
// Mode state is self-contained — each table independently tracks inflated vs fundamental
|
||||
let mode = $state('inflated');
|
||||
</script>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>{type}S</h2>
|
||||
<span class="count">{rows.length}</span>
|
||||
|
||||
<div class="mode-tabs">
|
||||
<button class:active={mode === 'inflated'} onclick={() => mode = 'inflated'}>Mkt-Adjusted</button>
|
||||
<button class:active={mode === 'fundamental'} onclick={() => mode = 'fundamental'}>Graham</button>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="btn-analyze"
|
||||
onclick={onAnalyze}
|
||||
disabled={analyzeLoading}
|
||||
title="AI analysis of news for these tickers"
|
||||
>
|
||||
{#if analyzeLoading}
|
||||
<Spinner size="sm" />
|
||||
{:else}
|
||||
✦ Analyze
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-ticker">Ticker</th>
|
||||
<th>Price</th>
|
||||
<th>Verdict</th>
|
||||
<th>Score</th>
|
||||
{#if type === 'STOCK'}
|
||||
<th>Sector</th>
|
||||
<th>P/E</th><th>PEG</th><th>ROE%</th>
|
||||
<th>OpMgn%</th><th>FCF%</th><th>D/E</th>
|
||||
<th>Flags</th>
|
||||
{:else if type === 'ETF'}
|
||||
<th>Expense</th><th>Yield</th><th>AUM</th><th>5Y Ret</th>
|
||||
{:else}
|
||||
<th>YTM</th><th>Duration</th><th>Rating</th>
|
||||
{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each sorted(rows) as r}
|
||||
{@const m = r.asset.displayMetrics ?? {}}
|
||||
{@const v = r[mode]}
|
||||
<tr class="data-row" data-signal={sigOrd(r.signal)}>
|
||||
<td class="ticker">{r.asset.ticker}</td>
|
||||
<td class="num">{m.Price ?? '—'}</td>
|
||||
<td><VerdictPill label={v.label} /></td>
|
||||
<td class="score-cell" title={v.scoreSummary}>{v.scoreSummary}</td>
|
||||
{#if type === 'STOCK'}
|
||||
<td><span class="tag sm">{m.Sector ?? '—'}</span></td>
|
||||
<td class="num">{m['P/E'] ?? '—'}</td>
|
||||
<td class="num">{m['PEG'] ?? '—'}</td>
|
||||
<td class="num">{m['ROE%'] ?? '—'}</td>
|
||||
<td class="num">{m['OpMgn%'] ?? '—'}</td>
|
||||
<td class="num">{m['FCF Yld%'] ?? '—'}</td>
|
||||
<td class="num">{m['D/E'] ?? '—'}</td>
|
||||
<td class="flags">
|
||||
{#each v.audit?.riskFlags ?? [] as flag}
|
||||
<span class="flag">⚠ {flag}</span>
|
||||
{/each}
|
||||
</td>
|
||||
{:else if type === 'ETF'}
|
||||
<td class="num">{m['Exp Ratio%'] ?? '—'}</td>
|
||||
<td class="num">{m['Yield%'] ?? '—'}</td>
|
||||
<td class="num">{m['AUM'] ?? '—'}</td>
|
||||
<td class="num">{m['5Y Return%'] ?? '—'}</td>
|
||||
{:else}
|
||||
<td class="num">{m['YTM%'] ?? '—'}</td>
|
||||
<td class="num">{m['Duration'] ?? '—'}</td>
|
||||
<td class="num">{m['Rating'] ?? '—'}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
/* Score cell — truncates long gate summaries, full text via title tooltip */
|
||||
.score-cell {
|
||||
color: var(--text-dim);
|
||||
font-size: var(--fs-sm);
|
||||
max-width: 140px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.flags { display: flex; flex-direction: column; gap: 2px; }
|
||||
.flag { color: var(--orange); font-size: var(--fs-sm); }
|
||||
</style>
|
||||
@@ -0,0 +1,69 @@
|
||||
<script>
|
||||
import { fmtPE } from '$lib/utils.js';
|
||||
let { ctx } = $props();
|
||||
|
||||
// Flat list of chips so the template stays declarative
|
||||
const chips = $derived([
|
||||
{ label: '10Y', value: ctx.riskFreeRate?.toFixed(2) + '%' },
|
||||
{ label: 'VIX', value: ctx.vixLevel?.toFixed(1) },
|
||||
{ label: 'S&P', value: ctx.sp500Price?.toLocaleString() },
|
||||
{ label: 'S&P P/E', value: fmtPE(ctx.benchmarks?.marketPE?.toFixed(1)) },
|
||||
{ label: 'Tech P/E', value: fmtPE(ctx.benchmarks?.techPE?.toFixed(1)) },
|
||||
{ label: 'REIT Yld', value: ctx.benchmarks?.reitYield?.toFixed(2) + '%' },
|
||||
{ label: 'IG Sprd', value: ctx.benchmarks?.igSpread?.toFixed(2) + '%' },
|
||||
{ label: 'Rates', value: ctx.rateRegime, regime: ctx.rateRegime },
|
||||
{ label: 'Vol', value: ctx.volatilityRegime, regime: ctx.volatilityRegime },
|
||||
]);
|
||||
</script>
|
||||
|
||||
<div class="ctx-strip">
|
||||
{#each chips as chip}
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">{chip.label}</span>
|
||||
<span class="ctx-val" class:ctx-regime={!!chip.regime} data-regime={chip.regime ?? ''}>
|
||||
{chip.value ?? '—'}
|
||||
</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.ctx-strip {
|
||||
display: flex;
|
||||
gap: 1px;
|
||||
background: var(--border);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ctx-chip {
|
||||
flex: 1;
|
||||
min-width: 70px;
|
||||
background: var(--bg-base);
|
||||
padding: 10px var(--space-lg);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.ctx-label {
|
||||
font-size: var(--fs-2xs);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-dimmer);
|
||||
}
|
||||
|
||||
.ctx-val {
|
||||
font-size: var(--fs-lg);
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.ctx-regime[data-regime='HIGH'] { color: var(--red); }
|
||||
.ctx-regime[data-regime='NORMAL'] { color: var(--text-muted); }
|
||||
.ctx-regime[data-regime='LOW'] { color: var(--green); }
|
||||
</style>
|
||||
@@ -0,0 +1,6 @@
|
||||
<script>
|
||||
import { verdictShort, vClass } from '$lib/utils.js';
|
||||
let { label } = $props();
|
||||
</script>
|
||||
|
||||
<span class="verdict-pill {vClass(label)}">{verdictShort(label)}</span>
|
||||
@@ -1,13 +1,17 @@
|
||||
<script>
|
||||
import { page, navigating } from '$app/stores';
|
||||
import '../styles/app.scss';
|
||||
import Spinner from '$lib/Spinner.svelte';
|
||||
let { children } = $props();
|
||||
|
||||
// Label shown under the nav progress bar while loading a page
|
||||
// Resolve active path optimistically — use the destination during navigation
|
||||
// so the nav link highlights immediately on click, not after load completes.
|
||||
const activePath = $derived($navigating?.to?.url?.pathname ?? $page.url.pathname);
|
||||
|
||||
const navLabel = $derived(
|
||||
$navigating?.to?.url?.pathname === '/portfolio' ? 'Loading portfolio…' :
|
||||
$navigating?.to?.url?.pathname?.startsWith('/calls') ? 'Loading market calls…' :
|
||||
$navigating?.to?.url?.pathname === '/safe-buys' ? 'Screening safe buys…' :
|
||||
activePath === '/portfolio' ? 'Loading portfolio…' :
|
||||
activePath?.startsWith('/calls') ? 'Loading market calls…' :
|
||||
activePath === '/safe-buys' ? 'Screening safe buys…' :
|
||||
'Loading…'
|
||||
);
|
||||
</script>
|
||||
@@ -16,10 +20,10 @@
|
||||
<nav>
|
||||
<span class="brand">📊 Market Screener</span>
|
||||
<div class="links">
|
||||
<a href="/" class:active={$page.url.pathname === '/'}>Screener</a>
|
||||
<a href="/portfolio" class:active={$page.url.pathname === '/portfolio'}>Portfolio</a>
|
||||
<a href="/calls" class:active={$page.url.pathname.startsWith('/calls')}>Market Calls</a>
|
||||
<a href="/safe-buys" class:active={$page.url.pathname === '/safe-buys'}>🛡 Safe Buys</a>
|
||||
<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>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -34,8 +38,7 @@
|
||||
{#if $navigating}
|
||||
<!-- Replace old page content immediately — old page disappears, spinner takes over -->
|
||||
<div class="nav-overlay">
|
||||
<div class="nav-spinner"></div>
|
||||
<span class="nav-label">{navLabel}</span>
|
||||
<Spinner size="lg" label={navLabel} />
|
||||
</div>
|
||||
{:else}
|
||||
{@render children()}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { fetchCatalysts, screenTickers } from '$lib/api.js';
|
||||
|
||||
// Client-only — the API lives at localhost:3000, not accessible during SSR
|
||||
export const ssr = false;
|
||||
|
||||
export async function load() {
|
||||
const cat = await fetchCatalysts();
|
||||
const results = await screenTickers(cat.tickers);
|
||||
return {
|
||||
results,
|
||||
catalystInput: cat.tickers.join(', '),
|
||||
};
|
||||
}
|
||||
+52
-419
@@ -1,25 +1,25 @@
|
||||
<script>
|
||||
import { screenTickers, fetchCatalysts, analyzeTickers } from '$lib/api.js';
|
||||
import { sigOrd, sorted, verdictShort, vClass, fmtPE } from '$lib/utils.js';
|
||||
import SignalBadge from '$lib/SignalBadge.svelte';
|
||||
import Spinner from '$lib/Spinner.svelte';
|
||||
import { screenTickers, analyzeTickers } from '$lib/api.js';
|
||||
import { sigOrd, sorted, verdictShort, vClass } from '$lib/utils.js';
|
||||
import SignalBadge from '$lib/SignalBadge.svelte';
|
||||
import Spinner from '$lib/Spinner.svelte';
|
||||
import VerdictPill from '$lib/VerdictPill.svelte';
|
||||
import MarketContextStrip from '$lib/MarketContextStrip.svelte';
|
||||
import AssetTable from '$lib/AssetTable.svelte';
|
||||
import AnalysisSidebar from '$lib/AnalysisSidebar.svelte';
|
||||
|
||||
let input = $state('');
|
||||
let searchOpen = $state(false); // collapsed by default
|
||||
let loading = $state(false);
|
||||
let loadingCats = $state(false);
|
||||
let error = $state(null);
|
||||
let results = $state(null);
|
||||
let activeTab = $state({});
|
||||
let screenedAt = $state(null);
|
||||
// Initial data comes from +page.js load (replaces _booted / $effect hack)
|
||||
let { data } = $props();
|
||||
|
||||
// Auto-load catalysts once on mount
|
||||
let _booted = false;
|
||||
$effect(() => {
|
||||
if (!_booted) { _booted = true; loadCatalysts(); }
|
||||
});
|
||||
let input = $state(data.catalystInput);
|
||||
let results = $state(data.results);
|
||||
let screenedAt = $state(new Date().toLocaleTimeString());
|
||||
let loading = $state(false);
|
||||
let loadingCats = $state(false);
|
||||
let error = $state(null);
|
||||
let searchOpen = $state(false);
|
||||
|
||||
// ── Per-tab LLM Analysis sidebar ────────────────────────────────────────────
|
||||
// ── LLM Analysis sidebar ────────────────────────────────────────────────
|
||||
let sidebar = $state({ open: false, loading: false, analysis: null, type: null, error: null });
|
||||
|
||||
async function runTabAnalysis(type) {
|
||||
@@ -29,16 +29,14 @@
|
||||
try {
|
||||
const res = await analyzeTickers(tickers);
|
||||
const reason = res.reason === 'no_stories' ? 'No recent news found for these tickers.' : null;
|
||||
sidebar = { open: true, loading: false, analysis: res.analysis, type, error: res.analysis ? null : (reason ?? 'Analysis failed — check server logs for details.') };
|
||||
sidebar = { open: true, loading: false, analysis: res.analysis, type,
|
||||
error: res.analysis ? null : (reason ?? 'Analysis failed — check server logs for details.') };
|
||||
} catch (e) {
|
||||
sidebar = { open: true, loading: false, analysis: null, type, error: e.message };
|
||||
}
|
||||
}
|
||||
|
||||
function closeSidebar() {
|
||||
sidebar = { ...sidebar, open: false };
|
||||
}
|
||||
|
||||
// ── Manual ticker search ─────────────────────────────────────────────────
|
||||
async function screen() {
|
||||
error = null;
|
||||
loading = true;
|
||||
@@ -53,18 +51,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Load catalysts then immediately screen — no extra click needed.
|
||||
// LLM analysis (if available) is shown alongside the results.
|
||||
async function loadCatalysts() {
|
||||
// ── Re-fetch today's catalysts ───────────────────────────────────────────
|
||||
// Splits fetch (news) from screen (Yahoo) — each step has its own loading flag.
|
||||
async function reloadCatalysts() {
|
||||
const { fetchCatalysts } = await import('$lib/api.js');
|
||||
loadingCats = true;
|
||||
error = null;
|
||||
try {
|
||||
const cat = await fetchCatalysts();
|
||||
const catInput = cat.tickers.join(', ');
|
||||
input = cat.tickers.join(', ');
|
||||
loading = true;
|
||||
results = await screenTickers(cat.tickers);
|
||||
screenedAt = new Date().toLocaleTimeString();
|
||||
if (!input) input = catInput;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
} finally {
|
||||
@@ -73,9 +71,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
const getTab = type => activeTab[type] ?? 'inflated';
|
||||
const setTab = (type, tab) => activeTab = { ...activeTab, [type]: tab };
|
||||
|
||||
const ctx = $derived(results?.marketContext ?? null);
|
||||
const allAssets = $derived(results
|
||||
? sorted([...results.STOCK, ...results.ETF, ...results.BOND])
|
||||
@@ -84,10 +79,10 @@
|
||||
|
||||
<div class="page">
|
||||
|
||||
<!-- ── Toolbar ──────────────────────────────────────────────────── -->
|
||||
<!-- ── Toolbar ────────────────────────────────────────────────────── -->
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-top">
|
||||
<button onclick={loadCatalysts} disabled={loading || loadingCats} class="btn-catalyst">
|
||||
<button onclick={reloadCatalysts} disabled={loading || loadingCats} class="btn-catalyst">
|
||||
{#if loadingCats}<Spinner size="sm" />{:else}📰 Today Market{/if}
|
||||
</button>
|
||||
<button
|
||||
@@ -122,52 +117,14 @@
|
||||
|
||||
{#if loading || loadingCats}
|
||||
<div class="loading-area">
|
||||
<Spinner size="lg" label={loadingCats ? 'Fetching news catalysts…' : loading ? `Screening tickers…` : ''} />
|
||||
<Spinner size="lg" label={loadingCats ? 'Fetching news catalysts…' : 'Screening tickers…'} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if ctx}
|
||||
<!-- ── Market Context Strip ────────────────────────────────────── -->
|
||||
<div class="ctx-strip">
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">10Y</span>
|
||||
<span class="ctx-val">{ctx.riskFreeRate?.toFixed(2)}%</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">VIX</span>
|
||||
<span class="ctx-val">{ctx.vixLevel?.toFixed(1)}</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">S&P</span>
|
||||
<span class="ctx-val">{ctx.sp500Price?.toLocaleString()}</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">S&P P/E</span>
|
||||
<span class="ctx-val">{fmtPE(ctx.benchmarks?.marketPE?.toFixed(1))}</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">Tech P/E</span>
|
||||
<span class="ctx-val">{fmtPE(ctx.benchmarks?.techPE?.toFixed(1))}</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">REIT Yld</span>
|
||||
<span class="ctx-val">{ctx.benchmarks?.reitYield?.toFixed(2)}%</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">IG Sprd</span>
|
||||
<span class="ctx-val">{ctx.benchmarks?.igSpread?.toFixed(2)}%</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">Rates</span>
|
||||
<span class="ctx-val ctx-regime" data-regime={ctx.rateRegime}>{ctx.rateRegime}</span>
|
||||
</div>
|
||||
<div class="ctx-chip">
|
||||
<span class="ctx-label">Vol</span>
|
||||
<span class="ctx-val ctx-regime" data-regime={ctx.volatilityRegime}>{ctx.volatilityRegime}</span>
|
||||
</div>
|
||||
</div>
|
||||
<MarketContextStrip {ctx} />
|
||||
|
||||
<!-- ── Signal Summary ─────────────────────────────────────────── -->
|
||||
<!-- ── Signal Summary ───────────────────────────────────────────── -->
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>Signal Summary</h2>
|
||||
@@ -190,16 +147,8 @@
|
||||
<td class="ticker">{r.asset.ticker}</td>
|
||||
<td><span class="tag">{r.asset.type}</span></td>
|
||||
<td><SignalBadge signal={r.signal} /></td>
|
||||
<td>
|
||||
<span class="verdict-pill {vClass(r.inflated.label)}">
|
||||
{verdictShort(r.inflated.label)}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="verdict-pill {vClass(r.fundamental.label)}">
|
||||
{verdictShort(r.fundamental.label)}
|
||||
</span>
|
||||
</td>
|
||||
<td><VerdictPill label={r.inflated.label} /></td>
|
||||
<td><VerdictPill label={r.fundamental.label} /></td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
@@ -207,104 +156,19 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ── Detail Sections ────────────────────────────────────────── -->
|
||||
<!-- ── Per-type detail tables ────────────────────────────────────── -->
|
||||
{#each ['STOCK', 'ETF', 'BOND'] as type}
|
||||
{#if results[type]?.length}
|
||||
{@const count = results[type].length}
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>{type}S</h2>
|
||||
<span class="count">{count}</span>
|
||||
<div class="mode-tabs">
|
||||
<button
|
||||
class:active={getTab(type) === 'inflated'}
|
||||
onclick={() => setTab(type, 'inflated')}
|
||||
>Mkt-Adjusted</button>
|
||||
<button
|
||||
class:active={getTab(type) === 'fundamental'}
|
||||
onclick={() => setTab(type, 'fundamental')}
|
||||
>Graham</button>
|
||||
</div>
|
||||
<button
|
||||
class="btn-analyze"
|
||||
onclick={() => runTabAnalysis(type)}
|
||||
disabled={sidebar.loading && sidebar.type === type}
|
||||
title="AI analysis of news for these tickers"
|
||||
>
|
||||
{#if sidebar.loading && sidebar.type === type}
|
||||
<Spinner size="sm" />
|
||||
{:else}
|
||||
✦ Analyze
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-ticker">Ticker</th>
|
||||
<th>Price</th>
|
||||
<th>Verdict</th>
|
||||
<th>Score</th>
|
||||
{#if type === 'STOCK'}
|
||||
<th>Sector</th>
|
||||
<th>P/E</th><th>PEG</th><th>ROE%</th>
|
||||
<th>OpMgn%</th><th>FCF%</th><th>D/E</th>
|
||||
<th>Flags</th>
|
||||
{:else if type === 'ETF'}
|
||||
<th>Expense</th><th>Yield</th><th>AUM</th><th>5Y Ret</th>
|
||||
{:else}
|
||||
<th>YTM</th><th>Duration</th><th>Rating</th>
|
||||
{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each sorted(results[type]) as r}
|
||||
{@const mode = getTab(type)}
|
||||
{@const m = r.asset.displayMetrics ?? {}}
|
||||
{@const v = r[mode]}
|
||||
<tr class="data-row" data-signal={sigOrd(r.signal)}>
|
||||
<td class="ticker">{r.asset.ticker}</td>
|
||||
<td class="num">{m.Price ?? '—'}</td>
|
||||
<td>
|
||||
<span class="verdict-pill {vClass(v.label)}">
|
||||
{verdictShort(v.label)}
|
||||
</span>
|
||||
</td>
|
||||
<td class="score-cell" title={v.scoreSummary}>{v.scoreSummary}</td>
|
||||
{#if type === 'STOCK'}
|
||||
<td><span class="tag sm">{m.Sector ?? '—'}</span></td>
|
||||
<td class="num">{m['P/E'] ?? '—'}</td>
|
||||
<td class="num">{m['PEG'] ?? '—'}</td>
|
||||
<td class="num">{m['ROE%'] ?? '—'}</td>
|
||||
<td class="num">{m['OpMgn%'] ?? '—'}</td>
|
||||
<td class="num">{m['FCF Yld%'] ?? '—'}</td>
|
||||
<td class="num">{m['D/E'] ?? '—'}</td>
|
||||
<td class="flags">
|
||||
{#each v.audit?.riskFlags ?? [] as flag}
|
||||
<span class="flag">⚠ {flag}</span>
|
||||
{/each}
|
||||
</td>
|
||||
{:else if type === 'ETF'}
|
||||
<td class="num">{m['Exp Ratio%'] ?? '—'}</td>
|
||||
<td class="num">{m['Yield%'] ?? '—'}</td>
|
||||
<td class="num">{m['AUM'] ?? '—'}</td>
|
||||
<td class="num">{m['5Y Return%'] ?? '—'}</td>
|
||||
{:else}
|
||||
<td class="num">{m['YTM%'] ?? '—'}</td>
|
||||
<td class="num">{m['Duration'] ?? '—'}</td>
|
||||
<td class="num">{m['Rating'] ?? '—'}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<AssetTable
|
||||
{type}
|
||||
rows={results[type]}
|
||||
analyzeLoading={sidebar.loading && sidebar.type === type}
|
||||
onAnalyze={() => runTabAnalysis(type)}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
<!-- ── Failed tickers ────────────────────────────────────────────── -->
|
||||
{#if results.ERROR?.length}
|
||||
<section class="section">
|
||||
<h2>Failed <span class="count">{results.ERROR.length}</span></h2>
|
||||
@@ -318,65 +182,15 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- ── LLM Analysis Sidebar ─────────────────────────────────────────────── -->
|
||||
{#if sidebar.open}
|
||||
<div class="sidebar-backdrop" role="button" tabindex="-1" aria-label="Close sidebar"
|
||||
onclick={closeSidebar} onkeydown={(e) => e.key === 'Escape' && closeSidebar()}></div>
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="sidebar-title">
|
||||
<span>🤖 LLM Analysis</span>
|
||||
{#if sidebar.type}<span class="sidebar-type">{sidebar.type}S</span>{/if}
|
||||
</div>
|
||||
<button class="sidebar-close" onclick={closeSidebar}>✕</button>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-body">
|
||||
{#if sidebar.loading}
|
||||
<div class="sidebar-loading">
|
||||
<Spinner size="lg" label="Analyzing tickers…" />
|
||||
</div>
|
||||
{:else if sidebar.error}
|
||||
<div class="sidebar-error">{sidebar.error}</div>
|
||||
{:else if sidebar.analysis}
|
||||
{@const a = sidebar.analysis}
|
||||
<div class="sb-sentiment-row">
|
||||
<span class="sentiment-pill" data-sentiment={a.sentiment}>{a.sentiment}</span>
|
||||
</div>
|
||||
<p class="sb-summary">{a.summary}</p>
|
||||
|
||||
<h3 class="sb-sub">Affected Industries</h3>
|
||||
<div class="sb-list">
|
||||
{#each a.affectedIndustries ?? [] as ind}
|
||||
<div class="sb-item">
|
||||
<span class="sb-name">{ind.name}</span>
|
||||
<span class="sb-reason">{ind.reason}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<h3 class="sb-sub">Related Tickers to Watch</h3>
|
||||
<div class="sb-list">
|
||||
{#each a.relatedTickers ?? [] as rt}
|
||||
<div class="sb-item">
|
||||
<span class="sb-name ticker">{rt.ticker}</span>
|
||||
<span class="sb-reason">{rt.reason}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</aside>
|
||||
{/if}
|
||||
<AnalysisSidebar {sidebar} onClose={() => sidebar = { ...sidebar, open: false }} />
|
||||
|
||||
<style>
|
||||
/* ── Page ── unique to this route ──────────────────────────────── */
|
||||
.page { max-width: 1400px; padding-bottom: 60px; }
|
||||
|
||||
/* ── Toolbar ────────────────────────────────────────────────────── */
|
||||
.toolbar { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
|
||||
.toolbar-top { display: flex; align-items: center; gap: 8px; }
|
||||
.search-row { display: flex; gap: 8px; align-items: center; }
|
||||
/* ── Toolbar ─────────────────────────────────────────────────────── */
|
||||
.toolbar { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
|
||||
.toolbar-top { display: flex; align-items: center; gap: 8px; }
|
||||
.search-row { display: flex; gap: 8px; align-items: center; }
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
@@ -391,18 +205,19 @@
|
||||
letter-spacing: 0.02em;
|
||||
outline: none;
|
||||
transition: border-color var(--transition);
|
||||
}
|
||||
input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px #3b82f620; }
|
||||
|
||||
/* btn-search-toggle — page-specific ghost variant */
|
||||
&:focus { border-color: var(--blue); box-shadow: 0 0 0 2px #3b82f620; }
|
||||
}
|
||||
|
||||
.btn-search-toggle {
|
||||
background: var(--bg-card);
|
||||
color: var(--text-dim);
|
||||
border: 1px solid var(--border-input);
|
||||
font-size: 12px;
|
||||
padding: 8px var(--space-lg);
|
||||
|
||||
&:hover { background: #263347; color: var(--text-muted); }
|
||||
}
|
||||
.btn-search-toggle:hover { background: #263347; color: var(--text-muted); }
|
||||
|
||||
.screened-at {
|
||||
margin-left: auto;
|
||||
@@ -410,190 +225,8 @@
|
||||
color: var(--text-dimmer);
|
||||
}
|
||||
|
||||
/* ── Market Context Strip ───────────────────────────────────────── */
|
||||
.ctx-strip {
|
||||
display: flex;
|
||||
gap: 1px;
|
||||
background: var(--border);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ctx-chip {
|
||||
flex: 1;
|
||||
min-width: 70px;
|
||||
background: var(--bg-base);
|
||||
padding: 10px var(--space-lg);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.ctx-label {
|
||||
font-size: var(--fs-2xs);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-dimmer);
|
||||
}
|
||||
|
||||
.ctx-val {
|
||||
font-size: var(--fs-lg);
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.ctx-regime[data-regime="HIGH"] { color: var(--red); }
|
||||
.ctx-regime[data-regime="NORMAL"] { color: var(--text-muted); }
|
||||
.ctx-regime[data-regime="LOW"] { color: var(--green); }
|
||||
|
||||
/* ── Score cell ─────────────────────────────────────────────────── */
|
||||
.score-cell {
|
||||
color: var(--text-dim);
|
||||
font-size: var(--fs-sm);
|
||||
max-width: 140px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* ── Risk flags ─────────────────────────────────────────────────── */
|
||||
.flags { display: flex; flex-direction: column; gap: 2px; }
|
||||
.flag { color: var(--orange); font-size: var(--fs-sm); }
|
||||
|
||||
/* ── Error list ─────────────────────────────────────────────────── */
|
||||
/* ── Error list ──────────────────────────────────────────────────── */
|
||||
.error-list { padding: 12px var(--space-xl); display: flex; flex-direction: column; gap: 6px; }
|
||||
.error-item { color: var(--text-dim); font-size: 12px; }
|
||||
.error-item :global(.ticker) { color: var(--red); font-weight: 700; margin-right: 8px; }
|
||||
|
||||
/* ── LLM Sidebar ────────────────────────────────────────────────── */
|
||||
.sidebar-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: #00000055;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
top: 0; right: 0; bottom: 0;
|
||||
width: 380px;
|
||||
background: var(--bg-surface);
|
||||
border-left: 1px solid var(--blue-surface);
|
||||
z-index: 101;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px var(--space-xl);
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--blue-badge);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: var(--fs-md);
|
||||
font-weight: 700;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.sidebar-type {
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
background: var(--blue-surface);
|
||||
color: var(--blue-muted);
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--radius-pill);
|
||||
}
|
||||
|
||||
.sidebar-close {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-dimmer);
|
||||
font-size: 14px;
|
||||
padding: 4px 8px;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-xs);
|
||||
}
|
||||
.sidebar-close:hover { color: var(--text-muted); background: var(--bg-card); }
|
||||
|
||||
.sidebar-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: var(--space-xl);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.sidebar-loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
padding: 60px 0;
|
||||
}
|
||||
|
||||
.sidebar-error {
|
||||
color: var(--red);
|
||||
background: var(--red-bg);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 12px var(--space-lg);
|
||||
font-size: var(--fs-md);
|
||||
}
|
||||
|
||||
.sb-sentiment-row { display: flex; align-items: center; gap: 8px; }
|
||||
|
||||
.sb-summary {
|
||||
font-size: var(--fs-md);
|
||||
color: var(--text-muted);
|
||||
line-height: 1.6;
|
||||
border-left: 3px solid var(--blue-surface);
|
||||
padding-left: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sb-sub {
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--text-dimmer);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sb-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
.sb-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding: 10px 12px;
|
||||
background: var(--bg-elevated);
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.sb-name {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.sb-reason {
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--text-dim);
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script>
|
||||
import MarketContext from '$lib/MarketContext.svelte';
|
||||
import SignalBadge from '$lib/SignalBadge.svelte';
|
||||
import { sorted, verdictShort, vClass } from '$lib/utils.js';
|
||||
import VerdictPill from '$lib/VerdictPill.svelte';
|
||||
import { sorted } from '$lib/utils.js';
|
||||
|
||||
let { data } = $props();
|
||||
|
||||
@@ -72,8 +73,8 @@
|
||||
<tr>
|
||||
<td class="ticker">{r.asset.ticker}</td>
|
||||
<td class="num">{m.Price ?? '—'}</td>
|
||||
<td><span class="verdict-pill {vClass(r.inflated.label)}">{verdictShort(r.inflated.label)}</span></td>
|
||||
<td><span class="verdict-pill {vClass(r.fundamental.label)}">{verdictShort(r.fundamental.label)}</span></td>
|
||||
<td><VerdictPill label={r.inflated.label} /></td>
|
||||
<td><VerdictPill label={r.fundamental.label} /></td>
|
||||
<td class="num">{m['Exp Ratio%'] ?? '—'}</td>
|
||||
<td class="num">{m['Yield%'] ?? '—'}</td>
|
||||
<td class="num">{m['AUM'] ?? '—'}</td>
|
||||
@@ -113,8 +114,8 @@
|
||||
<tr>
|
||||
<td class="ticker">{r.asset.ticker}</td>
|
||||
<td class="num">{m.Price ?? '—'}</td>
|
||||
<td><span class="verdict-pill {vClass(r.inflated.label)}">{verdictShort(r.inflated.label)}</span></td>
|
||||
<td><span class="verdict-pill {vClass(r.fundamental.label)}">{verdictShort(r.fundamental.label)}</span></td>
|
||||
<td><VerdictPill label={r.inflated.label} /></td>
|
||||
<td><VerdictPill label={r.fundamental.label} /></td>
|
||||
<td class="num">{m['YTM%'] ?? '—'}</td>
|
||||
<td class="num">{m['Duration'] ?? '—'}</td>
|
||||
<td class="num">{m['Rating'] ?? '—'}</td>
|
||||
@@ -168,8 +169,8 @@
|
||||
<td class="ticker">{r.asset.ticker}</td>
|
||||
<td class="num">{m.Price ?? '—'}</td>
|
||||
<td><SignalBadge signal={r.signal} /></td>
|
||||
<td><span class="verdict-pill {vClass(r.inflated.label)}">{verdictShort(r.inflated.label)}</span></td>
|
||||
<td><span class="verdict-pill {vClass(r.fundamental.label)}">{verdictShort(r.fundamental.label)}</span></td>
|
||||
<td><VerdictPill label={r.inflated.label} /></td>
|
||||
<td><VerdictPill label={r.fundamental.label} /></td>
|
||||
<td class="num">{m['Exp Ratio%'] ?? '—'}</td>
|
||||
<td class="num">{m['Yield%'] ?? '—'}</td>
|
||||
<td class="num">{m['AUM'] ?? '—'}</td>
|
||||
@@ -209,8 +210,8 @@
|
||||
<td class="ticker">{r.asset.ticker}</td>
|
||||
<td class="num">{m.Price ?? '—'}</td>
|
||||
<td><SignalBadge signal={r.signal} /></td>
|
||||
<td><span class="verdict-pill {vClass(r.inflated.label)}">{verdictShort(r.inflated.label)}</span></td>
|
||||
<td><span class="verdict-pill {vClass(r.fundamental.label)}">{verdictShort(r.fundamental.label)}</span></td>
|
||||
<td><VerdictPill label={r.inflated.label} /></td>
|
||||
<td><VerdictPill label={r.fundamental.label} /></td>
|
||||
<td class="num">{m['YTM%'] ?? '—'}</td>
|
||||
<td class="num">{m['Duration'] ?? '—'}</td>
|
||||
<td class="num">{m['Rating'] ?? '—'}</td>
|
||||
|
||||
@@ -82,22 +82,6 @@ main { flex: 1; padding: 28px 32px; }
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.nav-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid var(--bg-card);
|
||||
border-top-color: var(--blue);
|
||||
border-radius: 50%;
|
||||
animation: spin 0.7s linear infinite;
|
||||
}
|
||||
|
||||
.nav-label {
|
||||
font-size: var(--fs-xs);
|
||||
color: var(--text-dimmer);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
// ── Shared loading area ───────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user