From a0fece509725c2372668560d5cde63743fa0b7b0 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 10 Apr 2025 18:07:06 -0400 Subject: [PATCH 1/2] Feature: Display banner when all sections are hidden on the sidebar --- src/Files.App/Strings/en-US/Resources.resw | 10 ++++++++-- .../UserControls/SidebarViewModel.cs | 18 ++++++++++++++++++ src/Files.App/Views/MainPage.xaml | 6 ++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index c829bb40622f..44e092e40155 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -3508,7 +3508,7 @@ Cloning {0} from "{1}" to "{2}" Shown in a StatusCenter card. - + Canceled installing {0} fonts Shown in a StatusCenter card. @@ -3540,7 +3540,7 @@ Installing {0} font(s) from "{1}" Shown in a StatusCenter card. - + Canceled copying {0} item(s) to "{1}" Shown in a StatusCenter card. @@ -4193,4 +4193,10 @@ Enable Omnibar + + Sections hidden + + + You can add the sections back by right-clicking the sidebar area and selecting the sections you want to add. + \ No newline at end of file diff --git a/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs b/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs index dafd4cb579b3..37c13ec64a7e 100644 --- a/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs @@ -59,6 +59,7 @@ public SidebarDisplayMode SidebarDisplayMode if (SetProperty(ref sidebarDisplayMode, value)) { OnPropertyChanged(nameof(IsSidebarCompactSize)); + OnPropertyChanged(nameof(AreSectionsHidden)); IsSidebarOpen = sidebarDisplayMode == SidebarDisplayMode.Expanded; UpdateTabControlMargin(); } @@ -134,6 +135,16 @@ public bool IsSidebarOpen } } + public bool AreSectionsHidden => + !ShowPinnedFoldersSection && + !ShowLibrarySection && + !ShowDrivesSection && + !ShowCloudDrivesSection && + !ShowNetworkSection && + (!ShowWslSection || WSLDistroManager.Distros.Any() == false) && + !ShowFileTagsSection && + SidebarDisplayMode is not SidebarDisplayMode.Compact; + public bool ShowPinnedFoldersSection { get => UserSettingsService.GeneralSettingsService.ShowPinnedSection; @@ -635,30 +646,37 @@ private async void UserSettingsService_OnSettingChangedEvent(object sender, Sett case nameof(UserSettingsService.GeneralSettingsService.ShowPinnedSection): await UpdateSectionVisibilityAsync(SectionType.Pinned, ShowPinnedFoldersSection); OnPropertyChanged(nameof(ShowPinnedFoldersSection)); + OnPropertyChanged(nameof(AreSectionsHidden)); break; case nameof(UserSettingsService.GeneralSettingsService.ShowLibrarySection): await UpdateSectionVisibilityAsync(SectionType.Library, ShowLibrarySection); OnPropertyChanged(nameof(ShowLibrarySection)); + OnPropertyChanged(nameof(AreSectionsHidden)); break; case nameof(UserSettingsService.GeneralSettingsService.ShowCloudDrivesSection): await UpdateSectionVisibilityAsync(SectionType.CloudDrives, ShowCloudDrivesSection); OnPropertyChanged(nameof(ShowCloudDrivesSection)); + OnPropertyChanged(nameof(AreSectionsHidden)); break; case nameof(UserSettingsService.GeneralSettingsService.ShowDrivesSection): await UpdateSectionVisibilityAsync(SectionType.Drives, ShowDrivesSection); OnPropertyChanged(nameof(ShowDrivesSection)); + OnPropertyChanged(nameof(AreSectionsHidden)); break; case nameof(UserSettingsService.GeneralSettingsService.ShowNetworkSection): await UpdateSectionVisibilityAsync(SectionType.Network, ShowNetworkSection); OnPropertyChanged(nameof(ShowNetworkSection)); + OnPropertyChanged(nameof(AreSectionsHidden)); break; case nameof(UserSettingsService.GeneralSettingsService.ShowWslSection): await UpdateSectionVisibilityAsync(SectionType.WSL, ShowWslSection); OnPropertyChanged(nameof(ShowWslSection)); + OnPropertyChanged(nameof(AreSectionsHidden)); break; case nameof(UserSettingsService.GeneralSettingsService.ShowFileTagsSection): await UpdateSectionVisibilityAsync(SectionType.FileTag, ShowFileTagsSection); OnPropertyChanged(nameof(ShowFileTagsSection)); + OnPropertyChanged(nameof(AreSectionsHidden)); break; } } diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml index 9cc2f82fb00d..d894999baeea 100644 --- a/src/Files.App/Views/MainPage.xaml +++ b/src/Files.App/Views/MainPage.xaml @@ -261,6 +261,12 @@ + + Date: Mon, 21 Apr 2025 11:13:10 -0400 Subject: [PATCH 2/2] Updated section --- .../Sidebar/SidebarView.Properties.cs | 8 ++ .../Sidebar/SidebarView.xaml | 9 ++ .../Sidebar/EmptySidebar_100_ThemeDark.svg | 33 +++++++ .../Sidebar/EmptySidebar_100_ThemeLight.svg | 33 +++++++ .../Sidebar/EmptySidebar_200_ThemeDark.svg | 43 +++++++++ .../Sidebar/EmptySidebar_200_ThemeLight.svg | 43 +++++++++ .../Sidebar/EmptySidebar_48_ThemeDark.svg | 9 ++ .../Sidebar/EmptySidebar_48_ThemeLight.svg | 9 ++ src/Files.App/Strings/en-US/Resources.resw | 5 +- src/Files.App/Views/MainPage.xaml | 91 +++++++++++++++++-- src/Files.App/Views/MainPage.xaml.cs | 15 +++ 11 files changed, 288 insertions(+), 10 deletions(-) create mode 100644 src/Files.App/Assets/Sidebar/EmptySidebar_100_ThemeDark.svg create mode 100644 src/Files.App/Assets/Sidebar/EmptySidebar_100_ThemeLight.svg create mode 100644 src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeDark.svg create mode 100644 src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeLight.svg create mode 100644 src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeDark.svg create mode 100644 src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeLight.svg diff --git a/src/Files.App.Controls/Sidebar/SidebarView.Properties.cs b/src/Files.App.Controls/Sidebar/SidebarView.Properties.cs index c6dfc8460122..966484265344 100644 --- a/src/Files.App.Controls/Sidebar/SidebarView.Properties.cs +++ b/src/Files.App.Controls/Sidebar/SidebarView.Properties.cs @@ -21,6 +21,14 @@ public UIElement InnerContent public static readonly DependencyProperty InnerContentProperty = DependencyProperty.Register(nameof(InnerContent), typeof(UIElement), typeof(SidebarView), new PropertyMetadata(null)); + public UIElement SidebarContent + { + get { return (UIElement)GetValue(SidebarContentProperty); } + set { SetValue(SidebarContentProperty, value); } + } + public static readonly DependencyProperty SidebarContentProperty = + DependencyProperty.Register("SidebarContent", typeof(UIElement), typeof(SidebarView), new PropertyMetadata(null)); + public UIElement Footer { get { return (UIElement)GetValue(FooterProperty); } diff --git a/src/Files.App.Controls/Sidebar/SidebarView.xaml b/src/Files.App.Controls/Sidebar/SidebarView.xaml index 98d2a9770d6d..aae90d4bf35d 100644 --- a/src/Files.App.Controls/Sidebar/SidebarView.xaml +++ b/src/Files.App.Controls/Sidebar/SidebarView.xaml @@ -57,6 +57,15 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Files.App/Assets/Sidebar/EmptySidebar_100_ThemeLight.svg b/src/Files.App/Assets/Sidebar/EmptySidebar_100_ThemeLight.svg new file mode 100644 index 000000000000..9b09b8760503 --- /dev/null +++ b/src/Files.App/Assets/Sidebar/EmptySidebar_100_ThemeLight.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeDark.svg b/src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeDark.svg new file mode 100644 index 000000000000..2c0ac5003ea2 --- /dev/null +++ b/src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeDark.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeLight.svg b/src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeLight.svg new file mode 100644 index 000000000000..202e31370a22 --- /dev/null +++ b/src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeLight.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeDark.svg b/src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeDark.svg new file mode 100644 index 000000000000..55ac929e7e6d --- /dev/null +++ b/src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeDark.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeLight.svg b/src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeLight.svg new file mode 100644 index 000000000000..d2fde0aae14e --- /dev/null +++ b/src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeLight.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index 44e092e40155..6a4a933f70a4 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -4193,10 +4193,7 @@ Enable Omnibar - - Sections hidden - - You can add the sections back by right-clicking the sidebar area and selecting the sections you want to add. + You can add sections to the sidebar by right-clicking and selecting the sections you want to add. \ No newline at end of file diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml index d894999baeea..e735afbf2d7d 100644 --- a/src/Files.App/Views/MainPage.xaml +++ b/src/Files.App/Views/MainPage.xaml @@ -31,6 +31,24 @@ + + + ms-appx:///Assets/Sidebar/EmptySidebar_48_ThemeLight.svg + ms-appx:///Assets/Sidebar/EmptySidebar_100_ThemeLight.svg + ms-appx:///Assets/Sidebar/EmptySidebar_200_ThemeLight.svg + + + ms-appx:///Assets/Sidebar/EmptySidebar_48_ThemeDark.svg + ms-appx:///Assets/Sidebar/EmptySidebar_100_ThemeDark.svg + ms-appx:///Assets/Sidebar/EmptySidebar_200_ThemeDark.svg + + + ms-appx:///Assets/Sidebar/EmptySidebar_48_ThemeDark.svg + ms-appx:///Assets/Sidebar/EmptySidebar_100_ThemeDark.svg + ms-appx:///Assets/Sidebar/EmptySidebar_200_ThemeDark.svg + + + True False @@ -259,14 +277,34 @@ + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -343,6 +421,7 @@ + diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index 1ad32eb98844..4d8bf7a8d059 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -55,6 +55,8 @@ public MainPage() _updateDateDisplayTimer = DispatcherQueue.CreateTimer(); _updateDateDisplayTimer.Interval = TimeSpan.FromSeconds(1); _updateDateDisplayTimer.Tick += UpdateDateDisplayTimer_Tick; + + ApplySidebarWidthState(); } private async Task PromptForReviewAsync() @@ -120,6 +122,9 @@ private void UserSettingsService_OnSettingChangedEvent(object? sender, SettingCh case nameof(IInfoPaneSettingsService.IsInfoPaneEnabled): LoadPaneChanged(); break; + case nameof(IAppearanceSettingsService.SidebarWidth): + ApplySidebarWidthState(); + break; } } @@ -434,6 +439,16 @@ private void PaneSplitter_ManipulationCompleted(object sender, ManipulationCompl this.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.Arrow)); } + private void ApplySidebarWidthState() + { + if (UserSettingsService.AppearanceSettingsService.SidebarWidth > 340) + VisualStateManager.GoToState(this, "LargeSidebarWidthState", true); + else if (UserSettingsService.AppearanceSettingsService.SidebarWidth > 280) + VisualStateManager.GoToState(this, "MediumSidebarWidthState", true); + else + VisualStateManager.GoToState(this, "SmallSidebarWidthState", true); + } + private void LoadPaneChanged() { try