Adds toggling of file system browser tree view

This commit is contained in:
BinaryAlley committed 2024-09-25 17:48:11 +03:00
1 parent 1c983d8009
commit 130bccf91f
4 files changed
+78 -67

No files matched your search

@@ -37,10 +37,42 @@
<img src="images/ui/forward.svg" class="navigation-icon" alt="Forward" title="Forward" @onclick="NavigateForwardAsync" />
<img src="images/ui/up.svg" class="navigation-icon" alt="Up One Level" title="Up One Level" @onclick="NavigateUpAsync" />
</div>
<img src="images/ui/toggle-tree-view.svg" id="navigator-toggle-tree-view-button" alt="Toggle Tree View" title="Toggle Tree View" class="navigator-icon" />
<img src="images/ui/toggle-thumbnails.svg" id="navigator-toggle-thumbnails-button" alt="Toggle Thumbnails" title="Toggle Thumbanils" class="navigator-icon" />
@* <img src="images/ui/toggle-hidden.svg" id="navigator-toggle-hidden-button" alt="Toggle Hidden Files" title="Toggle Hidden Files" class="navigator-icon" /> *@
<svg @onclick="ToggleFileSystemTreeViewAsync" id="navigator-toggle-tree-view-button" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Toggle Tree View</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill @(showFileSystemTreeView ? " enabled" : string.Empty)" filter="url(#glow)" d="M 4 4 L 4 14 L 9 14 L 9 23 L 18 23 L 18 28 L 28 28 L 28 18 L 18 18 L 18 22 L 10 22 L 10 14 L 14 14 L 14 9 L 18 9 L 18 14 L 28 14 L 28 4 L 18 4 L 18 8 L 14 8 L 14 4 L 4 4 z M 5 5 L 13 5 L 13 13 L 5 13 L 5 5 z M 19 5 L 27 5 L 27 13 L 19 13 L 19 5 z" />
</g>
</svg>
<img src="images/ui/toggle-thumbnails.svg" id="navigator-toggle-thumbnails-button" alt="Toggle Thumbnails" title="Toggle Thumbanils" class="navigator-icon" />
<svg @onclick="ToggleHiddenElementsModeAsync" id="navigator-toggle-hidden-button" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Toggle Hidden Files</title>
<defs>
@@ -170,7 +202,7 @@
</div>
<div id="file-system-browser-file-system-container">
<!--File System Tree View-->
<div id="file-system-browser-file-system-treeview-container">
<div id="file-system-browser-file-system-treeview-container" class="@(showFileSystemTreeView ? string.Empty: "collapsed")">
<div id="file-system-browser-file-system-treeview">
<div class="treeview">
@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);
}
/// <summary>
/// Enables or disables the display of the file system tree view.
/// </summary>
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);
}
}
/// <summary>
/// Enables or disables the display of hidden file system files and directories.
/// </summary>
@@ -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);
}
}
}
@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="64" height="64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#039bfc;
}
</style>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1"/>
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur"/>
<feFlood flood-color="#039bfc" result="color"/>
<feComposite in="color" in2="blur" operator="in" result="softGlowColored"/>
<feMerge>
<feMergeNode in="softGlowColored"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
<linearGradient id="b" x1="399.57" x2="399.57" y1="545.8" y2="517.8" gradientTransform="matrix(2.1429 0 0 2.1429 -723.44 -1107.5)" gradientUnits="userSpaceOnUse">
<stop stop-color="#3889e9" offset="0"/>
<stop stop-color="#5ea5fb" offset="1"/>
</linearGradient>
<linearGradient id="b-3" x1="399.57" x2="399.57" y1="545.8" y2="517.8" gradientTransform="matrix(2.1429 0 0 2.1429 -753.02 -1107.5)" gradientUnits="userSpaceOnUse">
<stop stop-color="#3889e9" offset="0"/>
<stop stop-color="#5ea5fb" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient1299" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0"/>
<stop stop-color="#039bfc" offset=".225"/>
<stop stop-color="#039bfc" offset=".5"/>
<stop stop-color="#039bfc" offset=".775"/>
<stop stop-color="#039bfc" stop-opacity="0" offset="1"/>
</linearGradient>
</defs>
<circle cx="134.94" cy="32.044" r="0" fill="url(#b)" stroke-width="1.5715"/>
<circle cx="105.36" cy="32.044" r="0" fill="url(#b-3)" stroke-width="1.5715"/>
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient1299)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)"/>
<g stroke-linecap="round" stroke-linejoin="round">
<rect x="9.5" y="9.5" width="45" height="45" ry="5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)"/>
</g>
<g transform="translate(8,8) scale(1.5)">
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 4 4 L 4 14 L 9 14 L 9 23 L 18 23 L 18 28 L 28 28 L 28 18 L 18 18 L 18 22 L 10 22 L 10 14 L 14 14 L 14 9 L 18 9 L 18 14 L 28 14 L 28 4 L 18 4 L 18 8 L 14 8 L 14 4 L 4 4 z M 5 5 L 13 5 L 13 13 L 5 13 L 5 5 z M 19 5 L 27 5 L 27 13 L 19 13 L 19 5 z" id="path6" class="ColorScheme-Text" filter="url(#glow)"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

+7
View File
@@ -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}