Every dashboard tile opens its chart; body fat gets its page - #1087
Merged
Merged
Conversation
The body fat tile was the one strip tile that led nowhere. Its href map said there was no dedicated sub-page, which was true: body fat percentage was tiled and charted on the dashboard but never got the Insights page every body-composition sibling has. Add /insights/body-fat on the generic metric-page scaffold (body group, tab-strip pill, seven locales, manual-entry empty state) and link the tile to it. Move the tile href map out of the page into tile-destinations.ts, keyed by the tile-capable widget id and typed against the sub-page slug union, so a missing or non-existent destination fails to compile. The link passes the destination's insights-page surface gate, so it never points at a page a switched-off module hides. A guard derives the tile set from TILE_CAPABLE_WIDGET_IDS and from the ids the dashboard actually pushes into its strip, and fails when a tile's metric has a sub-page the tile does not open, when a destination has no route, or when a tile links to a page owned by another module. Tiles that deliberately lead nowhere need a written reason; there are none today. The reverse-lookup test pinned BODY_FAT as having no page; it now resolves to body-fat. Refs #1084
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1084.
The body fat tile opened nothing. The tile→page links were a hand-kept list in
src/app/page-client.tsx, and body fat was left out on purpose because it never got a sub-page when every other measurement type did (v1.7.0); a test even pinned that state./insights/body-fatbuilt on the sameHealthKitMetricPageas fat mass, bone mass and the other body-composition pages (Body group tab, seven locales, empty state with the manual-entry action). OpenAPI regenerated:body-fatis a new insights layout id.src/components/dashboard/tile-destinations.ts, keyed by widget id; a missing destination or one that is not a real route is a type error. Links go throughisSurfaceVisible("insights-page:<slug>"), so a tile never points to a page a switched-off module hides.tile-destinations.test.tsreads tiles fromTILE_CAPABLE_WIDGET_IDSand from the rendering code (both must agree, with floors), and fails when a tile's measurement type has a page it does not open, a destination is not a route, a link crosses into another module, or the dashboard bypasses the table. Removing the body fat link (and the page) turns it red.All other 18 tiles were already linked. Not changed: the chart cards lower on the dashboard do not link anywhere.