Implements directory browser dialog, part 2: path navigator
No files matched your search
@@ -30,6 +30,15 @@ Any modifications or adaptations made to the original graphics and styles are my
|
||||
|
||||
To explore more about Enlightenment and their contributions to the open-source community, please visit the [official Enlightenment website](https://www.enlightenment.org/).
|
||||
|
||||
### Icons
|
||||
|
||||
Most icons were taken from [Lyra Icon Theme](https://github.com/yeyushengfan258/Lyra-icon-theme/tree/master/src), a beautiful icon theme for Linux desktops.
|
||||
|
||||
Several icons used in this project were adapted from icons sourced from [svgrepo](https://www.svgrepo.com/).
|
||||
|
||||
- [`toggle-thumbnails.svg`](https://www.svgrepo.com/svg/370469/page-image) (Public Domain license)
|
||||
- [`toggle-hidden.svg`](https://www.svgrepo.com/svg/470389/hidden) (MIT License)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the GPLv3.0. See the [LICENSE](./docs/LICENSE.md) file for details.
|
||||
@@ -0,0 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Query for retrieving the parent of a file system path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The path for which to get the parent.</param>
|
||||
public record GetPathParentQuery(string Path) : IRequest<ErrorOr<IEnumerable<PathSegmentResponse>>>;
|
||||
@@ -0,0 +1,50 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Mapster;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the query to get the parent of a file system path.
|
||||
/// </summary>
|
||||
public class GetPathParentQueryHandler : IRequestHandler<GetPathParentQuery, ErrorOr<IEnumerable<PathSegmentResponse>>>
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IPathService _pathService;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPathParentQueryHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="pathService">Injected service for managing file system paths.</param>
|
||||
public GetPathParentQueryHandler(IPathService pathService)
|
||||
{
|
||||
_pathService = pathService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the parent of the specified file system path.
|
||||
/// </summary>
|
||||
/// <param name="request">The query containing the requested path.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="PathSegmentResponse"/>, or an error message.
|
||||
/// </returns>
|
||||
public ValueTask<ErrorOr<IEnumerable<PathSegmentResponse>>> Handle(GetPathParentQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<PathSegment>> result = _pathService.GoUpOneLevel(request.Path);
|
||||
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(result.Value.Adapt<IEnumerable<PathSegmentResponse>>()), errors => errors));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="GetPathParentQuery"/>.
|
||||
/// </summary>
|
||||
public class GetPathParentQueryValidator : AbstractValidator<GetPathParentQuery>
|
||||
{
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPathParentQueryValidator"/> class.
|
||||
/// </summary>
|
||||
public GetPathParentQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="GetPathRootQuery"/>.
|
||||
/// </summary>
|
||||
public class GetPathRootQueryValidator : AbstractValidator<GetPathRootQuery>
|
||||
{
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPathRootQueryValidator"/> class.
|
||||
/// </summary>
|
||||
public GetPathRootQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Mediator;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Query for validating a path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The path to be validated.</param>
|
||||
public record ValidatePathQuery(string Path) : IRequest<PathValidResponse>;
|
||||
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the query to validate a file system path.
|
||||
/// </summary>
|
||||
public class ValidatePathQueryHandler : IRequestHandler<ValidatePathQuery, PathValidResponse>
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IPathService _pathService;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ValidatePathQueryHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="pathService">Injected service for managing file system paths.</param>
|
||||
public ValidatePathQueryHandler(IPathService pathService)
|
||||
{
|
||||
_pathService = pathService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Validates the specified file system path.
|
||||
/// </summary>
|
||||
/// <param name="request">The query containing the request.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if the specified path is valid, <see langword="false"/> otherwise.
|
||||
/// </returns>
|
||||
public ValueTask<PathValidResponse> Handle(ValidatePathQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
return ValueTask.FromResult(new PathValidResponse(_pathService.IsValidPath(request.Path)));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Paths.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="ValidatePathQuery"/>.
|
||||
/// </summary>
|
||||
public class ValidatePathQueryValidator : AbstractValidator<ValidatePathQuery>
|
||||
{
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ValidatePathQueryValidator"/> class.
|
||||
/// </summary>
|
||||
public ValidatePathQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
@@ -8,6 +9,7 @@ namespace Lumina.Contracts.Responses.FileManagement;
|
||||
/// Represents a response containing the file system platform type.
|
||||
/// </summary>
|
||||
/// <param name="PlatformType">The returned file system platform type.</param>
|
||||
[DebuggerDisplay("{PlatformType}")]
|
||||
public record FileSystemTypeResponse(
|
||||
PlatformType PlatformType
|
||||
);
|
||||
@@ -1,9 +1,14 @@
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a response containing a file system path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The returned path.</param>
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public record PathSegmentResponse(
|
||||
string Path
|
||||
);
|
||||
@@ -1,9 +1,14 @@
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a response to the inquiry about the system's path separator.
|
||||
/// </summary>
|
||||
/// <param name="Separator">The system's path separator.</param>
|
||||
[DebuggerDisplay("{Separator}")]
|
||||
public record PathSeparatorResponse(
|
||||
string Separator
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a response to the inquiry about the validity of a file system path.
|
||||
/// </summary>
|
||||
/// <param name="IsValid">Whether a file system path is valid or not.</param>
|
||||
[DebuggerDisplay("{IsValid}")]
|
||||
public record PathValidResponse(
|
||||
bool IsValid
|
||||
);
|
||||
@@ -1,9 +1,14 @@
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a response containing the result of splitting a file system path.
|
||||
/// </summary>
|
||||
/// <param name="PathSegments">The returned path segments.</param>
|
||||
[DebuggerDisplay("{PathSegments}")]
|
||||
public record SplitPathResponse(
|
||||
string[] PathSegments
|
||||
);
|
||||
@@ -50,6 +50,29 @@ public class PathController : ApiController
|
||||
return result.Match(result => Ok(result), errors => Problem(errors));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path separator character of the file system.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-path-separator")]
|
||||
public async Task<IActionResult> GetPathSeparator(CancellationToken cancellationToken)
|
||||
{
|
||||
PathSeparatorResponse result = await _mediator.Send(new GetPathSeparatorQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path separator character of the file system.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the parent path.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-path-parent")]
|
||||
public async Task<IActionResult> GetPathParent([FromQuery, ModelBinder(typeof(UrlStringBinder))] string path, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<PathSegmentResponse>> result = await _mediator.Send(new GetPathParentQuery(path), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(result => Ok(result), errors => Problem(errors));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Combines <paramref name="originalPath"/> with <paramref name="newPath"/>.
|
||||
/// </summary>
|
||||
@@ -63,17 +86,6 @@ public class PathController : ApiController
|
||||
return result.Match(result => Ok(result), errors => Problem(errors));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path separator character of the file system.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-path-separator")]
|
||||
public async Task<IActionResult> GetPathSeparator(CancellationToken cancellationToken)
|
||||
{
|
||||
PathSeparatorResponse result = await _mediator.Send(new GetPathSeparatorQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path components of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
@@ -85,5 +97,17 @@ public class PathController : ApiController
|
||||
ErrorOr<IEnumerable<PathSegmentResponse>> result = await _mediator.Send(new SplitPathCommand(path), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(result => Ok(result), errors => Problem(errors));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the validity of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to be validated.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("validate")]
|
||||
public async Task<IActionResult> ValidatePath([FromQuery, ModelBinder(typeof(UrlStringBinder))] string path, CancellationToken cancellationToken)
|
||||
{
|
||||
PathValidResponse result = await _mediator.Send(new ValidatePathQuery(path), cancellationToken).ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Model containing the file system platform type.
|
||||
/// </summary>
|
||||
/// </summary>`
|
||||
[DebuggerDisplay("{PlatformType}")]
|
||||
public class FileSystemTypeModel
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a response to the inquiry about the validity of a file system path.
|
||||
/// </summary>
|
||||
/// <param name="IsValid">Whether a file system path is valid or not.</param>
|
||||
[DebuggerDisplay("{IsValid}")]
|
||||
public record PathValidModel(
|
||||
bool IsValid
|
||||
);
|
||||
@@ -1,40 +1,104 @@
|
||||
@using Lumina.Presentation.Web.Common.Models.UI
|
||||
@using Lumina.Presentation.Web.Common.Api
|
||||
@using Lumina.Presentation.Web.Common.Enums.FileSystem
|
||||
@using Lumina.Presentation.Web.Common.Exceptions
|
||||
@using Lumina.Presentation.Web.Common.Models.Common
|
||||
@using Lumina.Presentation.Web.Common.Models.FileManagement
|
||||
@using Lumina.Presentation.Web.Common.Models.UI
|
||||
@using Microsoft.AspNetCore.Components
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject IApiHttpClient _apiHttpClient
|
||||
|
||||
<div id="directory-browser-dialog" class="container-background above-modal">
|
||||
<div id="directory-browser-content">
|
||||
<div id="directory-browser-header">
|
||||
<div id="directory-browser-shine-spark"></div>
|
||||
<div id="directory-browser-shine-effect"></div>
|
||||
<div id="directory-browser-header-navigation-container">
|
||||
<div class="directory-browser-header-navigation">
|
||||
<img src="images/ui/back.svg" class="navigation-icon" alt="Back" title="Back"/>
|
||||
<img src="images/ui/forward.svg" class="navigation-icon" alt="Forward" title="Forward" />
|
||||
<img src="images/ui/up.svg" class="navigation-icon" alt="Up one level" title="Up one level" />
|
||||
<div id="directory-browser-header-navigation-container">
|
||||
<!--File System Navigator-->
|
||||
<div id="navigator-view-mode-container">
|
||||
<img src="images/ui/list.png" id="navigator-list-view" alt="List View" title="List View" />
|
||||
<img src="images/ui/details.png" id="navigator-details-view" alt="Details View" title="Details View" />
|
||||
<img src="images/ui/small-icons.png" id="navigator-small-icons-view" alt="Small Icons View" title="Small Icons View" />
|
||||
<img src="images/ui/medium-icons.png" id="navigator-medium-icons-view" alt="Medium Icons View" title="Medium Icons View" />
|
||||
<img src="images/ui/large-icons.png" id="navigator-large-icons-view" alt="Large Icons View" title="Large Icons View" />
|
||||
<img src="images/ui/extra-large-icons.png" id="navigator-extra-large-icons-view" alt="Extra Large Icons View" title="Extra Large Icons View" />
|
||||
</div>
|
||||
<div id="directory-browser-header-address-bar-container">
|
||||
<EnlightenmentInput CssClass="directory-browser-header-address-bar-url" Type="text" Name="addressBar" Height="22" AutoComplete="true" />
|
||||
<div class="directory-browser-header-address-bar-actions">
|
||||
<img src="images/ui/favorite-star.svg" class="navigation-icon favorite-unselected" alt="Favorite directory" title="Favorite directory" />
|
||||
<EnlightenmentButton CssClass="directory-browser-content-new-directory" Width="120">New Directory</EnlightenmentButton>
|
||||
<div id="navigator-navigation-controls-container">
|
||||
<div id="navigator-history">
|
||||
<img src="images/ui/back.svg" class="navigation-icon" alt="Back" title="Back" />
|
||||
<img src="images/ui/forward.svg" class="navigation-icon" alt="Forward" title="Forward" />
|
||||
<img src="images/ui/up.svg" class="navigation-icon" alt="Up One Level" title="Up One Level" />
|
||||
</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" />
|
||||
</div>
|
||||
<div id="navigator-address-bar-container">
|
||||
<div id="navigator-address-bar-group">
|
||||
<EnlightenmentInput CssClass="navigator-address-bar-input" Type="text" Value="@Path" Name="navigator-address-bar-input" AutoComplete="true" />
|
||||
<div id="navigator-address-bar">
|
||||
<ul id="navigator-path-segments">
|
||||
@if (pathSegments?.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < pathSegments.Length; i++)
|
||||
{
|
||||
var localIndex = i; // capture the current index in a local variable, otherwise it would be evaluated when the loop ends
|
||||
var pathSegment = pathSegments[i];
|
||||
<li id="path-segment-@i">
|
||||
<div class="navigator-combobox inline-block">
|
||||
<div class="shine-effect" style="top: 1px;"></div>
|
||||
<input type="checkbox" class="navigator-toggle-checkbox" id="segment-toggle-@i"
|
||||
@onchange="@(e => OnNavigatorPathSegmentCheckChangeHandler(e, localIndex))" />
|
||||
<label class="navigator-toggle" for="segment-toggle-@i">
|
||||
<span class="navigator-selected-text">@pathSegment.Path</span>
|
||||
<span class="navigator-arrow"></span>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<EnlightenmentButton CssClass="navigator-edit-path-button" IsConfirmButton="false" Height="28" Width="35">
|
||||
<img src="images/ui/edit.svg" id="navigator-edit-icon" alt="Edit Path" title="Edit Path" />
|
||||
</EnlightenmentButton>
|
||||
<EnlightenmentButton CssClass="navigator-navigate-button" Height="28" Width="35">
|
||||
<img src="images/ui/check.svg" id="navigator-navigate-icon" alt="Navigate" title="Navigate" />
|
||||
</EnlightenmentButton>
|
||||
<EnlightenmentButton CssClass="directory-browser-content-new-directory" IsConfirmButton="false" Width="35" Height="28">
|
||||
<img src="images/ui/new-directory.svg" id="navigator-new-directory-icon" alt="New Directory" title="New Directory" />
|
||||
</EnlightenmentButton>
|
||||
<EnlightenmentButton CssClass="directory-browser-content-favorite-directory" IsConfirmButton="false" Width="35" Height="28">
|
||||
<img src="images/ui/favorite-star.svg" class="navigation-icon favorite-unselected" alt="Favorite directory" title="Favorite directory" />
|
||||
</EnlightenmentButton>
|
||||
</div>
|
||||
<!--End File System Navigator-->
|
||||
</div>
|
||||
</div>
|
||||
<div id="directory-browser-file-system-container">
|
||||
<!--File System Tree View-->
|
||||
<div id="directory-browser-file-system-treeview-container">
|
||||
<div id="directory-browser-file-system-treeview">
|
||||
<FileSystemTreeView InitialPath="@savedPath" OnNodeSelected="HandleNodeSelected" />
|
||||
<div class="treeview">
|
||||
@foreach (FileSystemTreeNodeModel node in treeViewRootNodes)
|
||||
{
|
||||
<FileSystemTreeViewNode Node="node" OnExpand="ExpandNode" OnNodeSelected="HandleNodeSelected" selectedNodePath="@selectedNodePath" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<EnlightenmentCombobox CssClass="directory-browser-file-system-sources" Items="null" @bind-SelectedItem="selectedValue" />
|
||||
</div>
|
||||
<div id="directory-browser-file-system-directories-container">
|
||||
<div id="directory-browser-file-system-directories"></div>
|
||||
</div>
|
||||
<!--End File System Tree View-->
|
||||
</div>
|
||||
<div id="directory-browser-actions-container">
|
||||
<div id="directory-browser-actions-path-container">
|
||||
<label class="text-light-one">Directory</label>
|
||||
<EnlightenmentInput Type="text" Name="selectedDirectory" IsReadOnly="true" AutoComplete="true" />
|
||||
<EnlightenmentInput Type="text" Name="selected-directory" IsReadOnly="true" AutoComplete="true" />
|
||||
</div>
|
||||
<div id="directory-browser-actions">
|
||||
<EnlightenmentButton IsConfirmButton="false">Cancel</EnlightenmentButton>
|
||||
@@ -51,12 +115,205 @@
|
||||
<EnlightenmentButton>Confirm</EnlightenmentButton> *@
|
||||
</div>
|
||||
|
||||
<!--The drop down for the navigator path segments needs to be absolute, such that it is not affected by the parent clipping-->
|
||||
@if (showPathSegmentDowpDown && expandedPathSegmentIndex.HasValue && pathSegmentsSubdirectoriesCache.ContainsKey(expandedPathSegmentIndex.Value))
|
||||
{
|
||||
<div class="navigator-dropdown opened" id="navigatorDropdown" data-path-segment-id="path-segment-@expandedPathSegmentIndex">
|
||||
@foreach (var directory in pathSegmentsSubdirectoriesCache[expandedPathSegmentIndex.Value])
|
||||
{
|
||||
<div class="navigator-option" data-path="@directory.Path" @onclick="@(() => HandleNodeSelected(directory.Path))">@directory.Name</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@code {
|
||||
private ComboboxItem<string>? selectedValue;
|
||||
private string savedPath = string.Empty;
|
||||
[Parameter]
|
||||
public string? Path { get; set; }
|
||||
|
||||
private void HandleNodeSelected(string path)
|
||||
public EventCallback<string> OnNodeSelected { get; set; }
|
||||
|
||||
private List<FileSystemTreeNodeModel> treeViewRootNodes = [];
|
||||
private FileSystemTypeModel fileSystemType = null!;
|
||||
private ComboboxItem<string>? selectedValue;
|
||||
private PathSegmentModel[]? pathSegments;
|
||||
private string pathSeparator = "/";
|
||||
private string? selectedNodePath;
|
||||
private string? _path;
|
||||
private bool showPathSegmentDowpDown;
|
||||
private int? expandedPathSegmentIndex;
|
||||
private Dictionary<int, List<FileSystemTreeNodeModel>> pathSegmentsSubdirectoriesCache = [];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component.
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
fileSystemType = await _apiHttpClient.GetAsync<FileSystemTypeModel>("file-system/get-type").ConfigureAwait(false);
|
||||
// ask the API server for the system path separator
|
||||
PathSeparatorModel apiPathSeparator = await _apiHttpClient.GetAsync<PathSeparatorModel>("path/get-path-separator").ConfigureAwait(false);
|
||||
pathSeparator = apiPathSeparator.Separator; // TODO: handle error
|
||||
|
||||
// treeview
|
||||
// on Windows, ask the list of drives
|
||||
if (fileSystemType?.PlatformType == PlatformType.Windows)
|
||||
{
|
||||
List<FileSystemTreeNodeModel> drives = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>("drives/get-drives").ConfigureAwait(false);
|
||||
treeViewRootNodes.AddRange(drives);
|
||||
}
|
||||
else
|
||||
{
|
||||
// on UNIX, just add the root "/"
|
||||
treeViewRootNodes.Add(new FileSystemTreeNodeModel()
|
||||
{
|
||||
Path = pathSeparator!,
|
||||
IsExpanded = true,
|
||||
ItemType = FileSystemItemType.Root,
|
||||
Name = pathSeparator!
|
||||
});
|
||||
}
|
||||
if (Path is not null)
|
||||
{
|
||||
var isPathValidResponse = await _apiHttpClient.GetAsync<PathValidModel>($"path/validate?path={Uri.EscapeDataString(Path)}").ConfigureAwait(false);
|
||||
if (!isPathValidResponse.IsValid)
|
||||
{
|
||||
// TODO: display error message to user
|
||||
Console.WriteLine("specified path is not valid!");
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there was an initial path saved from a previous session, load the full tree up to that initial path
|
||||
// ask the whole tree for the saved path
|
||||
List<FileSystemTreeNodeModel> initialTree = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"directories/get-directory-tree?path={Uri.EscapeDataString(Path!)}").ConfigureAwait(false);
|
||||
if (initialTree is not null && initialTree.Count > 0)
|
||||
{
|
||||
pathSegments = await _apiHttpClient.GetAsync<PathSegmentModel[]>($"path/split?path={Uri.EscapeDataString(Path!)}").ConfigureAwait(false);
|
||||
StateHasChanged();
|
||||
// take the root of the retrieved tree, and try to match it against a drive in the retrieved list of drives, on Windows; on Unix, add it as the unique root path
|
||||
PathSegmentModel pathRoot = await _apiHttpClient.GetAsync<PathSegmentModel>($"path/get-path-root?path={Uri.EscapeDataString(Path!)}").ConfigureAwait(false);
|
||||
if (fileSystemType?.PlatformType == PlatformType.Windows)
|
||||
{
|
||||
FileSystemTreeNodeModel? driveNode = treeViewRootNodes.FirstOrDefault(drive => drive.Path.Equals(pathRoot.Path, StringComparison.OrdinalIgnoreCase));
|
||||
// if a drive was matched, make the retrieved tree a child of it
|
||||
if (driveNode is not null)
|
||||
{
|
||||
int index = treeViewRootNodes.IndexOf(driveNode);
|
||||
treeViewRootNodes[index] = initialTree[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
treeViewRootNodes[0] = initialTree[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
await JSRuntime.InvokeVoidAsync("makeAddressBarHorizontallyScrollable").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expands or collapses a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="node">The node to expand or collapse.</param>
|
||||
private async Task ExpandNode(FileSystemTreeNodeModel node)
|
||||
{
|
||||
if (!node.IsExpanded && !node.ChildrenLoaded)
|
||||
{
|
||||
node.Children = new List<FileSystemTreeNodeModel>();
|
||||
node.IsExpanded = true;
|
||||
StateHasChanged();
|
||||
try
|
||||
{
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"directories/get-directories?path={Uri.EscapeDataString(node.Path)}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"files/get-files?path={Uri.EscapeDataString(node.Path)}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"Error expanding node: {ex.Message}"); // TODO: display to the user when notification system is implemented
|
||||
}
|
||||
finally
|
||||
{
|
||||
node.ChildrenLoaded = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
node.IsExpanded = !node.IsExpanded;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the selection of a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the selected node.</param>
|
||||
private async Task HandleNodeSelected(string path)
|
||||
{
|
||||
selectedNodePath = path;
|
||||
Console.WriteLine($"Selected node: {path}");
|
||||
await OnNodeSelected.InvokeAsync(path).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the change event.
|
||||
/// </summary>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private async Task OnNavigatorPathSegmentCheckChangeHandler(ChangeEventArgs e, int toggledIndex)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("uncheckAllExcept", $"segment-toggle-{toggledIndex}").ConfigureAwait(false);
|
||||
// check if the checkbox is checked
|
||||
bool isChecked = (bool)e.Value!;
|
||||
showPathSegmentDowpDown = isChecked;
|
||||
expandedPathSegmentIndex = null;
|
||||
// if it's checked, get the subdirectories for the toggled path segment
|
||||
if (isChecked && pathSegments?.Length > 0)
|
||||
{
|
||||
// initialize the path with the first segment
|
||||
string concatenatedPath = pathSegments[0].Path;
|
||||
// concatenate only up to the toggled index
|
||||
for (int i = 1; i <= toggledIndex; i++)
|
||||
concatenatedPath = $"{(concatenatedPath != pathSeparator ? concatenatedPath : string.Empty)}{pathSeparator}{pathSegments[i].Path}";
|
||||
string parentConcatenatedPath = concatenatedPath;
|
||||
try
|
||||
{
|
||||
if (concatenatedPath != pathSeparator) // on UNIX, dont get the parent, if we are at root path
|
||||
{
|
||||
List<PathSegmentModel> parentLocation = await _apiHttpClient.GetAsync<List<PathSegmentModel>>($"path/get-path-parent?path={Uri.EscapeDataString(concatenatedPath)}").ConfigureAwait(false);
|
||||
parentConcatenatedPath = parentLocation[0].Path;
|
||||
for (int i = 1; i < parentLocation.Count; i++)
|
||||
parentConcatenatedPath = $"{(parentConcatenatedPath != pathSeparator ? parentConcatenatedPath : string.Empty)}{pathSeparator}{pathSegments[i].Path}";
|
||||
}
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
// fetch directories for the expanded path segment
|
||||
List<FileSystemTreeNodeModel> directories = [
|
||||
new() { Path = concatenatedPath, Name = ".", }, // current directory
|
||||
new() { Path = parentConcatenatedPath, Name = ".." } // parent directory
|
||||
];
|
||||
// add the rest of the subdirectories of the expanded path node
|
||||
await foreach (FileSystemTreeNodeModel? directory in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"directories/get-directories?path={Uri.EscapeDataString(concatenatedPath)}").ConfigureAwait(false))
|
||||
if (directory is not null)
|
||||
directories.Add(directory);
|
||||
// store the directories for this segment
|
||||
pathSegmentsSubdirectoriesCache[toggledIndex] = directories;
|
||||
expandedPathSegmentIndex = toggledIndex;
|
||||
StateHasChanged();
|
||||
// invoke the javascript function that positions the dropdown underneath the toggled path segment
|
||||
await JSRuntime.InvokeVoidAsync("updateDropdownPosition", $"path-segment-{toggledIndex}").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
right: 10%;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--border-color-dialog);
|
||||
box-shadow: 30px 30px 25px var(--shadow-color);
|
||||
}
|
||||
|
||||
#directory-browser-content {
|
||||
@@ -64,9 +65,10 @@
|
||||
}
|
||||
|
||||
::deep .directory-browser-content-new-directory {
|
||||
min-width: 120px;
|
||||
flex-basis: 120px;
|
||||
min-width: 35px;
|
||||
flex-basis: 35px;
|
||||
flex-shrink: 0;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.navigation-icon {
|
||||
@@ -277,22 +279,386 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
/*File System Navigator*/
|
||||
#navigator-navigation-controls-container {
|
||||
width: 195px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#navigator-history {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#navigator-history, ::deep .navigator-navigate-button, ::deep .navigator-edit-path-button {
|
||||
flex-shrink: 0; /* don't let them shrink */
|
||||
}
|
||||
|
||||
#navigator-history img {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.navigator-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#navigator-new-directory-icon {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
#navigator-navigate-icon,
|
||||
#navigator-edit-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
::deep .navigator-navigate-button, ::deep .navigator-edit-path-button {
|
||||
text-align: end !important;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::deep .navigator-navigate-button,
|
||||
::deep .directory-browser-content-new-directory {
|
||||
margin: 0px 10px 2px 0px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::deep .directory-browser-content-favorite-directory {
|
||||
margin: 0px 2px 2px 0px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::deep .navigator-edit-path-button {
|
||||
margin: 0px 10px 2px 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
#navigator-address-bar-container {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
height: 28px;
|
||||
align-items: center;
|
||||
overflow-x: hidden;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
|
||||
#navigator-address-bar-container::-webkit-scrollbar,
|
||||
#navigator-address-bar-group::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
#navigator-address-bar-container,
|
||||
#navigator-address-bar-group {
|
||||
scrollbar-width: none; /* Firefox 64+ */
|
||||
}
|
||||
|
||||
#navigator-address-bar-container,
|
||||
#navigator-address-bar-group {
|
||||
-ms-overflow-style: none; /* IE 10+ */
|
||||
}
|
||||
|
||||
|
||||
/* for Webkit browsers like Chrome, Safari */
|
||||
#navigator-address-bar::-webkit-scrollbar {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* for Internet Explorer and Edge */
|
||||
#navigator-address-bar {
|
||||
-ms-overflow-style: none; /*IE and Edge */
|
||||
}
|
||||
|
||||
/* for Firefox */
|
||||
#navigator-address-bar ::-moz-scrollbar {
|
||||
width: 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
#navigator-address-bar-group {
|
||||
flex-grow: 1; /* let it take the remaining space */
|
||||
display: flex; /* use flex for its children */
|
||||
flex-wrap: nowrap;
|
||||
align-items: center; /* vertically center its children */
|
||||
height: 30px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
|
||||
#navigator-view-mode-container {
|
||||
display: flex;
|
||||
margin-right: 0px;
|
||||
align-items: center;
|
||||
width: 125px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#navigator-view-mode-container img {
|
||||
margin-right: 5px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
::deep .navigator-address-bar-input {
|
||||
display: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
#navigator-address-bar {
|
||||
background-color: #23232355;
|
||||
margin-top: -2px;
|
||||
padding-left: 2px;
|
||||
vertical-align: middle;
|
||||
height: 30px;
|
||||
flex-grow: 1;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
#navigator-address-bar ul {
|
||||
height: 100%;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#navigator-path-segments {
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
||||
.navigator-combobox {
|
||||
position: relative;
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.navigator-toggle-checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navigator-toggle-checkbox:checked + .navigator-toggle + .navigator-dropdown {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.navigator-toggle-checkbox:checked + .navigator-toggle .navigator-arrow {
|
||||
background-size: 9px 11px;
|
||||
background-position: 3px -2px;
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.navigator-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
|
||||
color: #6DCBFE;
|
||||
padding: 3px 8px 3px 8px;
|
||||
width: 100%;
|
||||
border: none;
|
||||
outline: none;
|
||||
appearance: none;
|
||||
border-top: #989898 1px solid;
|
||||
border-bottom: #151515 1px solid;
|
||||
border-left: #878787 1px solid;
|
||||
border-right: #202020 1px solid;
|
||||
background-image: linear-gradient(180deg, #606060, #555555, #4C4C4C, #414141);
|
||||
background-repeat: repeat;
|
||||
background-position: 0 0;
|
||||
background-size: 100%;
|
||||
user-select: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.navigator-arrow { /**/
|
||||
display: inline-block;
|
||||
width: 12px;
|
||||
height: 9px;
|
||||
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%22545%20-32.5%2027.5%2065%22%3E%3Cpath%20fill%3D%22%23FFF%22%20d%3D%22M568.254,-7.43524%20568.159,-7.34277%20567.977,-7.52246%20546.559,-28.9417%20525.484,-28.9417%20549.787,-4.63446%20557.439,3.01532%20557.619,3.19629%20550.067,10.7549%20525.758,35.0583%20546.834,35.0583%20568.254,13.6429%20578.792,3.10254%20568.254,-7.43524z%22%2F%3E%3C%2Fsvg%3E');
|
||||
background-size: 10px 9px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 3px -0px;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.navigator-toggle-checkbox:checked + .navigator-toggle .navigator-arrow { /**/
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.navigator-selected-text {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.navigator-dropdown {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
min-width: 150px;
|
||||
max-width: 800px;
|
||||
box-sizing: border-box;
|
||||
background-image: url('../images/ui/metal-plate.png'), linear-gradient(180deg, #505050, #464646, #404040, #363636);
|
||||
background-repeat: repeat, no-repeat;
|
||||
background-position: 3px 3px, 0 0; /* offset the metal-plate image by 3 pixels from the top and left */
|
||||
background-clip: content-box, border-box; /* clip the metal-plate image to the content box */
|
||||
border-top: #989898 1px solid;
|
||||
border-bottom: #151515 1px solid;
|
||||
border-left: #878787 1px solid;
|
||||
border-right: #202020 1px solid;
|
||||
padding: 3px;
|
||||
z-index: 999;
|
||||
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;
|
||||
}
|
||||
|
||||
.navigator-option {
|
||||
display: block;
|
||||
border-left: 1px solid #232323;
|
||||
border-right: 1px solid #777777;
|
||||
border-top: 1px solid #232323;
|
||||
border-bottom: 1px solid #777777;
|
||||
color: #FFFFFF;
|
||||
padding: 5px 10px;
|
||||
min-width: 100%;
|
||||
/*width: auto;*/
|
||||
box-sizing: border-box;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
text-align: start;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.navigator-option.first-option {
|
||||
border-top: 1px solid #232323;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.navigator-option.last-option {
|
||||
border-bottom: 1px solid #777777;
|
||||
}
|
||||
|
||||
.navigator-option.disabled {
|
||||
color: #AAAAAA; /* Gray color */
|
||||
}
|
||||
|
||||
.navigator-option:hover {
|
||||
background-image: none;
|
||||
background: linear-gradient(to bottom, #505050, #464646, #404040, #363636);
|
||||
color: #1D8AF9;
|
||||
box-shadow: inset 1px 0 0 0 #777777, /* left */
|
||||
inset -1px 0 0 0 #232323, /* right */
|
||||
inset 0 1px 0 0 #989898, /* top */
|
||||
inset 0 -1px 0 0 #151515; /* bottom */
|
||||
}
|
||||
|
||||
.navigator-combobox > .shine-effect:first-child {
|
||||
opacity: 0;
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
|
||||
.navigator-combobox:hover > .shine-effect:first-child {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.navigator-combobox > .shine-effect::before,
|
||||
.navigator-combobox > .shine-effect::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
|
||||
.navigator-combobox > .shine-effect::before {
|
||||
width: 3px;
|
||||
height: 2px;
|
||||
border-radius: 5px 5px 0 0;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.navigator-combobox > .shine-effect::after {
|
||||
width: 10px;
|
||||
height: 3px;
|
||||
border-radius: 5px 5px 0 0;
|
||||
background-color: #FFFFFF;
|
||||
filter: blur(3px);
|
||||
}
|
||||
|
||||
.navigator-combobox:hover > .shine-effect::before,
|
||||
.navigator-combobox:hover > .shine-effect::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
#directory-browser-dialog {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#directory-browser-header {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#directory-browser-header-navigation-container {
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
#directory-browser-header-address-bar-container {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
#navigator-view-mode-container {
|
||||
flex: 1;
|
||||
order: 1;
|
||||
}
|
||||
|
||||
#navigator-navigation-controls-container {
|
||||
flex: 1;
|
||||
order: 2;
|
||||
/*text-align: right;*/
|
||||
justify-content: flex-end;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#navigator-address-bar-container {
|
||||
flex-basis: 100%;
|
||||
order: 3;
|
||||
}
|
||||
|
||||
#directory-browser-header-address-bar-container {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.directory-browser-header-address-bar-url {
|
||||
width: 100%;
|
||||
margin-bottom: 5px;
|
||||
@@ -314,5 +680,37 @@
|
||||
::deep .directory-browser-content-new-directory {
|
||||
min-width: 0;
|
||||
flex-basis: auto;
|
||||
margin-right: 10px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
/*File System Navigator*/
|
||||
#navigator-view-mode-container {
|
||||
height: 26px;
|
||||
margin-left: 11px;
|
||||
}
|
||||
|
||||
#navigator-address-bar-container {
|
||||
width: 100%;
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
#navigator-address-bar-group {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#navigator-toggle-hidden-button {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
#navigator-history {
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 399px) {
|
||||
#directory-browser-dialog {
|
||||
min-width: 400px
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
@using Lumina.Presentation.Web.Common.Models.FileManagement
|
||||
<div id="navigator-view-mode-container">
|
||||
<img src="images/ui/list.png" id="navigator-list-view" alt="List View" title="List View" />
|
||||
<img src="images/ui/details.png" id="navigator-details-view" alt="Details View" title="Details View" />
|
||||
<img src="images/ui/small-icons.png" id="navigator-small-icons-view" alt="Small Icons View" title="Small Icons View" />
|
||||
<img src="images/ui/medium-icons.png" id="navigator-medium-icons-view" alt="Medium Icons View" title="Medium Icons View" />
|
||||
<img src="images/ui/large-icons.png" id="navigator-large-icons-view" alt="Large Icons View" title="Large Icons View" />
|
||||
<img src="images/ui/extra-large-icons.png" id="navigator-extra-large-icons-view" alt="Extra Large Icons View" title="Extra Large Icons View" />
|
||||
</div>
|
||||
<div id="navigator-navigation-controls-container">
|
||||
<div id="navigator-history">
|
||||
<img src="images/ui/back.svg" class="navigation-icon" alt="Back" title="Back" />
|
||||
<img src="images/ui/forward.svg" class="navigation-icon" alt="Forward" title="Forward" />
|
||||
<img src="images/ui/up.svg" class="navigation-icon" alt="Up One Level" title="Up One Level" />
|
||||
</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" />
|
||||
</div>
|
||||
<div id="navigator-address-bar-container">
|
||||
<div id="navigator-address-bar-group">
|
||||
<EnlightenmentInput CssClass="navigator-address-bar-input" Type="text" Value="@Path" Name="navigator-address-bar-input" AutoComplete="true" />
|
||||
<div id="navigator-address-bar">
|
||||
<ul id="navigator-path-segments"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<EnlightenmentButton CssClass="navigator-edit-path-button" IsConfirmButton="false" Height="28" Width="35">
|
||||
<svg width="24" height="24" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path style="fill:#009BFC;fill-opacity:1;stroke:none"
|
||||
d="m22.27 4l-18.27 18.27v5.73h5.73c0 0 18.269-18.269 18.27-18.27zm-2.865 4.299l4.297 4.297-11.701 11.703v-2.299h-4v-2.299zm-12.404 12.402v2.299h4v2.299l-1.701 1.701h-2l-2.297-2.297v-2z" />
|
||||
</svg>
|
||||
</EnlightenmentButton>
|
||||
<EnlightenmentButton CssClass="navigator-navigate-button" Height="28" Width="35">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M20 6L9 17L4 12" stroke="#0F9D58" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</svg>
|
||||
</EnlightenmentButton>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[CascadingParameter(Name = "Path")] private string? Path { get; set; }
|
||||
[CascadingParameter(Name = "PathSeparator")] private string? PathSeparator { get; set; }
|
||||
[CascadingParameter(Name = "FileSystemType")] private FileSystemTypeModel? FileSystemType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Method invoked when parameters receive values from the parent.
|
||||
/// </summary>
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (Path is not null && PathSeparator is not null && FileSystemType is not null)
|
||||
{
|
||||
if (!Path.EndsWith(PathSeparator))
|
||||
Path += PathSeparator;
|
||||
Console.WriteLine("param path:" + Path);
|
||||
Console.WriteLine("param PathSeparator:" + PathSeparator);
|
||||
Console.WriteLine("param FileSystemType:" + FileSystemType?.PlatformType);
|
||||
}
|
||||
await base.OnParametersSetAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
#navigator-navigation-controls-container {
|
||||
width: 180px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#navigator-history {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#navigator-history, ::deep .navigator-navigate-button, ::deep .navigator-edit-path-button {
|
||||
flex-shrink: 0; /* don't let them shrink */
|
||||
}
|
||||
|
||||
#navigator-history img {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.navigator-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::deep .navigator-navigate-button, ::deep .navigator-edit-path-button {
|
||||
text-align: end !important;
|
||||
}
|
||||
|
||||
::deep .navigator-navigate-button {
|
||||
margin: 0px 10px 2px 0px;
|
||||
}
|
||||
|
||||
::deep .navigator-edit-path-button {
|
||||
margin: 0px 10px 2px 12px;
|
||||
}
|
||||
|
||||
#navigator-address-bar-container {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
height: 28px;
|
||||
align-items: center;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
|
||||
#navigator-address-bar-container::-webkit-scrollbar,
|
||||
#navigator-address-bar-group::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
#navigator-address-bar-container,
|
||||
#navigator-address-bar-group {
|
||||
scrollbar-width: none; /* Firefox 64+ */
|
||||
}
|
||||
|
||||
#navigator-address-bar-container,
|
||||
#navigator-address-bar-group {
|
||||
-ms-overflow-style: none; /* IE 10+ */
|
||||
}
|
||||
|
||||
|
||||
/* for Webkit browsers like Chrome, Safari */
|
||||
#navigator-address-bar::-webkit-scrollbar {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* for Internet Explorer and Edge */
|
||||
#navigator-address-bar {
|
||||
-ms-overflow-style: none; /*IE and Edge */
|
||||
}
|
||||
|
||||
/* for Firefox */
|
||||
#navigator-address-bar ::-moz-scrollbar {
|
||||
width: 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
#navigator-address-bar-group {
|
||||
flex-grow: 1; /* let it take the remaining space */
|
||||
display: flex; /* use flex for its children */
|
||||
flex-wrap: nowrap;
|
||||
align-items: center; /* vertically center its children */
|
||||
height: 30px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
|
||||
#navigator-view-mode-container {
|
||||
display: flex;
|
||||
margin-right: 10px;
|
||||
align-items: center;
|
||||
width: 125px;
|
||||
}
|
||||
|
||||
#navigator-view-mode-container img {
|
||||
margin-right: 5px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
#navigator-address-bar-group, #navigator-view-mode-container {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
|
||||
::deep .navigator-address-bar-input {
|
||||
display: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
#navigator-address-bar {
|
||||
background-color: #23232355;
|
||||
margin-top: -2px;
|
||||
padding-left: 2px;
|
||||
vertical-align: middle;
|
||||
height: 30px;
|
||||
flex-grow: 1;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
#navigator-address-bar ul {
|
||||
height: 100%;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#navigator-path-segments {
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
#navigator-view-mode-container {
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
#navigator-address-bar-container {
|
||||
flex-basis: 100%; /* Make navigator-address-bar-container take the full width on wrap, hence pushing it to a new line */
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
@using System.Collections.Generic
|
||||
@using Lumina.Presentation.Web.Common.Api
|
||||
@using Lumina.Presentation.Web.Common.Enums
|
||||
@using Lumina.Presentation.Web.Common.Enums.FileSystem
|
||||
@using Lumina.Presentation.Web.Common.Models.FileManagement
|
||||
|
||||
@inject IApiHttpClient _apiHttpClient
|
||||
|
||||
<div class="treeview">
|
||||
@foreach (FileSystemTreeNodeModel node in RootNodes)
|
||||
{
|
||||
<FileSystemTreeViewNode Node="node" OnExpand="ExpandNode" OnNodeSelected="HandleNodeSelected" SelectedNodePath="@SelectedNodePath" />
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public string? InitialPath { get; set; }
|
||||
[Parameter] public List<FileSystemTreeNodeModel> RootNodes { get; set; } = new List<FileSystemTreeNodeModel>();
|
||||
[Parameter] public EventCallback<string> OnNodeSelected { get; set; }
|
||||
|
||||
private string? SelectedNodePath { get; set; }
|
||||
private string PathSeparator { get; set; } = "/";
|
||||
private FileSystemTypeModel fileSystemType = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component.
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
fileSystemType = await _apiHttpClient.GetAsync<FileSystemTypeModel>("file-system/get-type").ConfigureAwait(false);
|
||||
// ask the API server for the system path separator
|
||||
PathSeparatorModel pathSeparator = await _apiHttpClient.GetAsync<PathSeparatorModel>("path/get-path-separator").ConfigureAwait(false);
|
||||
PathSeparator = pathSeparator.Separator; // TODO: handle error
|
||||
// on Windows, ask the list of drives
|
||||
if (fileSystemType.PlatformType == PlatformType.Windows)
|
||||
{
|
||||
List<FileSystemTreeNodeModel> drives = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>("drives/get-drives").ConfigureAwait(false);
|
||||
RootNodes.AddRange(drives);
|
||||
}
|
||||
else
|
||||
{
|
||||
// on UNIX, just add the root "/"
|
||||
RootNodes.Add(new FileSystemTreeNodeModel()
|
||||
{
|
||||
Path = pathSeparator.Separator,
|
||||
IsExpanded = true,
|
||||
ItemType = FileSystemItemType.Root,
|
||||
Name = pathSeparator.Separator
|
||||
});
|
||||
}
|
||||
// if there was an initial path saved from a previous session, load the full tree up to that initial path
|
||||
if (InitialPath is not null)
|
||||
{
|
||||
// ask the whole tree for the saved path
|
||||
List<FileSystemTreeNodeModel> initialTree = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"directories/get-directory-tree?path={Uri.EscapeDataString(InitialPath)}").ConfigureAwait(false);
|
||||
if (initialTree is not null && initialTree.Count > 0)
|
||||
{
|
||||
// take the root of the retrieved tree, and try to match it against a drive in the retrieved list of drives, on Windows; on Unix, add it as the unique root path
|
||||
PathSegmentModel pathRoot = await _apiHttpClient.GetAsync<PathSegmentModel>($"path/get-path-root?path={Uri.EscapeDataString(InitialPath)}").ConfigureAwait(false);
|
||||
if (fileSystemType.PlatformType == PlatformType.Windows)
|
||||
{
|
||||
FileSystemTreeNodeModel? driveNode = RootNodes.FirstOrDefault(drive => drive.Path.Equals(pathRoot.Path, StringComparison.OrdinalIgnoreCase));
|
||||
// if a drive was matched, make the retrieved tree a child of it
|
||||
if (driveNode is not null)
|
||||
{
|
||||
int index = RootNodes.IndexOf(driveNode);
|
||||
RootNodes[index] = initialTree[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
RootNodes[0] = initialTree[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expands or collapses a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="node">The node to expand or collapse.</param>
|
||||
private async Task ExpandNode(FileSystemTreeNodeModel node)
|
||||
{
|
||||
if (!node.IsExpanded && !node.ChildrenLoaded)
|
||||
{
|
||||
node.Children = new List<FileSystemTreeNodeModel>();
|
||||
node.IsExpanded = true;
|
||||
StateHasChanged();
|
||||
try
|
||||
{
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"directories/get-directories?path={Uri.EscapeDataString(node.Path)}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"files/get-files?path={Uri.EscapeDataString(node.Path)}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"Error expanding node: {ex.Message}"); // TODO: display to the user when notification system is implemented
|
||||
}
|
||||
finally
|
||||
{
|
||||
node.ChildrenLoaded = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
node.IsExpanded = !node.IsExpanded;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the child nodes for a given path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to get child nodes for.</param>
|
||||
/// <returns>A list of <see cref="FileSystemTreeNodeModel"/> representing the child nodes.</returns>
|
||||
private async Task<List<FileSystemTreeNodeModel>> GetChildNodes(string path)
|
||||
{
|
||||
List<FileSystemTreeNodeModel> directories = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"directories/get-directories?path={Uri.EscapeDataString(path)}").ConfigureAwait(false);
|
||||
List<FileSystemTreeNodeModel> files = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"files/get-files?path={Uri.EscapeDataString(path)}").ConfigureAwait(false);
|
||||
directories.AddRange(files);
|
||||
return directories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the selection of a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the selected node.</param>
|
||||
private async Task HandleNodeSelected(string path)
|
||||
{
|
||||
SelectedNodePath = path;
|
||||
await OnNodeSelected.InvokeAsync(path).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M20 6L9 17L4 12" stroke="#0F9D58" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 174 B |
@@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path style="fill:#009BFC;fill-opacity:1;stroke:none"
|
||||
d="m22.27 4l-18.27 18.27v5.73h5.73c0 0 18.269-18.269 18.27-18.27zm-2.865 4.299l4.297 4.297-11.701 11.703v-2.299h-4v-2.299zm-12.404 12.402v2.299h4v2.299l-1.701 1.701h-2l-2.297-2.297v-2z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 363 B |
|
After Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 543 B |
@@ -0,0 +1,17 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
|
||||
<defs>
|
||||
<linearGradient id="starGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#039bfc;stop-opacity:0.7" />
|
||||
<stop offset="100%" style="stop-color:#027aba;stop-opacity:0.7" />
|
||||
</linearGradient>
|
||||
<filter id="innerShadow" x="-20%" y="-20%" width="140%" height="140%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="3" result="blur"/>
|
||||
<feOffset dx="2" dy="2"/>
|
||||
<feComposite in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowDiff"/>
|
||||
<feFlood flood-color="#000000" flood-opacity="0.75"/>
|
||||
<feComposite in2="shadowDiff" operator="in"/>
|
||||
<feComposite in2="SourceGraphic" operator="over"/>
|
||||
</filter>
|
||||
</defs>
|
||||
<path stroke-width="0" stroke-linecap="round" stroke-linejoin="round" d="M86.016,24.091H49.313c-1.979-2.37-4.013-4.865-4.541-5.624c-0.511-1.071-1.607-1.808-2.875-1.808H27.367 c-0.964,0-1.875,0.435-2.479,1.185l-5.021,6.247h-5.884c-3.021,0-5.484,2.46-5.484,5.484v48.284c0,3.024,2.463,5.482,5.484,5.482 h72.032c3.021,0,5.484-2.458,5.484-5.482V29.575C91.5,26.55,89.036,24.091,86.016,24.091z M81.543,63.286 c0,0.182-0.074,0.346-0.195,0.465c-0.119,0.12-0.283,0.194-0.464,0.194h-8.779v8.78c0,0.174-0.07,0.341-0.193,0.466 c-0.124,0.122-0.291,0.193-0.465,0.193h-6.15c-0.175,0-0.342-0.07-0.466-0.193c-0.124-0.125-0.192-0.292-0.192-0.466v-8.78h-8.78 c-0.174,0-0.342-0.07-0.465-0.194c-0.124-0.123-0.193-0.29-0.193-0.465v-6.149c0.001-0.351,0.309-0.659,0.658-0.659l8.779,0l0-8.78 c0-0.363,0.294-0.658,0.659-0.658l6.15,0.001c0.364,0,0.659,0.293,0.659,0.658v8.778h8.78c0.364,0,0.659,0.294,0.659,0.659 L81.543,63.286z" fill="url(#starGradient)" filter="url(#innerShadow)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 257 B |
@@ -0,0 +1,51 @@
|
||||
<?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(2)">
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M14.3307 7.16929C13.5873 7.05887 12.806 7 12 7C7.02944 7 3 9.23858 3 12C3 13.4401 4.09589 14.738 5.84963 15.6504L8.21192 13.2881C8.07452 12.8839 8 12.4506 8 12C8 9.79086 9.79086 8 12 8C12.4506 8 12.8839 8.07452 13.2881 8.21192L14.3307 7.16929Z" class="ColorScheme-Text" filter="url(#glow)"/>
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M11.2308 15.9261C11.4797 15.9746 11.7369 16 12 16C14.2091 16 16 14.2091 16 12C16 11.7369 15.9746 11.4797 15.9261 11.2308L18.5726 8.58427C20.0782 9.47809 21 10.6792 21 12C21 14.7614 16.9706 17 12 17C11.4016 17 10.8169 16.9676 10.2512 16.9057L11.2308" class="ColorScheme-Text" filter="url(#glow)"/>
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M17.7929 5.20711C18.1834 4.81658 18.8166 4.81658 19.2071 5.20711C19.5976 5.59763 19.5976 6.2308 19.2071 6.62132L6.47919 19.3492C6.08866 19.7398 5.4555 19.7398 5.06497 19.3492C4.67445 18.9587 4.67445 18.3256 5.06497 17.935L17.7929 5.20711Z" class="ColorScheme-Text" filter="url(#glow)"/>
|
||||
</g>
|
||||
</svg>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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(5,5) scale(0.7)">
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 20,17L 44.25,17L 56,28.75L 56,59L 20,59L 20,17 Z M 24,21L 24,55L 52,55L 52,34L 39,34L 39,21L 24,21 Z M 43,22.25L 43,30L 50.75,30L 43,22.25 Z M 27,47.5L 30,50.5L 42.5,38L 47.5,43L 51,39L 51,54L 25,54L 25,50L 27,47.5 Z M 33,22C 33,26.3723 29.3723,30 25,30L 25,22L 33,22 Z " class="ColorScheme-Text" filter="url(#glow)"/>
|
||||
</g>
|
||||
</svg>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -1,25 +1,110 @@
|
||||
/**
|
||||
* Adjusts the height of a dropdown identified by `comboboxId` to fit in the available space.
|
||||
* @param {string} comboboxId The ID of the combobox whose dropdown should be adjusted.
|
||||
* @param {string} comboboxId The Id of the combobox whose dropdown should be adjusted.
|
||||
*/
|
||||
function adjustDropdownHeight(comboboxId) {
|
||||
const combobox = document.getElementById(comboboxId);
|
||||
const dropdown = combobox.querySelector('.enlightenment-dropdown');
|
||||
// get the bounds of the combobox and the height of the viewport
|
||||
const comboboxRect = combobox.getBoundingClientRect();
|
||||
const viewportHeight = window.innerHeight;
|
||||
// calculate the space available between the combobox and the bottom of the viewport, with a 10px margin
|
||||
const dropdownTopPosition = comboboxRect.top + comboboxRect.height;
|
||||
const availableSpace = viewportHeight - dropdownTopPosition - 10; // 10px margin
|
||||
dropdown.style.maxHeight = `${availableSpace}px`;
|
||||
function adjustDropdownHeight(comboboxId = null) {
|
||||
const comboboxes = comboboxId
|
||||
? [document.getElementById(comboboxId)] // if comboboxId is provided, use only that element
|
||||
: document.querySelectorAll('[id^="combobox_"]:not([id^="combobox_checkbox_"])'); // otherwise, select all dropdowns
|
||||
if (comboboxes) {
|
||||
comboboxes.forEach(combobox => {
|
||||
if (!combobox) return; // skip if no element is found
|
||||
const dropdown = combobox.querySelector('.enlightenment-dropdown');
|
||||
if (!dropdown) return; // skip if there's no dropdown inside
|
||||
// get the bounds of the combobox and the height of the viewport
|
||||
const comboboxRect = combobox.getBoundingClientRect();
|
||||
const viewportHeight = window.innerHeight;
|
||||
// calculate the space available between the combobox and the bottom of the viewport, with a 10px margin
|
||||
const dropdownTopPosition = comboboxRect.top + comboboxRect.height;
|
||||
const availableSpace = viewportHeight - dropdownTopPosition - 10; // 10px margin
|
||||
// adjust the dropdown height
|
||||
dropdown.style.maxHeight = `${availableSpace}px`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.showDirectoryPicker = async () => {
|
||||
try {
|
||||
const dirHandle = await window.showDirectoryPicker().ConfigureAwait(false);
|
||||
return dirHandle.name;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return null;
|
||||
/**
|
||||
* Gets the position and size of an element relative to the viewport.
|
||||
*
|
||||
* @param {string} id - The ID of the element to get the offset for.
|
||||
* @returns {Object} An object with the top, left, width, and height of the element.
|
||||
*/
|
||||
function getElementOffset(id) {
|
||||
const element = document.getElementById(id);
|
||||
if (element) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return {
|
||||
top: rect.top + window.scrollY,
|
||||
left: rect.left + window.scrollX,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
};
|
||||
return {
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the position and height of the dropdown relative to the specified path segment.
|
||||
*
|
||||
* @param {string} pathSegmentId - The ID of the path segment element to position the dropdown relative to.
|
||||
*/
|
||||
function updateDropdownPosition(pathSegmentId) {
|
||||
const element = document.getElementById(pathSegmentId);
|
||||
const dropdown = document.getElementById('navigatorDropdown');
|
||||
if (element && dropdown) {
|
||||
const rect = getElementOffset(pathSegmentId);
|
||||
dropdown.style.top = `${rect.top + rect.height}px`;
|
||||
dropdown.style.left = `${rect.left}px`;
|
||||
// calculate the available height between the dropdown and the bottom of the viewport
|
||||
const viewportHeight = window.innerHeight;
|
||||
const availableHeight = viewportHeight - (rect.top + rect.height) - 10; // 10 px margin
|
||||
// set the dropdown's max height, ensuring it doesn't exceed the available height
|
||||
dropdown.style.maxHeight = `${availableHeight}px`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unchecks all checkboxes except the one with the specified ID.
|
||||
*
|
||||
* @param {string} id - The Id of the checkbox to leave checked.
|
||||
*/
|
||||
function uncheckAllExcept(id) {
|
||||
const checkboxes = document.querySelectorAll('.navigator-toggle-checkbox');
|
||||
checkboxes.forEach((checkbox) => {
|
||||
if (checkbox.id !== id) {
|
||||
checkbox.checked = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables horizontal scrolling for the address bar using the mouse wheel.
|
||||
*/
|
||||
function makeAddressBarHorizontallyScrollable() {
|
||||
const addressBar = document.getElementById('navigator-address-bar');
|
||||
if (addressBar) {
|
||||
addressBar.addEventListener('wheel', function (event) {
|
||||
event.preventDefault();
|
||||
this.scrollLeft += (event.deltaY > 0 ? 1 : -1) * 80;
|
||||
}, { passive: false });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the window resize event.
|
||||
*/
|
||||
window.addEventListener('resize', function () {
|
||||
adjustDropdownHeight();
|
||||
// update all dropdowns' positions on resize
|
||||
const dropdown = document.getElementById('navigatorDropdown');
|
||||
if (dropdown) {
|
||||
const pathSegmentId = dropdown.getAttribute('data-path-segment-id');
|
||||
if (pathSegmentId)
|
||||
updateDropdownPosition(pathSegmentId);
|
||||
}
|
||||
});
|
||||