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 3 commits 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
8 changes: 8 additions & 0 deletions src/Files.App.Controls/Sidebar/SidebarView.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
9 changes: 9 additions & 0 deletions src/Files.App.Controls/Sidebar/SidebarView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
<CompositeTransform x:Name="PaneColumnGridTransform" />
</Grid.RenderTransform>

<!-- Content -->
<ContentPresenter
Grid.RowSpan="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{x:Bind SidebarContent, Mode=OneWay}" />

<!-- Menu Items -->
<ItemsRepeaterScrollHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ScrollViewer
Expand Down
33 changes: 33 additions & 0 deletions src/Files.App/Assets/Sidebar/EmptySidebar_100_ThemeDark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/Files.App/Assets/Sidebar/EmptySidebar_100_ThemeLight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeDark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions src/Files.App/Assets/Sidebar/EmptySidebar_200_ThemeLight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeDark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/Files.App/Assets/Sidebar/EmptySidebar_48_ThemeLight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 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,7 @@
<data name="EnableOmnibar" xml:space="preserve">
<value>Enable Omnibar</value>
</data>
<data name="SectionsHiddenMessage" xml:space="preserve">
<value>You can add sections to the sidebar by right-clicking 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
Loading
Loading