State an authored composition in the score's method footer

One line under the method version, shown only when the server says the
composition is the person's own. It states the fact and stops there:
which pillars they took out belongs to the settings surface, and
working it out here from a configuration blob would put a second
decider behind one sentence.
This commit is contained in:
Marc-André Bombeck committed 2026-07-31 18:06:09 +02:00
1 parent c29055be1c
commit 0276ca9121
8 files changed
+60

No files matched your search

@@ -675,6 +675,44 @@ describe("<HealthScoreCard> footer", () => {
expect(region).toContain("equal-weighted average");
});
it("states an authored composition in the method footer, and only when the server says so", () => {
// The footer reads the resolved flag off the composite and says one
// sentence. It never names the pillars the person took out — that is
// the settings surface's job — and it never appears for an account
// whose composition is the default one.
const configured = render(
<HealthScoreCard
report={scoredReport({
composite: {
...(scoredReport().composite as Extract<
HealthScoreReport["composite"],
{ status: "ok" }
>),
value: {
...(
scoredReport().composite as Extract<
HealthScoreReport["composite"],
{ status: "ok" }
>
).value,
configured: true,
},
},
})}
/>,
);
expect(anatomyRegion(configured)).toContain(
'data-slot="health-score-configured"',
);
expect(anatomyRegion(configured)).toContain(
"You chose which pillars count toward this score.",
);
const inherited = render(<HealthScoreCard report={scoredReport()} />);
expect(inherited).not.toContain('data-slot="health-score-configured"');
expect(inherited).not.toContain("You chose which pillars count");
});
it("shows the personal weight goal as explicitly unscored context", () => {
const html = render(
<HealthScoreCard
@@ -594,6 +594,22 @@ export function HealthScoreCard({
noise: composite.value.noiseFloor,
})}
</p>
{/*
* The server resolved whether this composition is the
* person's own; the footer states it and nothing more.
* Which pillars they took out is the settings surface's
* to show, not this one's, and re-deriving the answer
* from a configuration blob here would put a second
* decider behind one sentence.
*/}
{composite.value.configured ? (
<p
data-slot="health-score-configured"
className="text-muted-foreground text-xs"
>
{t("insights.healthScore.configured")}
</p>
) : null}
</>
) : (
<p className="text-muted-foreground text-xs">