{# Reusable pieces. Import with: {% import "macros.html" as ui %} #} {% macro alerts(items) %} {% for a in items %}
{{ {'info': 'Note', 'warning': 'Heads up', 'serious': 'Important'}[a.level] }}: {{ a.text }}{% if a.href %} {{ a.link_text or 'Details' }}{% endif %}
{% endfor %} {% endmacro %} {% macro event_row(ev, f, now, show_day=false) %}
  • {{ ev.kind.label }} {% if ev.kind.is_duration %} {% if ev.ended_at %}until {{ f.time(ev.ended_at) }} · {{ f.duration(ev.duration.total_seconds()) }} {% else %}in progress · {{ f.duration((now - ev.started_at).total_seconds()) }}{% endif %} {% endif %} {% if ev.note %}{{ ev.note }}{% endif %} {%- if ev.source == 'device' %}B{{ ev.button }}{% else %}web{% endif -%} {%- if ev.clock_corrected %} ⏱{% endif -%} Edit
  • {% endmacro %} {% macro rhythm_legend() %} {% endmacro %} {% macro rhythm_chart(rows, f, compact=false) %}
    {% for row in rows %}
    {% if not compact %}{{ f.day_short(row.day) }}{% endif %}
    {% for m in row.marks %} {% if m.shape == 'bar' %} {% else %} {% endif %} {% endfor %} {% if row.now_pct is not none %}{% endif %}
    {% endfor %}
    {% endmacro %} {% macro column_chart(c) %}

    {{ c.title }}

    {{ c.summary }}

    {% endmacro %} {% macro battery_chart(c) %} {% if c.empty %}

    No battery readings in this period yet.

    {% else %}
    {% for t in c.yticks %}{{ t.label }}{% endfor %}
    {% endif %} {% endmacro %}