Show "Goal exceeded" instead of negative remaining minutes
All checks were successful
Deploy / deploy (push) Successful in 1m38s

When weekly intensity exceeds the phase goal, display "Goal exceeded by X min"
instead of the confusing "Remaining: -X min".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-17 07:27:32 +00:00
parent ed14aea0ea
commit 6543c79a04
2 changed files with 7 additions and 3 deletions

View File

@@ -142,10 +142,10 @@ describe("DataPanel", () => {
expect(screen.getByText(/Remaining: 0 min/)).toBeInTheDocument(); expect(screen.getByText(/Remaining: 0 min/)).toBeInTheDocument();
}); });
it("displays negative remaining minutes", () => { it("displays goal exceeded message for negative remaining minutes", () => {
render(<DataPanel {...baseProps} remainingMinutes={-50} />); render(<DataPanel {...baseProps} remainingMinutes={-50} />);
expect(screen.getByText(/Remaining: -50 min/)).toBeInTheDocument(); expect(screen.getByText(/Goal exceeded by 50 min/)).toBeInTheDocument();
}); });
}); });

View File

@@ -76,7 +76,11 @@ export function DataPanel({
/> />
</div> </div>
</li> </li>
<li>Remaining: {remainingMinutes} min</li> <li>
{remainingMinutes >= 0
? `Remaining: ${remainingMinutes} min`
: `Goal exceeded by ${Math.abs(remainingMinutes)} min`}
</li>
</ul> </ul>
</div> </div>
); );