mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
chore(style): repo-wide prettier sweep before v1.4.6 tag
Long-overdue prettier sweep; prettier had drifted vs. checked-in code across ~130 files (mostly long-argument line-break wrapping in TS and table-padding in markdown). Pure formatting — no semantic changes — and required to clear the v1.4.6 release gate's `pnpm format:check`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
67575180b8
commit
02b99553b9
135 files changed
+2159
-1583
No files matched your search
@@ -76,7 +76,13 @@ export function ComplianceHeatmap({
|
||||
} | null>(null);
|
||||
|
||||
const WEEKDAY_LABELS = [
|
||||
t("charts.weekdays.mon"), "", t("charts.weekdays.wed"), "", t("charts.weekdays.fri"), "", t("charts.weekdays.sun"),
|
||||
t("charts.weekdays.mon"),
|
||||
"",
|
||||
t("charts.weekdays.wed"),
|
||||
"",
|
||||
t("charts.weekdays.fri"),
|
||||
"",
|
||||
t("charts.weekdays.sun"),
|
||||
];
|
||||
useEffect(() => {
|
||||
if (!stretch) return;
|
||||
@@ -98,10 +104,18 @@ export function ComplianceHeatmap({
|
||||
|
||||
const { cells, weeks, monthMarkers } = useMemo(() => {
|
||||
const MONTH_LABELS = [
|
||||
t("charts.months.jan"), t("charts.months.feb"), t("charts.months.mar"),
|
||||
t("charts.months.apr"), t("charts.months.may"), t("charts.months.jun"),
|
||||
t("charts.months.jul"), t("charts.months.aug"), t("charts.months.sep"),
|
||||
t("charts.months.oct"), t("charts.months.nov"), t("charts.months.dec"),
|
||||
t("charts.months.jan"),
|
||||
t("charts.months.feb"),
|
||||
t("charts.months.mar"),
|
||||
t("charts.months.apr"),
|
||||
t("charts.months.may"),
|
||||
t("charts.months.jun"),
|
||||
t("charts.months.jul"),
|
||||
t("charts.months.aug"),
|
||||
t("charts.months.sep"),
|
||||
t("charts.months.oct"),
|
||||
t("charts.months.nov"),
|
||||
t("charts.months.dec"),
|
||||
];
|
||||
const now = new Date();
|
||||
const cellList: Array<{
|
||||
|
||||
@@ -17,12 +17,7 @@ import { useState, useMemo, useId } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
CardContent,
|
||||
} from "@/components/ui/card";
|
||||
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
|
||||
import { formatDateShort } from "@/lib/format";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import type { DataSummary } from "@/lib/analytics/trends";
|
||||
@@ -50,10 +45,26 @@ interface MoodChartProps {
|
||||
// --- Constants ---
|
||||
|
||||
const TIME_RANGES_KEYS = [
|
||||
{ labelKey: "charts.points7Label", points: 7, titleKey: "charts.points7Title" },
|
||||
{ labelKey: "charts.points30Label", points: 30, titleKey: "charts.points30Title" },
|
||||
{ labelKey: "charts.points90Label", points: 90, titleKey: "charts.points90Title" },
|
||||
{ labelKey: "charts.pointsAllLabel", points: 0, titleKey: "charts.pointsAllTitle" },
|
||||
{
|
||||
labelKey: "charts.points7Label",
|
||||
points: 7,
|
||||
titleKey: "charts.points7Title",
|
||||
},
|
||||
{
|
||||
labelKey: "charts.points30Label",
|
||||
points: 30,
|
||||
titleKey: "charts.points30Title",
|
||||
},
|
||||
{
|
||||
labelKey: "charts.points90Label",
|
||||
points: 90,
|
||||
titleKey: "charts.points90Title",
|
||||
},
|
||||
{
|
||||
labelKey: "charts.pointsAllLabel",
|
||||
points: 0,
|
||||
titleKey: "charts.pointsAllTitle",
|
||||
},
|
||||
] as const;
|
||||
|
||||
// MOOD_LABELS built dynamically via t() in the component
|
||||
@@ -95,9 +106,10 @@ function movingAverageByPoints(
|
||||
});
|
||||
}
|
||||
|
||||
function buildTrendLine(
|
||||
data: Array<{ date: Date; value: number }>,
|
||||
): { points: Array<{ date: Date; value: number }>; slopePerDay: number } | null {
|
||||
function buildTrendLine(data: Array<{ date: Date; value: number }>): {
|
||||
points: Array<{ date: Date; value: number }>;
|
||||
slopePerDay: number;
|
||||
} | null {
|
||||
if (data.length < 2) return null;
|
||||
|
||||
const sorted = [...data].sort((a, b) => a.date.getTime() - b.date.getTime());
|
||||
@@ -188,9 +200,7 @@ export function MoodChart({ title }: MoodChartProps) {
|
||||
const ma = movingAverageByPoints(scoreData, 7);
|
||||
for (const point of ma) {
|
||||
const pointTimestamp = point.date.getTime();
|
||||
const existing = enriched.find(
|
||||
(d) => d.timestamp === pointTimestamp,
|
||||
);
|
||||
const existing = enriched.find((d) => d.timestamp === pointTimestamp);
|
||||
if (existing) {
|
||||
existing.ma = point.value;
|
||||
}
|
||||
|
||||
@@ -88,9 +88,7 @@ export function TrendCard({
|
||||
</div>
|
||||
<div className="mt-2 flex items-baseline gap-2">
|
||||
<span className="text-3xl font-bold tracking-tight tabular-nums">
|
||||
{latest !== null
|
||||
? renderPair(latest, secondary?.latest)
|
||||
: "—"}
|
||||
{latest !== null ? renderPair(latest, secondary?.latest) : "—"}
|
||||
</span>
|
||||
<span className="text-muted-foreground text-sm tabular-nums">
|
||||
{unit}
|
||||
@@ -115,9 +113,7 @@ export function TrendCard({
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<span
|
||||
className={cn("font-medium tabular-nums", avg7ColorClass)}
|
||||
>
|
||||
<span className={cn("font-medium tabular-nums", avg7ColorClass)}>
|
||||
{avg7 !== null ? renderPair(avg7, secondary?.avg7) : "—"}
|
||||
</span>
|
||||
)}
|
||||
@@ -138,9 +134,7 @@ export function TrendCard({
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<span
|
||||
className={cn("font-medium tabular-nums", avg30ColorClass)}
|
||||
>
|
||||
<span className={cn("font-medium tabular-nums", avg30ColorClass)}>
|
||||
{avg30 !== null ? renderPair(avg30, secondary?.avg30) : "—"}
|
||||
</span>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user