You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 86e7798
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Personal calorie and macro tracker, shared with a few friends. Not commercial. M
28
28
-`goals` holds one row per user (calories as a ceiling, protein, fluid_ml, creatine_g), own-row RLS. A null goal means off: protein loses its goal bar, and fluids and creatine disappear from the summary (creatine's Trends card also disappears; Fluids' Trends chart stays, without a goal line). With no row the app uses only a calorie ceiling of 2000, everything else off. Standard supplement foods are in `supabase/seed_supplements.sql`.
29
29
-`profiles` holds one row per user (birth_year, sex male/female/other, height_cm, weight_kg, units us/metric, activity, aim), own-row RLS; always stored metric. It is written by the Goals sheet's collapsed "Help me choose" helper (`helperCompute()`), which prefills from it. The helper uses Mifflin-St Jeor x activity (1.2/1.375/1.55/1.725), "Other" averages the sex term (-78) and floors (1,500 / 1,200 / 1,350 cal); aims are lose slowly -10% (protein 2.0 g/kg), lose faster -20% (2.2), maintain (1.6), build muscle +10% (2.0); fluids 35 ml/kg; protein and fluids use the weight for a BMI of 25 when the person is heavier. "Fill in my goals" fills and switches on calories, protein and fluids (never creatine) and saves the profile; only "Save goals" saves goals. Under 18 it refuses. Guests keep the profile in the stand-in and it merges on sign-in if the account has none.
30
30
- The Trends tab (ruled sections for calories, protein, fluids, carbs and fat, creatine dots and alcohol) reads the `daily_totals` view; charts are inline SVG drawn by `drawTrendChart()` / `drawDotStrip()`, not a library. `renderTrends()` writes each card's shell (`trendCardShell()`), then hands its parts to one renderer per kind, picked by `trendCardKind()` from `TREND_RENDERERS` (`renderGoalCard`, `renderStackCard`, `renderWeightCard`, `renderCreatineCard`, `renderAlcoholByDay`, `renderAlcoholCalendar`); a new card kind is a new renderer there. Bars: amber counts toward or met a goal, crimson is over the calorie limit, short of a floor goal is a pale bar with a dark 3px cap at the value (`--miss` body, `--miss-cap`; the cap carries the contrast, so missed days stay quiet); today is a dashed outline (unfinished) unless already over or met. Alcohol counts a day with nothing logged as 0 drinks (it has no bar or circle, but counts as 0 in averages and totals; the foot says so). On 7 days it is bars by day with a 7-day average line (like the goal charts). On 4 weeks it is a calendar like creatine's (`drawAlcoholCalendar()`): a filled circle with the number on drink days, a pale ring on dry logged days, a tiny dot on unlogged days, and each week's total on the right. A week's total is the drinks actually logged (the current week's so far), shown as "13*" when some past days of it were not logged and "—" when none were. "avg a week" is the mean of the finished weeks' totals on screen (no line). Tapping a day or a week total fills the readout. Creatine is dots: one row on 7 days, a calendar on 4 weeks (whole Monday-to-Sunday weeks around the window, so 4 or 5 rows; padding days count like any other, future days are empty; weeks are Monday-first everywhere, as in the alcohol calendar; both use `calendarDays()`); its header shows days at goal and the current streak (`creatineStreak`, counted back from today or yesterday, regardless of the window).
31
-
- Trends has a third range, **Year** (`trendDays === 'year'`, `trendYear` null for the last 52 weeks or a calendar year; `yearWeeks()`, `setTrendNav()`). The default is the last 52 weeks ("Past year"); back goes to the last full calendar year (the weeks whose Monday is in it), then a year at a time down to the year of the first entry or weigh-in (`trendFirstDate`); forward from the latest full year returns to the last 52 weeks. Cards not in `YEAR_CARDS` are hidden on Year. Calories, protein and fluids are one bar per Monday-to-Sunday week (`renderGoalYear()`): the average a day over its logged days, today left out, coloured against today's goal (goals have no history), pale (`.tb-thin`) under `THIN_WEEK_DAYS` (3) logged days, the current week dashed. Weight on Year is one dot per week (the average of that week's real weigh-ins; no weigh-ins, no dot) and a 4-week average line (`weightAvgOn(known, d, 28)` at the week's last day, or its latest weigh-in), chosen because a year of daily dots was too crowded and a 7-day line on weekly dots adds nothing. Its Year tiles are change and pace (a week) along the 4-week line, plus distance to goal on the last 52 weeks only (no "latest": it ignores the window). On desktop (`(hover: hover) and (pointer: fine)`), hovering any Trends bar, dot or week previews it in that card as a tap would (`previewTrendCard()`, which re-renders one card with `renderTrendCard()`); leaving the card restores the pinned selection. Each card's readout is never empty (`setReadout()`): with nothing hovered or tapped it shows the latest item dimmed and without links ("Today", "This week", the latest weigh-in, or the window's last day or week), and it reserves two lines on phones (one on desktop, where every readout fits one line at 900px), so the chart never moves. Week labels are "Oct 12–18" or "This week" (`weekLabel()`). Both use a month axis (`monthAxis()`, chosen by `chartDayAxis()` for more than 31 items). The range label is "Past year" or the year, since dates do not fit beside three tabs on a 375px phone.
31
+
- Trends has a third range, **Year** (`trendDays === 'year'`, `trendYear` null for the last 52 weeks or a calendar year; `yearWeeks()`, `setTrendNav()`). The default is the last 52 weeks ("Past year"); back goes to the last full calendar year (the weeks whose Monday is in it), then a year at a time down to the year of the first entry or weigh-in (`trendFirstDate`); forward from the latest full year returns to the last 52 weeks. Cards not in `YEAR_CARDS` are hidden on Year. Carbs and fat are stacked weekly averages (`renderStackYear()`); both share `yearWeekStats()`. Calories, protein and fluids are one bar per Monday-to-Sunday week (`renderGoalYear()`): the average a day over its logged days, today left out, coloured against today's goal (goals have no history), pale (`.tb-thin`) under `THIN_WEEK_DAYS` (3) logged days, the current week dashed. Weight on Year is one dot per week (the average of that week's real weigh-ins; no weigh-ins, no dot) and a 4-week average line (`weightAvgOn(known, d, 28)` at the week's last day, or its latest weigh-in), chosen because a year of daily dots was too crowded and a 7-day line on weekly dots adds nothing. Its Year tiles are change and pace (a week) along the 4-week line, plus distance to goal on the last 52 weeks only (no "latest": it ignores the window). On desktop (`(hover: hover) and (pointer: fine)`), hovering any Trends bar, dot or week previews it in that card as a tap would (`previewTrendCard()`, which re-renders one card with `renderTrendCard()`); leaving the card restores the pinned selection. Each card's readout is never empty (`setReadout()`): with nothing hovered or tapped it shows the latest item dimmed and without links ("Today", "This week", the latest weigh-in, or the window's last day or week), and it reserves two lines on phones (one on desktop, where every readout fits one line at 900px), so the chart never moves. Week labels are "Oct 12–18" or "This week" (`weekLabel()`). Both use a month axis (`monthAxis()`, chosen by `chartDayAxis()` for more than 31 items). The range label is "Past year" or the year, since dates do not fit beside three tabs on a 375px phone.
32
32
-`daily_totals` has no rows for days with no entries, so empty days are naturally skipped.
33
33
- Accessibility: pinch-zoom stays on (keep inputs at 16px or more so iOS does not zoom on focus); every icon-only button has an `aria-label`; one `:focus-visible` ring for all controls; sheets take focus when they open and hand it back on close (not to text fields); `prefers-reduced-motion` turns transitions off. An axe-core scan of Today, the edit sheet and Trends was clean in both themes (Nov 2026).
34
34
- Security lives in RLS, not in the client. Any new table needs RLS enabled and policies written before it is used.
0 commit comments