car-diagnostic-agent / ui /header.py
aldsouza's picture
Fix
04614e6
Raw
History Blame Contribute Delete
1.32 kB
"""Cockpit header HTML for the diagnostic HUD."""
from __future__ import annotations
from pathlib import Path
_PROJECT_ROOT = Path(__file__).resolve().parent.parent
_LOGO_PATH = _PROJECT_ROOT / "assets" / "logo.svg"
def _load_logo_markup() -> str:
if _LOGO_PATH.is_file():
return _LOGO_PATH.read_text(encoding="utf-8").strip()
return (
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="44" height="44">'
'<rect width="64" height="64" rx="12" fill="#111820"/>'
'<text x="32" y="38" text-anchor="middle" font-family="monospace" font-size="14" fill="#00d4ff">CDA</text>'
"</svg>"
)
def render_cockpit_header() -> str:
logo = _load_logo_markup()
return f"""
<div class="cockpit-header">
<div class="cockpit-header__logo">{logo}</div>
<div class="cockpit-header__titles">
<h1 class="cockpit-header__title">DIAGNOSTIC HUD</h1>
<p class="cockpit-header__subtitle">
AI-assisted OBD diagnostics 路 ELM327 car emulator 路 live vitals every 10s
</p>
</div>
<div class="cockpit-header__meta">
<span class="cockpit-header__badge">Toyota Auris Hybrid 路 2012</span>
<span class="cockpit-header__status">
<span class="cockpit-header__status-dot"></span>
SYSTEM ONLINE
</span>
</div>
</div>
""".strip()