{# Shared by the health pages: header (⌂ 📅 … ··· Health ··· ⚙), under it the tabs Overview|Body|Sleep|Heart|Activity; a floating + = Measurements,
number formats, the measurement dialog (health.js). Import "with context" (uses v). #}
{% from "_header.html" import nav_btns, settings_btn, title_block, subline, section_tabs %}
{% from "health/_watch.html" import hm %}
{% macro n(x, d=1) %}{% if x is none %}—{% else %}{{ ("%." ~ d ~ "f") | format(x) }}{% endif %}{% endmacro %}
{% macro sgn(x, d=1) %}{{ "+" if x > 0 else ("−" if x < 0 else "±") }}{{ ("%." ~ d ~ "f") | format(x | abs) }}{% endmacro %}
{% macro dm(d) %}{{ d.day }} {{ d.strftime("%b") }}{{ " " ~ d.year if d.year != v.today.year }}{% endmacro %}
{# hover strips: one per bucket, health.js shows its tip (+ click opens data-href) #}
{% macro hits(c, href=None) %}
Nothing in this period.
{% endif %} {% endmacro %} {# sleep window: one bar per night from bedtime to wake-up (watch.window_chart) #} {% macro window(c, href=None) %} {% if c %} {% else %}Nothing in this period.
{% endif %} {% endmacro %} {# range + grouping switches; links keep the other query values #} {% macro qs(r=None, g=None) %}?{% set q = dict(request.args) %}{% if r %}{% set _ = q.update(r=r) %}{% endif %}{% if g %}{% set _ = q.update(g=g) %}{% endif %}{{ q | urlencode }}{% endmacro %} {% macro ranges() %}… and {{ n }} more — pick a shorter period to see them.
{% endif %}{% endmacro %} {% macro assets() %} {% endmacro %} {# add = what the floating + opens on this tab ("measure", "bp", "ox"); hovering it lists all three (adder() — the dialog, with a tab per kind) #} {% macro head(sub, add="measure") %} {% set ADD_KINDS = [("measure", "Body measurements"), ("bp", "Blood pressure"), ("ox", "Blood oxygen")] %}| {{ z.name }} {% if z.from %}{{ z.from }}{{ ("–" ~ z.to) if z.to else "+" }}{% else %}< {{ z.to + 1 }}{% endif %} | {{ (z.sec // 60) }} min · {{ z.pct }} % |
No heart rate recorded for this workout.
{% endif %} {% endmacro %}