mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 21:32:18 +00:00
fix(insights): pass theme tokens instead of raw hex on four HealthKit metric pages
grip-strength, waist, waist-to-height, and pain shipped stock hex chart colours (#22c55e / #0ea5e9 / #8b5cf6 / #f97316) while every sibling page passes var(--token) — the four charts ignored both themes and any token retune. Map them to var(--success) / var(--info) / var(--chart-1) / var(--warning) and narrow the scaffold's color prop to a `var(--…)` template-literal type so a raw hex no longer typechecks.
This commit is contained in:
1 parent
3ce6236406
commit
d3ed9b8225
6 files changed
+12
-7
No files matched your search
@@ -22,7 +22,7 @@ export default function InsightsGripStrengthPage() {
|
||||
insightMetric="GRIP_STRENGTH"
|
||||
chartKey="gripStrength"
|
||||
i18nPrefix="insights.gripStrength"
|
||||
color="#22c55e"
|
||||
color="var(--success)"
|
||||
unit="kg"
|
||||
yAxisUnit="kg"
|
||||
statIcon={Dumbbell}
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function InsightsPainPage() {
|
||||
insightMetric="PAIN_NRS"
|
||||
chartKey="painNrs"
|
||||
i18nPrefix="insights.pain"
|
||||
color="#f97316"
|
||||
color="var(--warning)"
|
||||
unit=""
|
||||
yAxisUnit="/10"
|
||||
statIcon={Activity}
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function InsightsWaistToHeightPage() {
|
||||
insightMetric="WAIST_TO_HEIGHT"
|
||||
chartKey="waistToHeight"
|
||||
i18nPrefix="insights.waistToHeight"
|
||||
color="#8b5cf6"
|
||||
color="var(--chart-1)"
|
||||
unit=""
|
||||
statIcon={Scaling}
|
||||
emptyStateIcon={<Scaling className="size-6" />}
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function InsightsWaistPage() {
|
||||
insightMetric="WAIST_CIRCUMFERENCE"
|
||||
chartKey="waistCircumference"
|
||||
i18nPrefix="insights.waist"
|
||||
color="#0ea5e9"
|
||||
color="var(--info)"
|
||||
unit="cm"
|
||||
yAxisUnit="cm"
|
||||
statIcon={Ruler}
|
||||
|
||||
@@ -70,7 +70,7 @@ const baseProps = {
|
||||
insightMetric: "HEART_RATE_VARIABILITY" as const,
|
||||
chartKey: "hrv" as const,
|
||||
i18nPrefix: "insights.hrv",
|
||||
color: "#bd93f9",
|
||||
color: "var(--chart-1)" as const,
|
||||
unit: "ms",
|
||||
emptyStateIcon: null,
|
||||
};
|
||||
|
||||
@@ -82,8 +82,13 @@ export interface HealthKitMetricPageProps {
|
||||
* sub-key off the prefix.
|
||||
*/
|
||||
i18nPrefix: string;
|
||||
/** Single canonical colour for the chart line. */
|
||||
color: string;
|
||||
/**
|
||||
* Single canonical colour for the chart line. Typed as a `var(--…)`
|
||||
* template so pages can only pass a theme token (`"var(--success)"`),
|
||||
* never a raw hex — raw stock hex ignores both themes and every future
|
||||
* token retune (see UI standards, colour token rules).
|
||||
*/
|
||||
color: `var(--${string})`;
|
||||
/** Unit suffix the chart renders next to the value. */
|
||||
unit: string;
|
||||
/** Optional y-axis label shown above the unit. */
|
||||
|
||||
Reference in new issue
Block a user