1
0
This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Timmy-time-dashboard/src/dashboard/templates/macros.html
Alexander Whitestone 622a6a9204 polish: extract inline CSS, add connection status, panel macro, favicon, ollama cache, toast system (#164)
Major:
- Extract all inline <style> blocks from 22 Jinja2 templates into
  static/css/mission-control.css — single cacheable stylesheet
- Add tox lint check that fails on inline <style> in templates

Minor:
1. Connection status indicator in topbar (green/amber/red dot) reflecting
   WebSocket + Ollama reachability, with auto-reconnect
2. Jinja2 {% macro panel(title) %} in macros.html — eliminates repeated
   .card.mc-panel markup; index.html converted as example
3. SVG favicon (purple T + orange dot)
4. 30-second TTL cache on _check_ollama() to avoid blocking the event loop
   on every health poll (asyncio.to_thread was already in place)
5. Toast notification system (McToast.show) for transient status messages —
   wired into connection status for Ollama/WebSocket state changes

Enforcement:
- CLAUDE.md updated with conventions 11-14 (no inline CSS, use panel macro,
  use toasts, never block the event loop)
- tox lint + pre-push environments now fail on inline <style> blocks

https://claude.ai/code/session_014FQ785MQdyJQ4BAXrRSo9w

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-11 09:52:57 -04:00

29 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{# ── Reusable component macros ─────────────────────────────
Usage:
{% from "macros.html" import panel %}
{% call panel("SYSTEM HEALTH") %}
<p>Content here</p>
{% endcall %}
Optional kwargs:
id element id for HTMX targeting
classes extra CSS classes on the outer card
hx_get HTMX polling endpoint
hx_trigger HTMX trigger (default: none)
hx_target HTMX swap target (default: "this")
hx_swap HTMX swap strategy (default: "innerHTML")
#}
{% macro panel(title, id="", classes="", hx_get="", hx_trigger="", hx_target="this", hx_swap="innerHTML") %}
<div class="card mc-panel {{ classes }}"
{%- if id %} id="{{ id }}"{% endif %}
{%- if hx_get %} hx-get="{{ hx_get }}"{% endif %}
{%- if hx_trigger %} hx-trigger="{{ hx_trigger }}"{% endif %}
{%- if hx_get %} hx-target="{{ hx_target }}" hx-swap="{{ hx_swap }}"{% endif %}>
<div class="card-header mc-panel-header">// {{ title }}</div>
<div class="card-body p-3">
{{ caller() }}
</div>
</div>
{% endmacro %}