From de414916e3fa03cbfe1284f722667861f99d48f8 Mon Sep 17 00:00:00 2001 From: Carter <4911475+carterscode@users.noreply.github.com> Date: Thu, 18 Jun 2026 20:01:06 -0700 Subject: [PATCH] feat(ui): show Recommended value next to Current/Default on every setting Surface GamerGuardian's per-setting recommendation (from SettingDocsCatalog) in the Settings window alongside the existing Current/Default labels, so users can see the suggested gaming-optimized target at a glance without opening Learn more. - GlobalToggleRow / ServiceRow: add computed RecommendedText + RecommendedTextVisibility, resolved from SettingDocsCatalog.Get(SettingId). - Add a green SemiBold Recommended line to every toggle/service row template (Global gaming, Privacy, Network, Debloat, Windows AI, CPU/Power, Services) and to the static Power plan section. - Hidden automatically for any setting lacking a documented recommendation. - Tests: assert every catalog entry ships a non-empty Recommended. Co-Authored-By: Claude Opus 4.8 --- src/GamerGuardian/UI/SettingsWindow.xaml | 31 ++++++++++++++++ src/GamerGuardian/UI/SettingsWindow.xaml.cs | 37 +++++++++++++++++++ tests/GamerGuardian.Tests/SettingDocsTests.cs | 22 +++++++++++ 3 files changed, 90 insertions(+) diff --git a/src/GamerGuardian/UI/SettingsWindow.xaml b/src/GamerGuardian/UI/SettingsWindow.xaml index 4f80ba7..ceecb1b 100644 --- a/src/GamerGuardian/UI/SettingsWindow.xaml +++ b/src/GamerGuardian/UI/SettingsWindow.xaml @@ -43,6 +43,10 @@ + @@ -246,6 +250,10 @@ + @@ -316,6 +324,10 @@ + @@ -412,6 +424,10 @@ + @@ -516,6 +532,10 @@ + + @@ -780,6 +804,10 @@ + @@ -824,6 +852,9 @@ + diff --git a/src/GamerGuardian/UI/SettingsWindow.xaml.cs b/src/GamerGuardian/UI/SettingsWindow.xaml.cs index e37fa99..9dd4a7b 100644 --- a/src/GamerGuardian/UI/SettingsWindow.xaml.cs +++ b/src/GamerGuardian/UI/SettingsWindow.xaml.cs @@ -787,6 +787,10 @@ private void LoadGlobals() var active = SafeRunGuid(PowerPlanMonitor.GetActivePlan); var activeName = active is not null && planNames.TryGetValue(active.Value, out var name) ? name : "unknown"; PowerPlanCurrentText.Text = $"Current: {activeName}"; + var planRec = SettingDocsCatalog.Get("powerplan")?.Recommended; + PowerPlanRecommendedText.Text = string.IsNullOrWhiteSpace(planRec) ? string.Empty : $"Recommended: {planRec}"; + PowerPlanRecommendedText.Visibility = string.IsNullOrEmpty(PowerPlanRecommendedText.Text) + ? Visibility.Collapsed : Visibility.Visible; PowerPlanMonitorCheck.IsChecked = g.PowerPlan.Monitor; PowerPlanAutoApplyCheck.IsChecked = g.PowerPlan.AutoApply; @@ -1666,6 +1670,23 @@ public sealed class GlobalToggleRow : INotifyPropertyChanged public Visibility LearnMoreVisibility => string.IsNullOrEmpty(LearnMoreContent) ? Visibility.Collapsed : Visibility.Visible; + /// + /// GamerGuardian's recommended value for this setting, pulled from the + /// per-setting docs catalog. Shown alongside Current/Default so the user can + /// see the suggested target at a glance. Empty (and hidden) when the setting + /// has no documented recommendation. + /// + public string RecommendedText + { + get + { + var rec = SettingDocsCatalog.Get(SettingId)?.Recommended; + return string.IsNullOrWhiteSpace(rec) ? string.Empty : $"Recommended: {rec}"; + } + } + public Visibility RecommendedTextVisibility => + string.IsNullOrEmpty(RecommendedText) ? Visibility.Collapsed : Visibility.Visible; + public bool Monitor { get => _pref.Monitor; @@ -1763,6 +1784,22 @@ public sealed class ServiceRow : INotifyPropertyChanged public Visibility LearnMoreVisibility => string.IsNullOrEmpty(LearnMoreContent) ? Visibility.Collapsed : Visibility.Visible; + /// + /// GamerGuardian's recommended startup state for this service, pulled from the + /// per-setting docs catalog. Shown alongside Current/Default. Empty (and + /// hidden) when the service has no documented recommendation. + /// + public string RecommendedText + { + get + { + var rec = SettingDocsCatalog.Get(SettingId)?.Recommended; + return string.IsNullOrWhiteSpace(rec) ? string.Empty : $"Recommended: {rec}"; + } + } + public Visibility RecommendedTextVisibility => + string.IsNullOrEmpty(RecommendedText) ? Visibility.Collapsed : Visibility.Visible; + public bool Monitor { get => _pref.Monitor; diff --git a/tests/GamerGuardian.Tests/SettingDocsTests.cs b/tests/GamerGuardian.Tests/SettingDocsTests.cs index 47a0adc..7c431a9 100644 --- a/tests/GamerGuardian.Tests/SettingDocsTests.cs +++ b/tests/GamerGuardian.Tests/SettingDocsTests.cs @@ -103,4 +103,26 @@ public void VerifyCommandFor_DoSvc_QueriesPolicyValue() // sc qc would query the Services hive; the policy verify shouldn't. Assert.DoesNotContain("sc qc", cmd); } + + [Fact] + public void Catalog_EveryEntry_HasRecommendation() + { + // The Settings UI shows "Recommended: {x}" next to Current/Default for + // every documented setting (GlobalToggleRow / ServiceRow.RecommendedText). + // A blank Recommended would render an empty/hidden line, so guard against + // any catalog entry shipping without one. + foreach (var d in SettingDocsCatalog.All) + Assert.False(string.IsNullOrWhiteSpace(d.Recommended), + $"no Recommended for {d.SettingId}"); + } + + [Fact] + public void Catalog_Get_ResolvesRecommendation_ForToggleAndServiceIds() + { + // RecommendedText is built from SettingDocsCatalog.Get(SettingId).Recommended. + // Spot-check the id shapes the toggle/service rows actually pass. + Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("ai.copilot")?.Recommended)); + Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("service:DiagTrack")?.Recommended)); + Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("powerplan")?.Recommended)); + } }