Initial commit with webpage

This commit is contained in:
bkelldog committed 2026-11-06 11:42:34 -05:00
commit 26875de1dd
55 files changed
+5726

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
{% extends "base.html" %}
{% import "macros.html" as ui %}
{% block title %}Trends{% endblock %}
{% block content %}
<nav class="segmented" aria-label="Date range">
{% for r in ranges %}
<a href="/trends?days={{ r }}" {% if r == days %}aria-current="true"{% endif %}>Last {{ r }} days</a>
{% endfor %}
</nav>
<section class="tiles" aria-label="Averages">
<div class="tile">
<p class="tile-label"><span class="dot cat-feeding"></span>Feeds a day</p>
<p class="tile-value">{{ '%.1f' % avg.feeds if avg.feeds is not none else '–' }}</p>
<p class="tile-sub">average, full days only</p>
</div>
<div class="tile">
<p class="tile-label"><span class="dot cat-feeding"></span>Between feeds</p>
<p class="tile-value">{{ f.duration(median_interval * 60) if median_interval else '–' }}</p>
<p class="tile-sub">typical (median), start to start</p>
</div>
<div class="tile">
<p class="tile-label"><span class="dot cat-sleep"></span>Sleep a day</p>
<p class="tile-value">{{ f.duration(avg.sleep_min * 60) if avg.sleep_min is not none else '–' }}</p>
<p class="tile-sub">average, full days only</p>
</div>
<div class="tile">
<p class="tile-label"><span class="dot cat-sleep"></span>Longest sleep</p>
<p class="tile-value">{{ f.duration(longest.longest_sleep_min * 60) if longest else '–' }}</p>
<p class="tile-sub">{{ f.day(longest.day, today) if longest else 'none yet' }}</p>
</div>
</section>
<section class="card">
<div class="card-head">
<div>
<h2>Daily rhythm</h2>
<p class="muted small">Each row is one day, midnight to midnight. Hover or tap a mark for details.</p>
</div>
{{ ui.rhythm_legend() }}
</div>
{{ ui.rhythm_chart(rows, f) }}
</section>
<div class="chart-grid">
{% for c in charts %}{{ ui.column_chart(c) }}{% endfor %}
</div>
<section class="card">
<details>
<summary><h2>Table</h2><span class="muted small">The same numbers, day by day</span></summary>
<div class="table-scroll">
<table class="num-table">
<thead><tr><th scope="col">Day</th><th scope="col">Feeds</th><th scope="col">Sleep</th><th scope="col">Longest</th><th scope="col">Wet</th><th scope="col">Dirty</th><th scope="col">Pumping</th></tr></thead>
<tbody>
{% for d in stats %}
<tr>
<th scope="row">{{ f.day(d.day, today) }}{% if (today - d.day).days >= 7 %}{% else %} <span class="muted">{{ d.day.strftime('%b') }} {{ d.day.day }}</span>{% endif %}</th>
<td>{{ d.feeds }}</td>
<td>{{ f.duration(d.sleep_min * 60) if d.sleep_min else '–' }}</td>
<td>{{ f.duration(d.longest_sleep_min * 60) if d.longest_sleep_min else '–' }}</td>
<td>{{ d.wet }}</td>
<td>{{ d.dirty }}</td>
<td>{{ d.pump }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="muted small">A feed is every feeding press within {{ 30 }} minutes of the one before (left then right side counts once). Sleep that crosses midnight counts toward both days.</p>
</details>
</section>
{% endblock %}