diff --git a/src/components/charts/compliance-line-chart.tsx b/src/components/charts/compliance-line-chart.tsx index e1c6ff500..cbba86eec 100644 --- a/src/components/charts/compliance-line-chart.tsx +++ b/src/components/charts/compliance-line-chart.tsx @@ -13,6 +13,8 @@ import { } from "recharts"; import { Button } from "@/components/ui/button"; import { formatDateShort } from "@/lib/format"; +import { useViewportWidth } from "@/hooks/use-viewport-width"; +import { chooseTickInterval } from "@/lib/charts/x-axis-density"; interface DailyData { expected: number; @@ -47,6 +49,7 @@ export function ComplianceLineChart({ ); const activeRangePoints = rangePoints ?? internalRangePoints; const setActiveRangePoints = onRangePointsChange ?? setInternalRangePoints; + const viewportWidth = useViewportWidth(); const chartData = useMemo(() => { const points = Object.entries(dailyCompliance) @@ -101,6 +104,7 @@ export function ComplianceLineChart({ tick={{ fontSize: 11, fill: "var(--muted-foreground)" }} tickLine={false} axisLine={false} + interval={chooseTickInterval(chartData.length, viewportWidth)} /> {!mini && ( -
-
+ /* v1.4.19 A2 — mobile-first header layout. + + Pre-fix: title + bucket chip + comparison chip + 4 range tabs + + cog all sat on a single justify-between flex row. On Pixel 5 + the chips ate enough horizontal space that the range tabs + wrapped to a second row INSIDE that flex (header height + jumped from 44 px → 92 px); on Galaxy Fold compact (280 px) + the tabs split into 3-4 rows. + + Mobile (default): two stacked rows. Title + non-essential + chips on row 1; range tabs + cog right-aligned on row 2. + Bucket-aggregation + comparison chips hide entirely below + `sm:` because they're decorative and the chart's range tabs + already communicate the visible window. The cog dropdown + stays accessible to surface those overlays explicitly. + + ≥sm: original side-by-side layout, all chips visible. */ +
+

{title}

{activeBucket !== "day" && ( - + {t( activeBucket === "week" ? "charts.bucketWeekly" @@ -855,10 +880,12 @@ export function HealthChart({ bucket-aggregation chip so the user reads "what window am I looking at" + "what comparison is overlaid" in one glance. The "Comparison unavailable" fallback uses - neutral muted styling so it doesn't read as an error. */} + neutral muted styling so it doesn't read as an error. + + v1.4.19 A2 — hidden on mobile to free up the title row. */} {compareBaseline !== "none" && hasComparisonData && ( {t( @@ -870,7 +897,7 @@ export function HealthChart({ )} {compareBaseline !== "none" && !hasComparisonData && ( {t( @@ -881,13 +908,16 @@ export function HealthChart({ )}
-
+
{TIME_RANGES_KEYS.map((r) => (