refactor(insights): read the mood bands from a leaf module so mood-patterns no longer imports its hub

This commit is contained in:
Marc-André Bombeck committed 2026-10-23 11:21:29 +02:00
1 parent 6a58a7df78
commit daaa44fd82
3 files changed
+24 -15

No files matched your search

+8 -10
View File
@@ -283,16 +283,14 @@ export const MOOD_CROSS_METRIC_ROW_CAP = 50_000;
// --- Target bands (mirror mood-chart VALUE_BANDS + mood-status) ---
/**
* The mood-status generator grades "in target" as score >= 3.5. The
* mood-chart paints three reference bands (1–2 red, 2–3 orange, 3–5
* green). We keep both anchored here so the heatmap colour map and the
* in-target headline never drift from the line chart.
*/
export const MOOD_GREEN_MIN = 3.5;
export const MOOD_GREEN_MAX = 5;
export const MOOD_ORANGE_MIN = 2;
export const MOOD_ORANGE_MAX = 3.5;
// Defined in a leaf module so the per-domain modules this hub re-exports can
// read them without importing the hub back.
export {
MOOD_GREEN_MAX,
MOOD_GREEN_MIN,
MOOD_ORANGE_MAX,
MOOD_ORANGE_MIN,
} from "@/lib/insights/mood-bands";
// --- Pair two daily-bucket series on dayOffset (lifted from mood-status) ---
+12
View File
@@ -0,0 +1,12 @@
/**
* The mood scale's target bands (mirror mood-chart VALUE_BANDS + mood-status).
*
* The mood-status generator grades "in target" as score >= 3.5. The
* mood-chart paints three reference bands (1–2 red, 2–3 orange, 3–5
* green). We keep both anchored here so the heatmap colour map and the
* in-target headline never drift from the line chart.
*/
export const MOOD_GREEN_MIN = 3.5;
export const MOOD_GREEN_MAX = 5;
export const MOOD_ORANGE_MIN = 2;
export const MOOD_ORANGE_MAX = 3.5;
+4 -5
View File
@@ -11,11 +11,10 @@
*/
import { dayOffsetToDayKey } from "@/lib/insights/bucket-series";
import {
MOOD_GREEN_MAX,
MOOD_GREEN_MIN,
type DailyPoint,
type MoodAggregateEntry,
import { MOOD_GREEN_MAX, MOOD_GREEN_MIN } from "@/lib/insights/mood-bands";
import type {
DailyPoint,
MoodAggregateEntry,
} from "@/lib/insights/mood-aggregates";
import { round } from "@/lib/insights/status-shared";
import { DEFAULT_TIMEZONE } from "@/lib/tz/format";