Skip to content

Make TrainerRoad metrics configurable via settings - #28

Merged
aidmax merged 2 commits into
mainfrom
claude/trainerroad-metrics-config-5qj9c0
Jul 31, 2026
Merged

Make TrainerRoad metrics configurable via settings#28
aidmax merged 2 commits into
mainfrom
claude/trainerroad-metrics-config-5qj9c0

Conversation

@aidmax

@aidmax aidmax commented Jul 31, 2026

Copy link
Copy Markdown
Owner

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

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-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

Adds an opt-in, persisted setting for TrainerRoad metrics.

  • Adds an accessible Settings modal with keyboard focus containment and restoration.
  • Hides TR-RPE and TR-LGT fields and markdown output when the setting is disabled while retaining entered values.
  • Repairs malformed-settings recovery and expands markdown gating coverage across cycling, rest, and other entries.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the three previously reported issues are addressed by the current implementation and regression coverage.

Important Files Changed

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

Comment thread client/src/components/ui/settings-panel.tsx
Comment thread client/src/test/utils.test.ts
Comment thread client/src/hooks/use-settings.ts
…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
@aidmax

aidmax commented Jul 31, 2026

Copy link
Copy Markdown
Owner Author

@greptile-apps

@aidmax
aidmax merged commit 89db953 into main Jul 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants