mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
Say how many workouts the list holds and let a sport narrow it
The list hook already returned the canonical total and the page threw it away, so the surface never said how much history it was showing. Render it as a meta line above the rows. The route and the hook already accepted a sport, with nothing to reach it. Add the chip row. Its vocabulary comes from the unfiltered read, which is the same query the list itself runs when no sport is chosen, so the row costs no extra request and choosing a sport can never empty the row it was chosen from. A filtered view falls outside the server prefetch and pays one client fetch; a filter that matches nothing says so instead of borrowing the first-run empty state.
This commit is contained in:
1 parent
52cccb3835
commit
0784cbcbb1
8 files changed
+172
-18
No files matched your search
@@ -111,6 +111,8 @@ const workoutDetail = {
|
||||
},
|
||||
aiInsight: null,
|
||||
canonicalId: A11Y_WORKOUT_ID,
|
||||
dayKey: "2026-07-20",
|
||||
previousWorkoutId: null,
|
||||
};
|
||||
|
||||
const medication = {
|
||||
@@ -363,6 +365,44 @@ async function installA11yMocks(page: Page) {
|
||||
}),
|
||||
);
|
||||
|
||||
// The workout detail page's day context reads the day's pulse shape and
|
||||
// the night the person woke from into it.
|
||||
await page.route("**/api/insights/pulse/intraday*", (route) =>
|
||||
fulfilJson(route, {
|
||||
dateKey: "2026-07-20",
|
||||
bucketMinutes: 10,
|
||||
series: [
|
||||
{ startMinute: 420, mean: 62, count: 6, min: 58, max: 70 },
|
||||
{ startMinute: 430, mean: 118, count: 6, min: 96, max: 141 },
|
||||
],
|
||||
baseline: 58,
|
||||
baselineSource: "resting",
|
||||
tension: null,
|
||||
resolution: "dense",
|
||||
}),
|
||||
);
|
||||
|
||||
await page.route("**/api/sleep/night*", (route) =>
|
||||
fulfilJson(route, {
|
||||
night: "2026-07-20",
|
||||
main: {
|
||||
night: "2026-07-20",
|
||||
source: "APPLE_HEALTH",
|
||||
start: "2026-07-19T22:10:00.000Z",
|
||||
end: "2026-07-20T05:45:00.000Z",
|
||||
asleepMinutes: 415,
|
||||
inBedMinutes: 455,
|
||||
awakeMinutes: 40,
|
||||
awakenings: 2,
|
||||
reconstructed: false,
|
||||
stages: {},
|
||||
segments: [],
|
||||
sourceDiscrepancy: null,
|
||||
},
|
||||
naps: [],
|
||||
}),
|
||||
);
|
||||
|
||||
await page.route("**/api/workouts**", (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (url.pathname === `/api/workouts/${A11Y_WORKOUT_ID}`) {
|
||||
|
||||
Reference in new issue
Block a user