Make TrainerRoad metrics configurable via settings - #28
Merged
Conversation
Add a Settings modal (gear icon in the header) with a "Show TrainerRoad metrics" toggle, persisted to localStorage via a new useSettings hook that mirrors the existing use-section-state persistence pattern. The setting is opt-in (off by default) and gates visibility of the TR-RPE and TR-LGT fields in the form as well as their lines in generated markdown, while preserving any previously-entered values. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NzWVv8oVBPDR14qbN1ZoQa
Greptile SummaryAdds an opt-in, persisted setting for TrainerRoad metrics.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the three previously reported issues are addressed by the current implementation and regression coverage.
|
| Filename | Overview |
|---|---|
| client/src/components/ui/settings-panel.tsx | Adds the Settings modal and resolves the previously reported keyboard focus escape with Tab wrapping and focus restoration. |
| client/src/hooks/use-settings.ts | Adds versioned localStorage persistence and now overwrites malformed stored JSON with defaults as previously requested. |
| client/src/pages/home.tsx | Integrates the setting into both page modes and consistently gates TrainerRoad form fields and generated markdown. |
| client/src/test/hooks/use-settings.test.ts | Covers restoration, updates, malformed data recovery, schema handling, and storage quota failures. |
| client/src/test/utils.test.ts | Now forwards the visibility setting and explicitly covers enabled and disabled TR-LGT output for other entries. |
Reviews (2): Last reviewed commit: "Address review: trap modal focus, fix st..." | Re-trigger Greptile
…y test - settings-panel.tsx: trap Tab focus within the dialog while open (was escaping to background form controls), focus the close button on open, and restore focus to the trigger on close. - use-settings.ts: overwrite malformed localStorage data with defaults on parse failure, instead of leaving the bad value in place to re-trigger the same parse error on every mount. - utils.test.ts: align the test-local generateOtherMarkdown with production (home.tsx) — it reuses HRV/rMSSD/RHR/TR-LGT like rest entries — and thread showTrainerRoadMetrics through it so TR-LGT gating is covered for entryType "other", not just cycling/rest. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NzWVv8oVBPDR14qbN1ZoQa
Owner
Author
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.
Add a Settings modal (gear icon in the header) with a "Show TrainerRoad
metrics" toggle, persisted to localStorage via a new useSettings hook
that mirrors the existing use-section-state persistence pattern. The
setting is opt-in (off by default) and gates visibility of the TR-RPE
and TR-LGT fields in the form as well as their lines in generated
markdown, while preserving any previously-entered values.
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01NzWVv8oVBPDR14qbN1ZoQa