chore(release): v1.4.27

v1.4.27 — Mobile capability and maintainer-finding cleanup.

ResponsiveSheet primitive (bottom-sheet on narrow viewports, centred dialog on desktop)
applied to BD, Weight, Glucose, Mood, Activity forms. Maintainer-finding cleanups across
Coach, Insights, Reports, Privacy. GeoLite2 offline geocoding with resilience layer
(graceful fallback when EULA not yet propagated). E2E gap-fill coverage. 450-line
release notes attached to the GitHub Release.
This commit is contained in:
Marc-André Bombeck authored and GitHub committed 2026-05-15 22:59:10 +02:00
1 parent d98e85cd03
commit 4f09c3f862
314 files changed
+26801 -4419

No files matched your search

+125 -46
View File
@@ -20,6 +20,10 @@ interface ComplianceHeatmapProps {
const CELL_SIZE = 18;
const GAP = 3;
// v1.4.27 MB7 / CF-10 — cell-floor so the static heatmap never paints
// below the touch-friendly 14 px square on narrow viewports. The
// stretch branch computes an adaptive size; both branches clamp here.
const CELL_FLOOR_PX = 14;
function getColor(data: DailyData): string {
if (data.expected === 0) return "var(--secondary)";
@@ -57,8 +61,13 @@ function getColor(data: DailyData): string {
}
function formatDateDE(dateStr: string): string {
const d = new Date(dateStr + "T00:00:00");
return `${d.getDate()}.${d.getMonth() + 1}.${d.getFullYear()}`;
// v1.4.27 B7 / BL-P4-2 — parse the day-key against UTC so the
// formatted tooltip label matches the dateKey computation below
// (which uses `toISOString().slice(0, 10)`). Without the UTC
// anchor an SSR server in a non-Berlin timezone could format the
// tick a day off the dateKey it sits under.
const d = new Date(dateStr + "T00:00:00Z");
return `${d.getUTCDate()}.${d.getUTCMonth() + 1}.${d.getUTCFullYear()}`;
}
export function ComplianceHeatmap({
@@ -73,8 +82,36 @@ export function ComplianceHeatmap({
x: number;
y: number;
text: string;
/**
* v1.4.27 MB7 / CF-10 — when `pinned` the tooltip stays mounted
* across `onPointerLeave` so a touch user sees the per-cell
* breakdown after lifting their finger. Mouse + pen users get the
* existing hover-only experience because their interactions never
* set `pinned`. A second tap on a different cell repositions the
* tooltip; a tap outside any cell clears it (wired below).
*/
pinned?: boolean;
} | null>(null);
// v1.4.27 MB7 / CF-10 — outside-click dismisses a pinned tooltip so a
// touch user can clear the per-cell detail without scrolling the
// pinned label off-screen. The listener is gated on `tooltip?.pinned`
// so the non-touch hover flow never pays the indirection cost.
useEffect(() => {
if (!tooltip?.pinned) return;
const handlePointer = (event: PointerEvent) => {
const container = containerRef.current;
if (!container) return;
if (!container.contains(event.target as Node)) {
setTooltip(null);
}
};
document.addEventListener("pointerdown", handlePointer, true);
return () => {
document.removeEventListener("pointerdown", handlePointer, true);
};
}, [tooltip?.pinned]);
const WEEKDAY_LABELS = [
t("charts.weekdays.mon"),
"",
@@ -133,9 +170,16 @@ export function ComplianceHeatmap({
dates.push(date);
}
// Start from the first date, align to Monday
// Start from the first date, align to Monday.
//
// v1.4.27 B7 / BL-P4-2 — read every weekday + month boundary off
// the UTC accessor pair (`getUTCDay`, `getUTCMonth`) so the
// computation matches the dateKey, which is also UTC-anchored
// (`toISOString().slice(0, 10)`). Reading in server-tz here would
// shift the Monday-alignment + month-marker placement when the
// SSR pass runs on a server in a non-Berlin timezone.
const firstDate = dates[0];
const firstDow = (firstDate.getDay() + 6) % 7; // Monday = 0
const firstDow = (firstDate.getUTCDay() + 6) % 7; // Monday = 0
let col = 0;
const markers: Array<{ col: number; label: string }> = [];
@@ -143,7 +187,7 @@ export function ComplianceHeatmap({
for (let i = 0; i < dates.length; i++) {
const date = dates[i];
const dow = (date.getDay() + 6) % 7; // Monday = 0
const dow = (date.getUTCDay() + 6) % 7; // Monday = 0
const currentCol = Math.floor((i + firstDow) / 7);
const row = dow;
const dateKey = date.toISOString().slice(0, 10);
@@ -154,7 +198,7 @@ export function ComplianceHeatmap({
};
// Track month boundaries
const month = date.getMonth();
const month = date.getUTCMonth();
if (month !== lastMonth) {
markers.push({ col: currentCol, label: MONTH_LABELS[month] });
lastMonth = month;
@@ -176,10 +220,13 @@ export function ComplianceHeatmap({
const labelWidth = stretch ? 0 : 76;
const headerHeight = 18;
// v1.4.27 MB7 / CF-10 — clamp the stretch-branch adaptive cell to the
// 14 px floor so the heatmap stays tap-friendly when the container
// narrows. Static (non-stretch) instances use the canonical 18 px.
const cellSize =
stretch && containerWidth > 0
? Math.max(
8,
CELL_FLOOR_PX,
(containerWidth - labelWidth - Math.max(0, weeks - 1) * GAP) /
Math.max(weeks, 1),
)
@@ -190,12 +237,20 @@ export function ComplianceHeatmap({
return (
<div className={`relative ${stretch ? "w-full" : ""}`} ref={containerRef}>
<div className={stretch ? "w-full" : "overflow-x-auto"}>
{/* v1.4.27 MB7 / CF-10 — `overflow-x-auto` on `<sm` so the heatmap
horizontal-scrolls inside its card instead of compressing the
cells below the touch floor. The stretch branch already
paints to container width on `>=sm`, so the scroll branch
only kicks in for the non-stretch (static 18 px cell) case
when the parent column is narrower than `weeks * 21 px`. */}
<div
className={stretch ? "w-full sm:w-full overflow-x-auto sm:overflow-visible" : "overflow-x-auto"}
>
<svg
width={svgWidth}
height={svgHeight}
className={stretch ? "block w-full" : "block"}
onMouseLeave={() => setTooltip(null)}
onMouseLeave={() => setTooltip((prev) => (prev?.pinned ? prev : null))}
>
{/* Month labels */}
{monthMarkers.map((m, i) => (
@@ -228,43 +283,67 @@ export function ComplianceHeatmap({
),
)}
{/* Cells */}
{cells.map((cell) => (
<rect
key={cell.dateKey}
x={labelWidth + cell.col * step}
y={headerHeight + cell.row * step}
width={cellSize}
height={cellSize}
rx={2}
fill={cell.color}
className="cursor-pointer"
onMouseEnter={(e) => {
const rate =
cell.data.expected > 0
? Math.min(
100,
Math.round(
(cell.data.taken / cell.data.expected) * 100,
),
)
: 0;
const hasTimingData =
cell.data.onTime !== undefined ||
cell.data.late !== undefined ||
cell.data.veryLate !== undefined;
const timingInfo = hasTimingData
? ` | ${cell.data.onTime ?? 0} ${t("charts.heatmapOnTime")}, ${cell.data.late ?? 0} ${t("charts.heatmapLate")}, ${cell.data.veryLate ?? 0} ${t("charts.heatmapVeryLate")}`
: "";
setTooltip({
x: e.clientX,
y: e.clientY,
text: `${formatDateDE(cell.dateKey)}: ${cell.data.taken}/${cell.data.expected} (${rate}%)${timingInfo}`,
});
}}
onMouseLeave={() => setTooltip(null)}
/>
))}
{/* Cells — v1.4.27 MB7 / CF-10: tap-to-pin tooltip in
parallel with the existing hover affordance. Mouse + pen
users keep `onPointerEnter` / `onPointerLeave`; touch
users tap the cell to pin and tap outside (or another
cell) to move/clear. `pointerType === "touch"` discriminates
so a hover dismiss never wipes a pinned tooltip. */}
{cells.map((cell) => {
const buildText = (): string => {
const rate =
cell.data.expected > 0
? Math.min(
100,
Math.round((cell.data.taken / cell.data.expected) * 100),
)
: 0;
const hasTimingData =
cell.data.onTime !== undefined ||
cell.data.late !== undefined ||
cell.data.veryLate !== undefined;
const timingInfo = hasTimingData
? ` | ${cell.data.onTime ?? 0} ${t("charts.heatmapOnTime")}, ${cell.data.late ?? 0} ${t("charts.heatmapLate")}, ${cell.data.veryLate ?? 0} ${t("charts.heatmapVeryLate")}`
: "";
return `${formatDateDE(cell.dateKey)}: ${cell.data.taken}/${cell.data.expected} (${rate}%)${timingInfo}`;
};
return (
<rect
key={cell.dateKey}
x={labelWidth + cell.col * step}
y={headerHeight + cell.row * step}
width={cellSize}
height={cellSize}
rx={2}
fill={cell.color}
className="cursor-pointer"
onPointerEnter={(e) => {
// Touch enter fires synthetically immediately before
// `pointerdown`; skip it so the pinned tooltip below
// takes precedence with its real coordinates.
if (e.pointerType === "touch") return;
setTooltip({
x: e.clientX,
y: e.clientY,
text: buildText(),
});
}}
onPointerLeave={(e) => {
if (e.pointerType === "touch") return;
setTooltip((prev) => (prev?.pinned ? prev : null));
}}
onPointerDown={(e) => {
if (e.pointerType !== "touch") return;
setTooltip({
x: e.clientX,
y: e.clientY,
text: buildText(),
pinned: true,
});
}}
/>
);
})}
</svg>
</div>
+16 -2
View File
@@ -1045,7 +1045,15 @@ export function HealthChart({
const containerClass = mini
? "bg-card border-border rounded-md border p-2"
: "bg-card border-border rounded-xl border p-4 md:p-6";
const chartHeightClass = mini ? "h-[140px]" : "h-[240px]";
// v1.4.27 MB7 / CF-43 — chart height now reads from a CSS variable
// (`--chart-height`) so consumers can override the default per-mount
// without re-styling the component. The `mini` branch keeps the
// 140 px contract; the regular branch defaults to 240 px on mobile
// and 280 px from `md:` upwards (the wider container can absorb a
// taller chart without crowding the tile strip above).
const chartHeightClass = mini
? "h-[var(--chart-height,140px)]"
: "h-[var(--chart-height,240px)] md:h-[var(--chart-height-md,280px)]";
return (
<div className={containerClass} data-slot={mini ? "chart-mini" : undefined}>
@@ -1172,11 +1180,17 @@ export function HealthChart({
) : (
<div className={`relative ${chartHeightClass}`}>
{visibleBands.length > 0 ? (
// v1.4.27 R3d MB2 — band overlay positioning fix. The
// overlay used to inset `right: 18px` while the chart
// margin is `right: 8`, so the band rectangle drifted left
// of the plotted line by 10 px on every viewport. Pin the
// overlay to the same right edge the ComposedChart uses so
// the band tracks the line exactly.
<div
className="pointer-events-none absolute"
style={{
left: `${8 + yAxisWidth}px`,
right: "18px",
right: "8px",
top: "10px",
bottom: "32px",
zIndex: 0,
@@ -191,7 +191,15 @@ interface MedicationComplianceChartProps {
export function MedicationComplianceChart({
title,
userTimezone = "Europe/Berlin",
compareBaseline,
}: MedicationComplianceChartProps) {
// v1.4.27 R4 RC3 — the prop is accepted so the dashboard can pass
// `compareBaseline={compareBaseline}` uniformly across every chart.
// The comparison overlay itself is deferred: medication compliance is
// a percentage-of-doses metric whose prior-period overlay needs a
// second window of intake events. Discard explicitly so the
// destructure is intentional rather than a missed wire-up.
void compareBaseline;
const { isAuthenticated } = useAuth();
const { t, locale } = useTranslations();
const fmt = useFormatters();
@@ -369,7 +377,7 @@ export function MedicationComplianceChart({
{isLoading ? (
<div className="flex h-48 items-center justify-center">
<Loader2 className="text-primary h-6 w-6 animate-spin" />
<Loader2 className="text-primary h-6 w-6 animate-spin motion-reduce:animate-none" />
</div>
) : !hasData ? (
<div className="text-muted-foreground flex h-48 items-center justify-center text-sm">
@@ -383,7 +391,7 @@ export function MedicationComplianceChart({
description={t("charts.emptyStateDescription")}
/>
) : (
<div className="h-[240px] touch-pan-y">
<div className="h-[var(--chart-height,240px)] md:h-[var(--chart-height-md,280px)] touch-pan-y">
<ResponsiveContainer width="100%" height="100%">
<ComposedChart
data={chartData}
+25 -10
View File
@@ -37,6 +37,8 @@ import { ChartOverlayControls } from "./chart-overlay-controls";
import { useChartOverlayPrefs } from "@/hooks/use-chart-overlay-prefs";
import { useViewportWidth } from "@/hooks/use-viewport-width";
import { chooseTickInterval } from "@/lib/charts/x-axis-density";
import { CHART_HEIGHT_PX } from "@/lib/charts/constants";
import { moodLabelKeyForScore } from "@/lib/mood/labels";
// --- Types ---
@@ -483,12 +485,16 @@ export function MoodChart({
const maxPointIndex = Math.max(0, (chartData?.length ?? 1) - 1);
// v1.4.27 B6 / BL-P6-11 — the chart axis and the mood-list cards
// share `MOOD_LABEL_KEYS` so a polishing-pass copy update lands in
// both surfaces. The shared resolver maps a numeric score back to
// the canonical key set under `mood.level*`.
const moodLabels: Record<number, string> = {
1: t("charts.moodLabel1"),
2: t("charts.moodLabel2"),
3: t("charts.moodLabel3"),
4: t("charts.moodLabel4"),
5: t("charts.moodLabel5"),
1: t(moodLabelKeyForScore(1) ?? "mood.levelLausig"),
2: t(moodLabelKeyForScore(2) ?? "mood.levelSchlecht"),
3: t(moodLabelKeyForScore(3) ?? "mood.levelOkay"),
4: t(moodLabelKeyForScore(4) ?? "mood.levelGut"),
5: t(moodLabelKeyForScore(5) ?? "mood.levelSuperGut"),
};
// v1.4.18 — emoji glyph map removed. the maintainer explicitly rejected
@@ -614,7 +620,7 @@ export function MoodChart({
<CardContent>
{isLoading ? (
<div className="flex h-48 items-center justify-center">
<Loader2 className="text-primary h-6 w-6 animate-spin" />
<Loader2 className="text-primary h-6 w-6 animate-spin motion-reduce:animate-none" />
</div>
) : !chartData?.length ? (
<div className="text-muted-foreground flex h-48 items-center justify-center text-sm">
@@ -622,14 +628,23 @@ export function MoodChart({
</div>
) : chartData.length < 3 ? (
// v1.4.16 B1a — sparse-data placeholder consistent with the
// BP/weight/pulse charts.
// BP/weight/pulse charts. Height tracks the chart strip's
// shared CHART_HEIGHT_PX so the empty state preserves the
// trend-row rhythm (v1.4.27 — was 280, now 240 to match every
// other dashboard chart card).
<ChartEmptyState
title={t("charts.emptyStateTitle")}
description={t("charts.emptyStateDescription")}
height={280}
height={CHART_HEIGHT_PX}
/>
) : (
<div className={`${mini ? "h-[140px]" : "h-[280px]"} touch-pan-y`}>
<div
className={`${
mini
? "h-[var(--chart-height,140px)]"
: "h-[var(--chart-height,240px)] md:h-[var(--chart-height-md,280px)]"
} touch-pan-y`}
>
<ResponsiveContainer width="100%" height="100%">
<ComposedChart
data={chartDataWithCompare ?? chartData}
@@ -723,7 +738,7 @@ export function MoodChart({
tickLine={false}
axisLine={false}
width={65}
tickMargin={6}
tickMargin={10}
tickFormatter={formatMoodTick}
/>
<Tooltip
@@ -82,8 +82,19 @@ export function ScatterCorrelationChart<T extends Record<string, number>>({
tooltipFormatter,
height = 250,
}: ScatterCorrelationChartProps<T>) {
// v1.4.27 MB7 / CF-37 — drop the fixed pixel height in favour of a
// responsive aspect-ratio on mobile so the chart never compresses
// below readable axes. The `aspect-square` ratio at `<sm` keeps the
// plot area as a centred square (matches Apple Health correlation
// viz); from `sm:` upwards the chart falls back to the legacy
// pixel-height contract via a 3:2 aspect-ratio fallback that
// approximates the previous 250 px shape.
return (
<div className="touch-pan-y" style={{ height }}>
<div
className="touch-pan-y aspect-square sm:aspect-[3/2] sm:h-auto"
style={{ height: undefined }}
data-explicit-height={height}
>
<ResponsiveContainer width="100%" height="100%">
<ScatterChart margin={{ top: 10, right: 20, bottom: 36, left: 12 }}>
<CartesianGrid strokeDasharray="3 3" stroke="var(--border)" />
+18 -51
View File
@@ -240,7 +240,7 @@ export function TrendCard({
className="mt-2 flex min-w-0 items-baseline gap-x-1.5"
data-slot="trend-card-value-row"
>
<span className="min-w-0 truncate text-3xl leading-none font-bold tracking-tight tabular-nums">
<span className="min-w-0 truncate text-3xl leading-none font-semibold tracking-tight tabular-nums">
{latest !== null ? renderPair(latest, secondary?.latest) : "—"}
</span>
<span className="text-muted-foreground shrink-0 text-sm tabular-nums">
@@ -272,10 +272,15 @@ export function TrendCard({
all-time + comparison-delta into a single line that stays
scannable on Galaxy Fold (280 px) and Pixel 5 (375 px). The
full layout returns at `>=sm`. */}
{/* v1.4.27 MB7 / CF-41 — the `hidden sm:block` gate retired
because the mobile-secondary block below is gone (CF-67
vestigial wrapper drop). The callout paints on every
viewport; when the parent grid is tight on `<sm`, the
flex-wrap on the sibling row + this callout's `mt-1`
horizontal-row layout absorb the overflow without crowding
the headline value above. */}
{compareBaseline !== "none" && compareDelta != null && (
<div
className={cn("mt-1", avgAllTime !== undefined && "hidden sm:block")}
>
<div className="mt-1">
<span
className={cn(
"inline-block max-w-full text-xs leading-snug font-medium [overflow-wrap:anywhere] tabular-nums",
@@ -374,14 +379,18 @@ export function TrendCard({
to last-30 days). Other tiles leave `avgAllTime` undefined so
the third sub-row never renders.
v1.4.22 W5 reconcile (Design-H2) — full label only at
`>=sm`; on `<sm` the all-time number moves to the
combined secondary row below so the tile keeps the same
vertical density as every other trend card. */}
v1.4.27 MB7 / CF-41 — the third sub-value renders inline
alongside `7d` / `30d` on every viewport. The previous
wave split `<sm` into a separate secondary row to keep
tile heights uniform, but in practice the flex-wrap on
the parent already handles the overflow gracefully — the
all-time pair wraps to a second line when the first row
fills up. Dropping the duplicated mobile-secondary block
also dropped CF-67 (the vestigial wrapper). */}
{avgAllTime !== undefined && (
<span
data-slot="trend-card-all-time"
className="hidden max-w-full min-w-0 [overflow-wrap:anywhere] sm:inline"
className="max-w-full min-w-0 [overflow-wrap:anywhere]"
>
{t(avgAllTimeLabelKey)}:{" "}
<span
@@ -395,48 +404,6 @@ export function TrendCard({
</span>
)}
</div>
{/* v1.4.22 W5 reconcile (Design-H2) — combined secondary row
for `<sm` viewports. Renders the all-time aggregate AND
(when comparison is on) the comparison delta on a single
line: "All-time 11% · vs −0.4 last month". Disappears at
`>=sm` because the full layout above takes over. */}
{avgAllTime !== undefined && (
<div
data-slot="trend-card-secondary-mobile"
className="text-muted-foreground mt-1 min-w-0 text-xs leading-snug [overflow-wrap:anywhere] sm:hidden"
>
<span>
{t(avgAllTimeLabelKey)}:{" "}
<span
className={cn(
"font-medium [overflow-wrap:anywhere] tabular-nums",
avgAllTimeColorClass,
)}
>
{avgAllTime !== null ? formatValue(avgAllTime) : "—"}
</span>
</span>
{compareBaseline !== "none" && compareDelta != null && (
<>
<span aria-hidden="true"> · </span>
<span
className={cn(
"font-medium [overflow-wrap:anywhere] tabular-nums",
comparisonDeltaColor,
)}
data-slot="tile-compare-delta-mobile"
data-compare-baseline={compareBaseline}
>
{`Δ ${formatDelta(compareDelta)}${unit ? ` ${unit}` : ""} ${t(
compareBaseline === "lastMonth"
? "comparison.captionLastMonth"
: "comparison.captionLastYear",
)}`}
</span>
</>
)}
</div>
)}
</TooltipProvider>
</div>
);