""" CRE dashboard (spec §11) — SKELETON STUB. Step 4, not yet implemented. The continuing agent should build the real dashboard here per the design brief (Build Log Entry 003 + decision D10) and HANDOFF.md §1: • Dark theme, Nunito font, SVG logo + uniform SVG animations, `Ver. 1.0` tag, live status badges, Title Case labels, responsive. • 4 tabs: Signals (conviction-ranked, colored tags 🟣🟢🟡⚪, Chart + TV links), Market, Performance (spec §7 analytics), Health. • Live updates via gr.Timer — NO page refresh (D10). CONTRACT (app.py depends on this): expose `build(get_state)` returning a `gr.Blocks`. `get_state` is a zero-arg callable returning the live workers.UniverseState (or None during boot). app.py already lazy-imports this and falls back to its built-in placeholder UI if `build` raises — so the app keeps running until this is finished. Read data via store.db helpers: db.recent_signals(), db.active_signals(), db.latest_snapshots(), db.liq_baseline_days(symbol), db.query(sql, params) Conviction tag colors live in alerts/telegram._TAG_EMOJI; mirror them as CSS accent colors (Elite=violet, Strong=green, Moderate=amber, Watch=grey). """ from __future__ import annotations import gradio as gr import config from store import db # Conviction tag → accent color (use for colored tags in the Signals tab) TAG_COLORS = {"elite": "#a855f7", "strong": "#22c55e", "moderate": "#eab308", "watch": "#9ca3af"} def _status_md() -> str: """Minimal live status — placeholder until the full 4-tab UI is built.""" try: n_sig = len(db.recent_signals(100000)) n_active = len(db.active_signals()) n_mkt = len(db.latest_snapshots()) except Exception: n_sig = n_active = n_mkt = 0 return ( f"### 🚀 Confluence Reversal Engine — Ver. 1.0\n" f"_Dashboard skeleton — full 4-tab UI is the remaining Step 4 (see HANDOFF.md)._\n\n" f"- Signals Logged: **{n_sig}** · Active: **{n_active}**\n" f"- Market Snapshots: **{n_mkt}**\n" f"- Alerts: **{'On' if config.ALERTS_ENABLED else 'Off'}**" ) def build(get_state) -> gr.Blocks: """Return the dashboard Blocks. STUB: status + live timer only. Replace the body with the full themed 4-tab dashboard. Keep this signature. """ with gr.Blocks(title="CRE v1.0", theme=gr.themes.Base()) as demo: status = gr.Markdown(_status_md()) timer = gr.Timer(5.0) timer.tick(_status_md, outputs=status) return demo