From 130bccf91f8b138c2c63d893b8441e1b8d1e2797 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Wed, 25 Sep 2024 17:48:11 +0300 Subject: [PATCH] Adds toggling of file system browser tree view --- .../Components/FileSystemBrowser.razor | 61 +++++++++++++++++-- .../Components/FileSystemBrowser.razor.css | 28 +++++---- .../wwwroot/images/ui/toggle-tree-view.svg | 49 --------------- src/Lumina.sln | 7 +++ 4 files changed, 78 insertions(+), 67 deletions(-) delete mode 100644 src/Lumina.Presentation.Web/wwwroot/images/ui/toggle-tree-view.svg diff --git a/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor b/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor index 1d7e63b7..67bf700c 100644 --- a/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor +++ b/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor @@ -37,10 +37,42 @@ Forward Up One Level - Toggle Tree View - Toggle Thumbnails - @* Toggle Hidden Files *@ + + Toggle Tree View + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Toggle Thumbnails Toggle Hidden Files @@ -170,7 +202,7 @@
-
+
@foreach (FileSystemTreeNodeModel node in treeViewRootNodes) @@ -263,7 +295,8 @@ private string? selectedNodePath; private string? _path; private bool isSelectionMode; - private bool showHiddenElements; + private bool showHiddenElements; // TODO: take from config + private bool showFileSystemTreeView = true; // TODO: take from config private bool showPathSegmentDowpDown; private bool isNavigationPathEditMode; private int? expandedPathSegmentIndex; @@ -506,7 +539,8 @@ try { await GetNavigatorPathAsync(path).ConfigureAwait(false); - await GetFileSystemTreeAsync(path).ConfigureAwait(false); + if (showFileSystemTreeView) + await GetFileSystemTreeAsync(path).ConfigureAwait(false); await GetFileSystemItemsAsync(path).ConfigureAwait(false); } catch (ApiException ex) @@ -809,6 +843,21 @@ await JSRuntime.InvokeVoidAsync("toggleSelectionMode").ConfigureAwait(false); } + /// + /// Enables or disables the display of the file system tree view. + /// + private async Task ToggleFileSystemTreeViewAsync() + { + showFileSystemTreeView = !showFileSystemTreeView; + // if file system treeview needs to be displayed, get its file system tree structure from the API + if (showFileSystemTreeView && Path is not null) + { + if (!Path.EndsWith(pathSeparator)) + Path += pathSeparator; + await NavigateToPathAsync(Path, isForwardNavigation: false, isBackwardNavigation: false).ConfigureAwait(false); + } + } + /// /// Enables or disables the display of hidden file system files and directories. /// diff --git a/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor.css b/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor.css index beaa77b1..126c8e37 100644 --- a/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor.css +++ b/src/Lumina.Presentation.Web/Components/FileSystemBrowser.razor.css @@ -137,6 +137,13 @@ min-height: 0; } +#file-system-browser-file-system-treeview-container.collapsed { + max-width: 0px; + min-width: 0px; + border: 0px; + padding: 0px; +} + #file-system-browser-file-system-treeview { background-color: #131313; border: 1px solid var(--border-color-light); @@ -172,12 +179,9 @@ width: 100%; height: 100%; box-shadow: inset 2px 2px 5px var(--shadow-color); - - margin: auto; width: 100%; height: 100%; - display: flex; flex-direction: row; flex-wrap: nowrap; @@ -197,7 +201,6 @@ } #file-system-browser-file-system-explorer { - } div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) { @@ -844,7 +847,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) { box-sizing: border-box; } -.navigator-arrow { +.navigator-arrow { display: inline-block; width: 12px; height: 9px; @@ -886,6 +889,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) { max-height: calc(100vh - 100px); /* Subtracting a small value ensures a little space is left on top and bottom */ overflow-y: auto; } + .navigator-dropdown.opened { display: block; } @@ -1039,11 +1043,11 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) { order: 3; } - #file-system-browser-header-address-bar-container { - flex-direction: column; - align-items: stretch; - width: 100%; - } + #file-system-browser-header-address-bar-container { + flex-direction: column; + align-items: stretch; + width: 100%; + } .file-system-browser-header-address-bar-url { width: 100%; @@ -1077,7 +1081,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) { } #navigator-address-bar-container { - width: 100%; + width: 100%; flex-basis: 100%; } @@ -1139,4 +1143,4 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) { .e.medium-icons .text span { width: calc(100% - 14px); } -} \ No newline at end of file +} diff --git a/src/Lumina.Presentation.Web/wwwroot/images/ui/toggle-tree-view.svg b/src/Lumina.Presentation.Web/wwwroot/images/ui/toggle-tree-view.svg deleted file mode 100644 index eb9dd857..00000000 --- a/src/Lumina.Presentation.Web/wwwroot/images/ui/toggle-tree-view.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Lumina.sln b/src/Lumina.sln index 32eba438..c4c2c3b6 100644 --- a/src/Lumina.sln +++ b/src/Lumina.sln @@ -33,6 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{ACD16983-F1BD-4A92-B282-95BA8C456F6A}" ProjectSection(SolutionItems) = preProject + ..\docs\CONTRIBUTING.md = ..\docs\CONTRIBUTING.md ..\docs\LICENSE.md = ..\docs\LICENSE.md ..\README.md = ..\README.md ..\docs\SOURCES.md = ..\docs\SOURCES.md @@ -78,6 +79,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\.editorconfig = ..\.editorconfig EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{A0D07244-9CB2-4E30-85A5-97D520E4B9CC}" + ProjectSection(SolutionItems) = preProject + ..\docs\technical\templates\PULL_REQUEST_TEMPLATE.md = ..\docs\technical\templates\PULL_REQUEST_TEMPLATE.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -170,6 +176,7 @@ Global {6B3FC07B-6208-4544-ACFB-79243A59EA1A} = {3F057926-562F-4EF4-BFC0-EE62372D4551} {3680DAFB-10BA-4A0F-AE40-620D06DAF617} = {3F057926-562F-4EF4-BFC0-EE62372D4551} {6BD85BA8-B3C4-4D79-8858-F6D7676FF2CC} = {3C316ABB-08D5-4450-9A4E-91059DB54254} + {A0D07244-9CB2-4E30-85A5-97D520E4B9CC} = {0C0E5A56-AD29-4D0B-AB87-E865F8B933E2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4A55A28E-C657-4A0B-95EA-2931AE66004E}