mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
feat(ui): trend arrow color reflects metric-specific direction sentiment
Restore the colour on the small ↑/↓ trend-arrow next to each tile's
latest reading — but make it metric-aware. v1.4.6 P4 stripped the colour
because the original rule (up=red, down=green) was wrong for half the
metrics: mood up is good, weight up is bad, pulse up is neither. v1.5
phase-5 brings back the colour through a `directionSentiment` prop:
- `up-good` → ↑ green, ↓ orange (mood, sleep, steps, BP-in-target%)
- `up-bad` → ↑ orange, ↓ green (weight, BP, body fat)
- `neutral` → muted in both (pulse, glucose — range matters
more than direction)
Stable-slope arrows ("→") and "no slope yet" placeholders ("—") always
stay muted. The default is `neutral` so any TrendCard call site that
hasn't been updated keeps the v1.4.6 muted look — back-compat is the
visible intent of the prop.
Affects only the icon next to the latest reading. The chart axes,
lines, colours, and the avg7/avg30 range-colour classes are untouched
(per Marc's hard-rule on chart visual identity, see
`feedback_charts_visual_identity.md` in user memory).
Tests: `src/components/charts/__tests__/trend-card.test.tsx` covers all
three sentiments × all three slope directions plus the
prop-omitted-back-compat case.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
987ce0d5f6
commit
38f12df737
3 files changed
+181
-3
No files matched your search
@@ -459,6 +459,7 @@ export default function DashboardPage() {
|
||||
)}
|
||||
slope30={w?.slope30 ?? null}
|
||||
icon={Activity}
|
||||
directionSentiment="up-bad"
|
||||
/>
|
||||
),
|
||||
});
|
||||
@@ -500,6 +501,7 @@ export default function DashboardPage() {
|
||||
)}
|
||||
slope30={sys?.slope30 ?? null}
|
||||
icon={Heart}
|
||||
directionSentiment="up-bad"
|
||||
/>
|
||||
),
|
||||
});
|
||||
@@ -536,6 +538,7 @@ export default function DashboardPage() {
|
||||
)}
|
||||
slope30={dia?.slope30 ?? null}
|
||||
icon={Heart}
|
||||
directionSentiment="up-bad"
|
||||
/>
|
||||
),
|
||||
});
|
||||
@@ -590,6 +593,7 @@ export default function DashboardPage() {
|
||||
avg30={bf?.avg30 ?? null}
|
||||
slope30={bf?.slope30 ?? null}
|
||||
icon={Percent}
|
||||
directionSentiment="up-bad"
|
||||
/>
|
||||
),
|
||||
});
|
||||
@@ -608,6 +612,7 @@ export default function DashboardPage() {
|
||||
avg30={moodSummary?.avg30 ?? null}
|
||||
slope30={moodSummary?.slope30 ?? null}
|
||||
icon={Smile}
|
||||
directionSentiment="up-good"
|
||||
/>
|
||||
),
|
||||
});
|
||||
@@ -626,6 +631,7 @@ export default function DashboardPage() {
|
||||
avg30={sleepSummary?.avg30 ?? null}
|
||||
slope30={sleepSummary?.slope30 ?? null}
|
||||
icon={Moon}
|
||||
directionSentiment="up-good"
|
||||
/>
|
||||
),
|
||||
});
|
||||
@@ -644,6 +650,7 @@ export default function DashboardPage() {
|
||||
avg30={stepsSummary?.avg30 ?? null}
|
||||
slope30={stepsSummary?.slope30 ?? null}
|
||||
icon={Footprints}
|
||||
directionSentiment="up-good"
|
||||
/>
|
||||
),
|
||||
});
|
||||
@@ -662,6 +669,7 @@ export default function DashboardPage() {
|
||||
avg30={null}
|
||||
slope30={null}
|
||||
icon={Target}
|
||||
directionSentiment="up-good"
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user