Skip to content

Commit 31ec413

Browse files
authored
Merge pull request #45 from carterscode/feat/recommended-status-labels
feat(ui): show Recommended value next to Current/Default on every setting
2 parents 71fbe50 + de41491 commit 31ec413

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

src/GamerGuardian/UI/SettingsWindow.xaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
<TextBlock Text="{Binding DefaultText}"
4444
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
4545
FontSize="11"/>
46+
<TextBlock Text="{Binding RecommendedText}"
47+
Visibility="{Binding RecommendedTextVisibility}"
48+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
49+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
4650
</StackPanel>
4751
</StackPanel>
4852
<StackPanel Grid.Column="1" Orientation="Vertical">
@@ -246,6 +250,10 @@
246250
<TextBlock Text="{Binding DefaultText}"
247251
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
248252
FontSize="11"/>
253+
<TextBlock Text="{Binding RecommendedText}"
254+
Visibility="{Binding RecommendedTextVisibility}"
255+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
256+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
249257
</StackPanel>
250258
</StackPanel>
251259
<StackPanel Grid.Column="1" Orientation="Vertical">
@@ -316,6 +324,10 @@
316324
<TextBlock Text="{Binding DefaultText}"
317325
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
318326
FontSize="11"/>
327+
<TextBlock Text="{Binding RecommendedText}"
328+
Visibility="{Binding RecommendedTextVisibility}"
329+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
330+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
319331
</StackPanel>
320332
</StackPanel>
321333
<StackPanel Grid.Column="1" Orientation="Vertical">
@@ -412,6 +424,10 @@
412424
<TextBlock Text="{Binding DefaultText}"
413425
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
414426
FontSize="11"/>
427+
<TextBlock Text="{Binding RecommendedText}"
428+
Visibility="{Binding RecommendedTextVisibility}"
429+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
430+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
415431
</StackPanel>
416432
</StackPanel>
417433
<StackPanel Grid.Column="1" Orientation="Vertical">
@@ -516,6 +532,10 @@
516532
<TextBlock Text="{Binding DefaultText}"
517533
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
518534
FontSize="11"/>
535+
<TextBlock Text="{Binding RecommendedText}"
536+
Visibility="{Binding RecommendedTextVisibility}"
537+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
538+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
519539
</StackPanel>
520540
</StackPanel>
521541
<StackPanel Grid.Column="1" Orientation="Vertical"
@@ -594,6 +614,10 @@
594614
<TextBlock Text="{Binding DefaultText}"
595615
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
596616
FontSize="11"/>
617+
<TextBlock Text="{Binding RecommendedText}"
618+
Visibility="{Binding RecommendedTextVisibility}"
619+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
620+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
597621
</StackPanel>
598622
</StackPanel>
599623
<StackPanel Grid.Column="1" Orientation="Vertical">
@@ -780,6 +804,10 @@
780804
<TextBlock Text="{Binding DefaultText}"
781805
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
782806
FontSize="11"/>
807+
<TextBlock Text="{Binding RecommendedText}"
808+
Visibility="{Binding RecommendedTextVisibility}"
809+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
810+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
783811
</StackPanel>
784812
</StackPanel>
785813
<StackPanel Grid.Column="1" Orientation="Vertical">
@@ -824,6 +852,9 @@
824852
<TextBlock Text="Default: Balanced"
825853
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
826854
FontSize="11"/>
855+
<TextBlock x:Name="PowerPlanRecommendedText"
856+
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
857+
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
827858
</StackPanel>
828859
</StackPanel>
829860
<StackPanel Grid.Column="1" Orientation="Vertical">

src/GamerGuardian/UI/SettingsWindow.xaml.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,10 @@ private void LoadGlobals()
787787
var active = SafeRunGuid(PowerPlanMonitor.GetActivePlan);
788788
var activeName = active is not null && planNames.TryGetValue(active.Value, out var name) ? name : "unknown";
789789
PowerPlanCurrentText.Text = $"Current: {activeName}";
790+
var planRec = SettingDocsCatalog.Get("powerplan")?.Recommended;
791+
PowerPlanRecommendedText.Text = string.IsNullOrWhiteSpace(planRec) ? string.Empty : $"Recommended: {planRec}";
792+
PowerPlanRecommendedText.Visibility = string.IsNullOrEmpty(PowerPlanRecommendedText.Text)
793+
? Visibility.Collapsed : Visibility.Visible;
790794
PowerPlanMonitorCheck.IsChecked = g.PowerPlan.Monitor;
791795
PowerPlanAutoApplyCheck.IsChecked = g.PowerPlan.AutoApply;
792796

@@ -1666,6 +1670,23 @@ public sealed class GlobalToggleRow : INotifyPropertyChanged
16661670
public Visibility LearnMoreVisibility =>
16671671
string.IsNullOrEmpty(LearnMoreContent) ? Visibility.Collapsed : Visibility.Visible;
16681672

1673+
/// <summary>
1674+
/// GamerGuardian's recommended value for this setting, pulled from the
1675+
/// per-setting docs catalog. Shown alongside Current/Default so the user can
1676+
/// see the suggested target at a glance. Empty (and hidden) when the setting
1677+
/// has no documented recommendation.
1678+
/// </summary>
1679+
public string RecommendedText
1680+
{
1681+
get
1682+
{
1683+
var rec = SettingDocsCatalog.Get(SettingId)?.Recommended;
1684+
return string.IsNullOrWhiteSpace(rec) ? string.Empty : $"Recommended: {rec}";
1685+
}
1686+
}
1687+
public Visibility RecommendedTextVisibility =>
1688+
string.IsNullOrEmpty(RecommendedText) ? Visibility.Collapsed : Visibility.Visible;
1689+
16691690
public bool Monitor
16701691
{
16711692
get => _pref.Monitor;
@@ -1763,6 +1784,22 @@ public sealed class ServiceRow : INotifyPropertyChanged
17631784
public Visibility LearnMoreVisibility =>
17641785
string.IsNullOrEmpty(LearnMoreContent) ? Visibility.Collapsed : Visibility.Visible;
17651786

1787+
/// <summary>
1788+
/// GamerGuardian's recommended startup state for this service, pulled from the
1789+
/// per-setting docs catalog. Shown alongside Current/Default. Empty (and
1790+
/// hidden) when the service has no documented recommendation.
1791+
/// </summary>
1792+
public string RecommendedText
1793+
{
1794+
get
1795+
{
1796+
var rec = SettingDocsCatalog.Get(SettingId)?.Recommended;
1797+
return string.IsNullOrWhiteSpace(rec) ? string.Empty : $"Recommended: {rec}";
1798+
}
1799+
}
1800+
public Visibility RecommendedTextVisibility =>
1801+
string.IsNullOrEmpty(RecommendedText) ? Visibility.Collapsed : Visibility.Visible;
1802+
17661803
public bool Monitor
17671804
{
17681805
get => _pref.Monitor;

tests/GamerGuardian.Tests/SettingDocsTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,26 @@ public void VerifyCommandFor_DoSvc_QueriesPolicyValue()
103103
// sc qc would query the Services hive; the policy verify shouldn't.
104104
Assert.DoesNotContain("sc qc", cmd);
105105
}
106+
107+
[Fact]
108+
public void Catalog_EveryEntry_HasRecommendation()
109+
{
110+
// The Settings UI shows "Recommended: {x}" next to Current/Default for
111+
// every documented setting (GlobalToggleRow / ServiceRow.RecommendedText).
112+
// A blank Recommended would render an empty/hidden line, so guard against
113+
// any catalog entry shipping without one.
114+
foreach (var d in SettingDocsCatalog.All)
115+
Assert.False(string.IsNullOrWhiteSpace(d.Recommended),
116+
$"no Recommended for {d.SettingId}");
117+
}
118+
119+
[Fact]
120+
public void Catalog_Get_ResolvesRecommendation_ForToggleAndServiceIds()
121+
{
122+
// RecommendedText is built from SettingDocsCatalog.Get(SettingId).Recommended.
123+
// Spot-check the id shapes the toggle/service rows actually pass.
124+
Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("ai.copilot")?.Recommended));
125+
Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("service:DiagTrack")?.Recommended));
126+
Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("powerplan")?.Recommended));
127+
}
106128
}

0 commit comments

Comments
 (0)