Skip to content

Commit 5993082

Browse files
atulmguptaCopilot
andcommitted
feat(windows): mount full Appearance/General/Advanced surfaces in Settings
The Settings page was a thin hub (theme picker + export/tour/checklist links) while the rich AppearanceSettings (theme + density + sidebar + time-format + chart-palette + status-bar + celebrations), GeneralSettings, and AdvancedSettings surfaces existed but were never mounted. The shell now constructs them over a shared SettingsRepository (api+engine+options) and passes them to SettingsPage, which renders them (and disposes them). Falls back to the standalone theme panel when no surfaces are supplied. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4ccc7d8 commit 5993082

2 files changed

Lines changed: 48 additions & 4 deletions

File tree

apps/windows/TeslaSync.App/Shell/ShellWindow.xaml.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,26 @@ private void RegisterDataBackedPages()
12871287
new FeatureViews.Admin.LiveSignalInspectorClientFeed(_data.Api),
12881288
FeatureViews.Admin.EmptyLiveSignalsTableSource.Instance,
12891289
_data.Localizer));
1290+
1291+
// Settings hub — mount the full Appearance / General / Advanced settings surfaces (each backed by the
1292+
// shared settings repository over the live data layer) so the Settings page is a complete settings
1293+
// surface instead of a thin hub. The hub's navigation + tour-launcher wiring is preserved.
1294+
_viewModel.PageFactory.Register("Settings", () =>
1295+
{
1296+
var settingsRepo = new TeslaSync.App.Core.Data.Repositories.SettingsRepository(
1297+
_data.Api, _data.Engine, _data.Options);
1298+
var surfaces = new UIElement[]
1299+
{
1300+
FeatureViews.AppearanceSettings.Create(settingsRepo, _data.Api, _data.Localizer),
1301+
FeatureViews.GeneralSettings.Create(settingsRepo, _data.Api, _data.Localizer),
1302+
FeatureViews.AdvancedSettings.Create(_data.Localizer),
1303+
};
1304+
var page = new FeatureViews.Settings.SettingsPage(
1305+
FeatureViews.Settings.EmptySettingsFeed.Instance, _data.Localizer, surfaces);
1306+
page.NavigationRequested += (_, route) => NavigateTo(route);
1307+
page.TourLauncherRequested += (_, _) => NavigateTo("onboarding");
1308+
return page;
1309+
});
12901310
}
12911311

12921312
/// <summary>The shell's navigation/state view-model (exposed for diagnostics and tests).</summary>

apps/windows/TeslaSync.App/feature-views/SettingsPage/SettingsPage.cs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public sealed partial class SettingsPage : UserControl, IDisposable
7373
private readonly TsButton _checklistButton = new() { Variant = ButtonVariant.Subtle, IconGlyph = SettingsRegistration.ChecklistGlyph };
7474

7575
// Appearance — accent palette + display-mode picker (native ThemeProvider parity, applied app-wide).
76-
private readonly TsGlassPanel _themePanel;
76+
// Null when the shell mounts the full Appearance surface (which already contains the theme picker).
77+
private readonly TsGlassPanel? _themePanel;
78+
79+
// Optional full settings surfaces (Appearance / General / Advanced) mounted by the shell with the live data layer.
80+
private readonly IReadOnlyList<UIElement> _extraSurfaces;
7781

7882
/// <summary>Creates the page over the default (empty) settings feed and the shell resource localizer.</summary>
7983
public SettingsPage()
@@ -84,11 +88,12 @@ public SettingsPage()
8488
/// <summary>Creates the page over an explicit settings feed and localizer (used by tests / dependency injection).</summary>
8589
/// <param name="feed">The settings-read data port (web <c>useSettings</c>).</param>
8690
/// <param name="localizer">The i18n facade every label resolves through.</param>
87-
public SettingsPage(ISettingsFeed feed, ILocalizer localizer)
91+
public SettingsPage(ISettingsFeed feed, ILocalizer localizer, IReadOnlyList<UIElement>? extraSurfaces = null)
8892
{
8993
ArgumentNullException.ThrowIfNull(feed);
9094
ArgumentNullException.ThrowIfNull(localizer);
9195

96+
_extraSurfaces = extraSurfaces ?? System.Array.Empty<UIElement>();
9297
_viewModel = new SettingsPageViewModel(feed, localizer);
9398

9499
// Web mounts <SettingsSearch /> at the top of the page; the search forwards a deep-link the host navigates to.
@@ -104,7 +109,7 @@ public SettingsPage(ISettingsFeed feed, ILocalizer localizer)
104109
BuildExportPanel();
105110
BuildTourPanel();
106111
BuildChecklistPanel();
107-
_themePanel = BuildThemePanel(localizer);
112+
_themePanel = _extraSurfaces.Count == 0 ? BuildThemePanel(localizer) : null;
108113

109114
_container = new PageContainer(localizer, _viewModel.Display.Title)
110115
{
@@ -160,7 +165,20 @@ private StackPanel BuildBody()
160165
stack.Children.Add(_checklistToast);
161166
stack.Children.Add(_search);
162167
stack.Children.Add(_conflictBanner);
163-
stack.Children.Add(Fade(_themePanel, 170));
168+
if (_extraSurfaces.Count > 0)
169+
{
170+
int surfaceDelay = 170;
171+
foreach (var surface in _extraSurfaces)
172+
{
173+
stack.Children.Add(Fade(surface, surfaceDelay));
174+
surfaceDelay += 20;
175+
}
176+
}
177+
else if (_themePanel is not null)
178+
{
179+
stack.Children.Add(Fade(_themePanel, 170));
180+
}
181+
164182
stack.Children.Add(Fade(_exportLink, 180));
165183
stack.Children.Add(Fade(_tourPanel, 200));
166184
stack.Children.Add(Fade(_checklistPanel, 220));
@@ -359,6 +377,12 @@ public void Dispose()
359377
_conflictBanner.Dispose();
360378
_container.Dispose();
361379
_viewModel.Dispose();
380+
381+
foreach (var surface in _extraSurfaces)
382+
{
383+
(surface as IDisposable)?.Dispose();
384+
}
385+
362386
GC.SuppressFinalize(this);
363387
}
364388

0 commit comments

Comments
 (0)