Skip to content

Feature: Display banner when all sections are hidden on the sidebar #17039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -3508,7 +3508,7 @@
<data name="StatusCenter_GitCloneInProgress_SubHeader" xml:space="preserve">
<value>Cloning {0} from "{1}" to "{2}"</value>
<comment>Shown in a StatusCenter card.</comment>
</data>
</data>
<data name="StatusCenter_InstallFontCanceled_Header" xml:space="preserve">
<value>Canceled installing {0} fonts</value>
<comment>Shown in a StatusCenter card.</comment>
Expand Down Expand Up @@ -3540,7 +3540,7 @@
<data name="StatusCenter_InstallFontInProgress_SubHeader" xml:space="preserve">
<value>Installing {0} font(s) from "{1}"</value>
<comment>Shown in a StatusCenter card.</comment>
</data>
</data>
<data name="StatusCenter_CopyCanceled_Header" xml:space="preserve">
<value>Canceled copying {0} item(s) to "{1}"</value>
<comment>Shown in a StatusCenter card.</comment>
Expand Down Expand Up @@ -4193,4 +4193,10 @@
<data name="EnableOmnibar" xml:space="preserve">
<value>Enable Omnibar</value>
</data>
<data name="SectionsHidden" xml:space="preserve">
<value>Sections hidden</value>
</data>
<data name="SectionsHiddenMessage" xml:space="preserve">
<value>You can add the sections back by right-clicking the sidebar area and selecting the sections you want to add.</value>
</data>
</root>
18 changes: 18 additions & 0 deletions src/Files.App/ViewModels/UserControls/SidebarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public SidebarDisplayMode SidebarDisplayMode
if (SetProperty(ref sidebarDisplayMode, value))
{
OnPropertyChanged(nameof(IsSidebarCompactSize));
OnPropertyChanged(nameof(AreSectionsHidden));
IsSidebarOpen = sidebarDisplayMode == SidebarDisplayMode.Expanded;
UpdateTabControlMargin();
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/Files.App/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@

<controls:SidebarView.Footer>
<StackPanel Padding="4" Spacing="4">
<InfoBar
Title="{helpers:ResourceString Name=SectionsHidden}"
IsClosable="False"
IsOpen="{x:Bind SidebarAdaptiveViewModel.AreSectionsHidden, Mode=OneWay}"
Message="{helpers:ResourceString Name=SectionsHiddenMessage}" />

<Border
Height="1"
HorizontalAlignment="Stretch"
Expand Down
Loading