-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Feature: Added an action to collapse/expand the sidebar #16422
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
Closed
Closed
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
90d6f5b
Added a ToggleSidebar action, imitating 4af2d59 as a template.
Erquint 54aea3b
Localization strings for ToggleSidebar action fixed.
Erquint 7b14ee6
Update src/Files.App/Actions/Show/ToggleSidebarAction.cs
Erquint f2d3360
Update src/Files.App/Actions/Show/ToggleSidebarAction.cs
Erquint ef98d2e
Revert "Update src/Files.App/Actions/Show/ToggleSidebarAction.cs"
Erquint 0ba4b8d
Update the SidebarViewModel after the change.
Erquint 7ef4211
It had to be an interface. Just spotted the typo.
Erquint 95c2189
Forgot the type…
Erquint 1c782a1
Apply suggestions from code review
Erquint 1c006f4
Update src/Files.App/Actions/Show/ToggleSidebarAction.cs
Erquint 80bb0be
Update src/Files.App/Actions/Show/ToggleSidebarAction.cs
Erquint 82f0d93
Update src/Files.App/Actions/Show/ToggleSidebarAction.cs
Erquint 2450492
Revert to ef98d2e841bdbd3154605aa1227576819b206b0f.
Erquint 10bfad6
Gonna try referencing a method directly.
Erquint b02f2bc
Revert that hack attempt accidentally pointing at a static method. Ne…
Erquint File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright (c) 2024 Files Community | ||
| // Licensed under the MIT License. See the LICENSE. | ||
|
|
||
| namespace Files.App.Actions | ||
| { | ||
| internal sealed class ToggleSidebarAction : ObservableObject, IToggleAction | ||
Erquint marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| private readonly IAppearanceSettingsService AppearanceSettingsService = Ioc.Default.GetRequiredService<IAppearanceSettingsService>(); | ||
|
|
||
| public string Label | ||
| => "ToggleSidebar".GetLocalizedResource(); | ||
|
|
||
| public string Description | ||
| => "ToggleSidebarDescription".GetLocalizedResource(); | ||
|
|
||
| public HotKey HotKey | ||
| => new(Keys.S, KeyModifiers.CtrlAlt); | ||
yaira2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public bool IsOn | ||
| => AppearanceSettingsService.IsSidebarOpen; | ||
Erquint marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public ToggleSidebarAction() | ||
| { | ||
| AppearanceSettingsService.PropertyChanged += ViewModel_PropertyChanged; | ||
Erquint marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public Task ExecuteAsync(object? parameter = null) | ||
| { | ||
| AppearanceSettingsService.IsSidebarOpen = !IsOn; | ||
|
|
||
| return Task.CompletedTask; | ||
| } | ||
|
|
||
| private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
| { | ||
| if (e.PropertyName is nameof(AppearanceSettingsService.IsSidebarOpen)) | ||
Erquint marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| OnPropertyChanged(nameof(IsOn)); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.