Skip to content

Add setting to customize which macros display in properties#181

Open
forketyfork wants to merge 1 commit intomainfrom
claude/customize-macro-display-ZoY0z
Open

Add setting to customize which macros display in properties#181
forketyfork wants to merge 1 commit intomainfrom
claude/customize-macro-display-ZoY0z

Conversation

@forketyfork
Copy link
Owner

Add toggles for each macro (calories, fats, protein, etc.) to enable/disable
their display in daily note properties. Users who only track certain macros
can now disable the others to reduce clutter from zeros in their daily notes.

  • Add EnabledFrontmatterFields interface for tracking enabled/disabled state
  • Update settings service with new setting and migration support for existing users
  • Add toggle controls alongside field name inputs in settings UI
  • Update applyNutrientTotalsToFrontmatter to respect enabled fields setting
  • Update README documentation

Add toggles for each macro (calories, fats, protein, etc.) to enable/disable
their display in daily note properties. Users who only track certain macros
can now disable the others to reduce clutter from zeros in their daily notes.

- Add EnabledFrontmatterFields interface for tracking enabled/disabled state
- Update settings service with new setting and migration support for existing users
- Add toggle controls alongside field name inputs in settings UI
- Update applyNutrientTotalsToFrontmatter to respect enabled fields setting
- Update README documentation
@forketyfork forketyfork requested a review from Copilot January 17, 2026 15:51
Copy link

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 adds user-configurable toggles to control which nutrition macros are displayed in daily note properties, reducing clutter for users who don't track all nutrients.

Changes:

  • Introduced EnabledFrontmatterFields interface to track which macros should be displayed
  • Updated settings service with migration support for existing users (all fields enabled by default)
  • Modified UI to include toggle controls alongside field name inputs for each macro
  • Updated frontmatter logic to respect enabled/disabled field settings

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/SettingsService.ts Adds EnabledFrontmatterFields interface, default values, clone function, and settings service methods
src/FrontmatterTotalsService.ts Updates applyNutrientTotalsToFrontmatter to skip disabled fields when writing to frontmatter
src/FoodTrackerSettingTab.ts Adds toggle controls in settings UI for each macro field
README.md Documents the new toggle feature for controlling macro visibility

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

Comment on lines +190 to +192
const enabledFields = this.plugin.settings.enabledFrontmatterFields;
enabledFields[config.key] = value;
this.plugin.settingsService.updateEnabledFrontmatterFields(enabledFields);
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

This code directly mutates this.plugin.settings.enabledFrontmatterFields by reference. Line 190 creates a reference to the object, and line 191 mutates it before passing to updateEnabledFrontmatterFields. This should create a new object instead to avoid unintended side effects. Change line 190-191 to pass a new object with just the changed field: this.plugin.settingsService.updateEnabledFrontmatterFields({ [config.key]: value })

Suggested change
const enabledFields = this.plugin.settings.enabledFrontmatterFields;
enabledFields[config.key] = value;
this.plugin.settingsService.updateEnabledFrontmatterFields(enabledFields);
this.plugin.settingsService.updateEnabledFrontmatterFields({ [config.key]: value });

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9063941c1a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

3 participants