Skip to content

fix: Connect Settings Panel preferences to persistent store#30

Draft
BenGWeeks wants to merge 2 commits intomainfrom
claude/review-mvp-issues-MBWR7
Draft

fix: Connect Settings Panel preferences to persistent store#30
BenGWeeks wants to merge 2 commits intomainfrom
claude/review-mvp-issues-MBWR7

Conversation

@BenGWeeks
Copy link
Contributor

  • Add onChange handlers for Weekly Hours Target input
  • Add onChange handler for Timesheet Reminders toggle
  • Connect inputs to useSettingsStore which persists to localStorage
  • Use weeklyHoursTarget from settings store in Team page calculations

Closes #10

- Add onChange handlers for Weekly Hours Target input
- Add onChange handler for Timesheet Reminders toggle
- Connect inputs to useSettingsStore which persists to localStorage
- Use weeklyHoursTarget from settings store in Team page calculations

Closes #10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the Settings Panel preferences to properly persist to localStorage by connecting the UI controls to the useSettingsStore, addressing issue #10.

  • Added onChange handlers for the Weekly Hours Target input and Timesheet Reminders toggle to save changes to the persistent settings store
  • Connected the weeklyHoursTarget from the settings store to the Team page calculations
  • Added input validation with min/max attributes and safe parsing for the hours target input

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/components/settings/SettingsPanel.tsx Connects Weekly Hours Target input and Timesheet Reminders toggle to useSettingsStore with onChange handlers and adds input validation
src/components/team/TeamList.tsx Uses weeklyHoursTarget from settings store for team member calculations and adds division-by-zero protection

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- SettingsPanel: Enforce min/max (0-168) in onChange handler, not just HTML
- SettingsPanel: Add aria-label attributes for accessibility
- SettingsPanel: Use parseFloat to support decimal hours (e.g., 37.5)
- TeamList: Use useMemo to derive members instead of refetching API
- useSettingsStore: Change default weeklyHoursTarget to 37.5 (7.5 × 5)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@BenGWeeks
Copy link
Contributor Author

Further work needed

This PR needs to be updated to fetch weekly hours target from Business Central Resources API instead of using local settings.

See: knowall-ai/thyme-bc-extension#4

Once the Resources API is implemented in the BC extension, this PR will be updated to:

  1. Fetch resource capacity from BC as hours target
  2. Fall back to 40 hours if no matching resource found
  3. Remove local settings store approach

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.

fix: Settings Panel preferences do not persist

3 participants