Track food eaten by weight in grams
Logging a meal now opens the dialog (like weigh-ins) with an optional Amount (g) field; existing meals can get an amount via the edit dialog, where clearing the field drops it. The overview's Meals tile shows the day's total grams, and the weekly card gains a Food (grams) chart with a self-scaling axis that stays hidden until any meal has an amount. Events carry a new grams field (REAL column, auto-migrated); addEvent's growing optional parameters are folded into an options object.
This commit is contained in:
@@ -128,6 +128,7 @@
|
||||
<div class="stat">
|
||||
<div class="stat-label">Meals</div>
|
||||
<div class="stat-value" id="stat-meals">0</div>
|
||||
<div class="stat-sub" id="stat-meals-grams" hidden></div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat-label">Pees</div>
|
||||
@@ -189,6 +190,10 @@
|
||||
<span class="lg eat"><span class="sw"></span>Meals</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart" id="grams-chart-wrap" hidden>
|
||||
<div class="chart-title">Food (grams)</div>
|
||||
<svg id="chart-grams" class="chart-svg" viewBox="0 0 320 160" role="img" aria-label="Grams of food eaten per day for the last 7 days"></svg>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="patterns" data-panel="sleep-timeline">
|
||||
@@ -320,6 +325,9 @@
|
||||
<label id="note-weight-field" hidden>Weight (kg)
|
||||
<input type="number" id="note-weight" inputmode="decimal" step="0.01" min="0" placeholder="e.g. 5.2" />
|
||||
</label>
|
||||
<label id="note-grams-field" hidden>Amount (g)
|
||||
<input type="number" id="note-grams" inputmode="numeric" step="1" min="0" placeholder="e.g. 80 — leave empty if unknown" />
|
||||
</label>
|
||||
<label>Note
|
||||
<textarea id="note-input" rows="4" placeholder="e.g. pee was instant, poo took 5min, ate 300g raw food"></textarea>
|
||||
</label>
|
||||
@@ -348,6 +356,9 @@
|
||||
<label id="edit-weight-field" hidden>Weight (kg)
|
||||
<input type="number" id="edit-weight" inputmode="decimal" step="0.01" min="0" />
|
||||
</label>
|
||||
<label id="edit-grams-field" hidden>Amount (g)
|
||||
<input type="number" id="edit-grams" inputmode="numeric" step="1" min="0" />
|
||||
</label>
|
||||
<label>Note
|
||||
<textarea id="edit-note" rows="4"></textarea>
|
||||
</label>
|
||||
|
||||
Reference in New Issue
Block a user