mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 09:01:10 +00:00
Merge pull request #5 from BinaryAlley/refactor/switch-web-client-to-mvc
Swiches Client Web app from Blazor to ASP.NET Core MVC
This commit is contained in:
81 files changed
+4031
-3028
No files matched your search
@@ -274,8 +274,6 @@ dotnet_naming_style.local_function_style.capitalization = pascal_case
|
||||
# readonly instance fields are camelCase and begin with underscore
|
||||
dotnet_naming_symbols.readonly_instance_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.readonly_instance_fields.required_modifiers = readonly
|
||||
dotnet_naming_symbols.readonly_instance_fields.required_modifiers_style = exclude_any
|
||||
dotnet_naming_symbols.readonly_instance_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_style.underscore_camel_case_style.capitalization = camel_case
|
||||
dotnet_naming_style.underscore_camel_case_style.required_prefix = _
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Mapster;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Mapping configuration for file system thumbnails between the domain object and the presentation object.
|
||||
/// </summary>
|
||||
public class ThumbnailMappingConfig : IRegister
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Registers the mapping configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The type adapter configuration.</param>
|
||||
public void Register(TypeAdapterConfig config)
|
||||
{
|
||||
config.NewConfig<Thumbnail, ThumbnailResponse>()
|
||||
.Map(dest => dest.Type, src => src.Type)
|
||||
.Map(dest => dest.Bytes, src => src.Bytes)
|
||||
.MapToConstructor(true);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Mediator;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Thumbnails.Queries.GetThumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// Query for retrieving the thumbnail of a file at a path.
|
||||
/// </summary>
|
||||
/// <param name="Path">The file path of the image to generate the thumbnail from.</param>
|
||||
/// <param name="Quality">The desired quality of the thumbnail image (e.g., resolution or compression level).</param>
|
||||
public record GetThumbnailQuery(string Path, int Quality) : IRequest<ErrorOr<ThumbnailResponse>>;
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#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.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.FileManagement.Thumbnails.Queries.GetThumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the query to get the file thumbnail.
|
||||
/// </summary>
|
||||
public class GetThumbnailQueryHandler : IRequestHandler<GetThumbnailQuery, ErrorOr<ThumbnailResponse>>
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IThumbnailService _thumbnailsService;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetThumbnailQueryHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="thumbnailsService">Injected service for handling thumbnails.</param>
|
||||
public GetThumbnailQueryHandler(IThumbnailService thumbnailsService)
|
||||
{
|
||||
_thumbnailsService = thumbnailsService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the thumbnail for a file located at the specified path, with the specified quality.
|
||||
/// </summary>
|
||||
/// <param name="request">The query to be handled.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{T}"/> containing either a thumbnail, or an error.</returns>
|
||||
public async ValueTask<ErrorOr<ThumbnailResponse>> Handle(GetThumbnailQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<Thumbnail> result = await _thumbnailsService.GetThumbnailAsync(request.Path, request.Quality, cancellationToken);
|
||||
return await ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(result.Value.Adapt<ThumbnailResponse>()), errors => errors));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Responses.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object for thumbnails.
|
||||
/// </summary>
|
||||
/// <param name="Type">The type of the thumbnail image.</param>
|
||||
/// <param name="Bytes">The bytes representing the thumbail.</param>
|
||||
[DebuggerDisplay("{Type}")]
|
||||
public record ThumbnailResponse(ImageType Type, byte[] Bytes);
|
||||
+1
-1
@@ -105,7 +105,7 @@ internal class FileProviderService : IFileProviderService
|
||||
// check if the user has access permissions to the provided path
|
||||
if (!_fileSystemPermissionsService.CanAccessPath(path, FileAccessMode.ReadContents))
|
||||
return Errors.Permission.UnauthorizedAccess;
|
||||
return System.IO.File.ReadAllBytes(path.Path);
|
||||
return File.ReadAllBytes(path.Path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+7
-4
@@ -9,6 +9,7 @@ using System;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
@@ -43,18 +44,20 @@ public class FileTypeService : IFileTypeService
|
||||
/// Determines if <paramref name="file"/> is of type image or not, and returns its type.
|
||||
/// </summary>
|
||||
/// <param name="file">The file to determine if it is an image or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the type of image or an error.</returns>
|
||||
public async Task<ErrorOr<ImageType>> GetImageTypeAsync(File file)
|
||||
public async Task<ErrorOr<ImageType>> GetImageTypeAsync(File file, CancellationToken cancellationToken)
|
||||
{
|
||||
return await GetImageTypeAsync(file.Id).ConfigureAwait(false);
|
||||
return await GetImageTypeAsync(file.Id, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a file identified by <paramref name="path"/> is of type image or not, and returns its type.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file to determine if it is an image or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the type of image or an error.</returns>
|
||||
public async Task<ErrorOr<ImageType>> GetImageTypeAsync(FileSystemPathId path)
|
||||
public async Task<ErrorOr<ImageType>> GetImageTypeAsync(FileSystemPathId path, CancellationToken cancellationToken)
|
||||
{
|
||||
// check if the user has access permissions to the provided path
|
||||
if (!_fileSystemPermissionsService.CanAccessPath(path, FileAccessMode.ReadContents))
|
||||
@@ -65,7 +68,7 @@ public class FileTypeService : IFileTypeService
|
||||
if (stream.Length < BUFFER_SIZE)
|
||||
return ImageType.None;
|
||||
// read only the first bytes of the file, equal to the buffer size
|
||||
await stream.ReadAsync(buffer).ConfigureAwait(false);
|
||||
await stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);
|
||||
byte[] firstBytes = buffer[..BUFFER_SIZE].ToArray();
|
||||
// check if its a known image type, based on header bytes
|
||||
ImageType type = IdentifyHeader(firstBytes);
|
||||
|
||||
+7
-4
@@ -1,8 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
@@ -18,14 +19,16 @@ public interface IFileTypeService
|
||||
/// Determines if <paramref name="file"/> is of type image or not, and returns its type.
|
||||
/// </summary>
|
||||
/// <param name="file">The file to determine if it is an image or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the type of image or an error.</returns>
|
||||
Task<ErrorOr<ImageType>> GetImageTypeAsync(File file);
|
||||
Task<ErrorOr<ImageType>> GetImageTypeAsync(File file, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a file identified by <paramref name="path"/> is of type image or not, and returns its type.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file to determine if it is an image or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the type of image or an error.</returns>
|
||||
Task<ErrorOr<ImageType>> GetImageTypeAsync(FileSystemPathId path);
|
||||
Task<ErrorOr<ImageType>> GetImageTypeAsync(FileSystemPathId path, CancellationToken cancellationToken);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+7
-4
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
@@ -17,15 +18,17 @@ public interface IThumbnailService
|
||||
/// </summary>
|
||||
/// <param name="path">String representation of the file path.</param>
|
||||
/// <param name="quality">The quality of the thumbnail to get.</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 bytes representing the thumbnail of the file at the specified path or an error.</returns>
|
||||
Task<ErrorOr<Thumbnail>> GetThumbnailAsync(string path, int quality);
|
||||
Task<ErrorOr<Thumbnail>> GetThumbnailAsync(string path, int quality, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the thumbnail of a file at the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path object.</param>
|
||||
/// <param name="quality">The quality of the thumbnail to get.</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 bytes representing the thumbnail of the file at the specified path or an error.</returns>
|
||||
Task<ErrorOr<Thumbnail>> GetThumbnailAsync(FileSystemPathId path, int quality);
|
||||
Task<ErrorOr<Thumbnail>> GetThumbnailAsync(FileSystemPathId path, int quality, CancellationToken cancellationToken);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+20
-15
@@ -10,6 +10,7 @@ using SixLabors.ImageSharp.Formats.Png;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
@@ -41,13 +42,14 @@ public class ThumbnailService : IThumbnailService
|
||||
/// </summary>
|
||||
/// <param name="path">String representation of the file path.</param>
|
||||
/// <param name="quality">The quality of the thumbnail to get.</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 bytes representing the thumbnail of the file at the specified path or an error.</returns>
|
||||
public async Task<ErrorOr<Thumbnail>> GetThumbnailAsync(string path, int quality)
|
||||
public async Task<ErrorOr<Thumbnail>> GetThumbnailAsync(string path, int quality, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<FileSystemPathId> fileSystemPathIdResult = FileSystemPathId.Create(path);
|
||||
if (fileSystemPathIdResult.IsError)
|
||||
return fileSystemPathIdResult.Errors;
|
||||
return await GetThumbnailAsync(fileSystemPathIdResult.Value, quality);
|
||||
return await GetThumbnailAsync(fileSystemPathIdResult.Value, quality, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,11 +57,12 @@ public class ThumbnailService : IThumbnailService
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file for which to get the thumbnail.</param>
|
||||
/// <param name="quality">The quality of the thumbnail to get.</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 bytes representing the thumbnail of the file at the specified path or an error.</returns>
|
||||
public async Task<ErrorOr<Thumbnail>> GetThumbnailAsync(FileSystemPathId path, int quality)
|
||||
public async Task<ErrorOr<Thumbnail>> GetThumbnailAsync(FileSystemPathId path, int quality, CancellationToken cancellationToken)
|
||||
{
|
||||
// first, get the type of the image file
|
||||
ErrorOr<ImageType> imageTypeResult = await _environmentContext.FileTypeService.GetImageTypeAsync(path);
|
||||
ErrorOr<ImageType> imageTypeResult = await _environmentContext.FileTypeService.GetImageTypeAsync(path, cancellationToken);
|
||||
if (imageTypeResult.IsError)
|
||||
return imageTypeResult.Errors;
|
||||
if (imageTypeResult.Value != ImageType.None)
|
||||
@@ -74,7 +77,7 @@ public class ThumbnailService : IThumbnailService
|
||||
if (imageTypeResult.Value is ImageType.JPEG or ImageType.JPEG_CANON or ImageType.JPEG2000
|
||||
or ImageType.JPEG_UNKNOWN or ImageType.PNG or ImageType.BMP
|
||||
or ImageType.WEBP or ImageType.GIF or ImageType.TIFF or ImageType.TGA)
|
||||
adjustedImage = await AdjustImageResolutionAsync(fileContents, imageTypeResult.Value, quality);
|
||||
adjustedImage = await AdjustImageResolutionAsync(fileContents, imageTypeResult.Value, quality, cancellationToken);
|
||||
return new Thumbnail(imageTypeResult.Value, adjustedImage ?? fileContents);
|
||||
}
|
||||
else
|
||||
@@ -87,8 +90,9 @@ public class ThumbnailService : IThumbnailService
|
||||
/// <param name="imageBytes">The byte array of the source image.</param>
|
||||
/// <param name="imageType">The format of the image whose quality is adjusted.</param>
|
||||
/// <param name="quality">A value between 1 (lowest quality) to 100 (highest quality).</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>A byte array representing the processed image.</returns>
|
||||
private static async Task<byte[]> AdjustImageQualityAsync(byte[] imageBytes, ImageType imageType, int quality)
|
||||
private static async Task<byte[]> AdjustImageQualityAsync(byte[] imageBytes, ImageType imageType, int quality, CancellationToken cancellationToken)
|
||||
{
|
||||
using MemoryStream inputMemoryStream = new(imageBytes);
|
||||
using MemoryStream outputMemoryStream = new();
|
||||
@@ -99,24 +103,24 @@ public class ThumbnailService : IThumbnailService
|
||||
case ImageType.JPEG_CANON:
|
||||
case ImageType.JPEG_UNKNOWN:
|
||||
{
|
||||
using Image image = await Image.LoadAsync(inputMemoryStream);
|
||||
await image.SaveAsync(outputMemoryStream, new JpegEncoder() { Quality = quality });
|
||||
using Image image = await Image.LoadAsync(inputMemoryStream, cancellationToken);
|
||||
await image.SaveAsync(outputMemoryStream, new JpegEncoder() { Quality = quality }, cancellationToken);
|
||||
break;
|
||||
}
|
||||
case ImageType.PNG:
|
||||
{
|
||||
using Image image = await Image.LoadAsync(inputMemoryStream);
|
||||
using Image image = await Image.LoadAsync(inputMemoryStream, cancellationToken);
|
||||
// PNG is lossless; quality adjustments don't apply in the same way - we can adjust compression
|
||||
int compressionLevel = MapRange(quality, 1, 100, 1, 9);
|
||||
PngEncoder encoder = new()
|
||||
{ CompressionLevel = (PngCompressionLevel)compressionLevel };
|
||||
await image.SaveAsync(outputMemoryStream, encoder);
|
||||
await image.SaveAsync(outputMemoryStream, encoder, cancellationToken);
|
||||
break;
|
||||
}
|
||||
case ImageType.BMP:
|
||||
{
|
||||
using Image image = await Image.LoadAsync(inputMemoryStream);
|
||||
await image.SaveAsync(outputMemoryStream, new PngEncoder()); // convert BMP to PNG for compression
|
||||
using Image image = await Image.LoadAsync(inputMemoryStream, cancellationToken);
|
||||
await image.SaveAsync(outputMemoryStream, new PngEncoder(), cancellationToken); // convert BMP to PNG for compression
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -131,12 +135,13 @@ public class ThumbnailService : IThumbnailService
|
||||
/// <param name="imageBytes">The byte array of the source image.</param>
|
||||
/// <param name="imageType">The format of the image whose quality is adjusted.</param>
|
||||
/// <param name="quality">A value between 1 (lowest quality) to 100 (highest quality).</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>The bytes of the adjusted image.</returns>
|
||||
private static async Task<byte[]> AdjustImageResolutionAsync(byte[] imageBytes, ImageType imageType, int quality)
|
||||
private static async Task<byte[]> AdjustImageResolutionAsync(byte[] imageBytes, ImageType imageType, int quality, CancellationToken cancellationToken)
|
||||
{
|
||||
using MemoryStream inputMemoryStream = new(imageBytes);
|
||||
using MemoryStream outputMemoryStream = new();
|
||||
Image image = await Image.LoadAsync(inputMemoryStream);
|
||||
Image image = await Image.LoadAsync(inputMemoryStream, cancellationToken);
|
||||
double ratio = quality / 100.0;
|
||||
int newWidth = (int)(image.Width * ratio);
|
||||
int newHeight = (int)(image.Height * ratio);
|
||||
@@ -163,7 +168,7 @@ public class ThumbnailService : IThumbnailService
|
||||
case ImageType.JPEG2000:
|
||||
case ImageType.JPEG_CANON:
|
||||
case ImageType.JPEG_UNKNOWN:
|
||||
await image.SaveAsync(outputMemoryStream, image.Metadata.DecodedImageFormat!);
|
||||
await image.SaveAsync(outputMemoryStream, image.Metadata.DecodedImageFormat!, cancellationToken);
|
||||
break;
|
||||
default:
|
||||
return imageBytes; // for unsupported formats, just return the original bytes
|
||||
|
||||
+4
-4
@@ -17,8 +17,8 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
|
||||
public sealed class Isbn : ValueObject
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private static readonly Regex _isbn10Regex = new(@"^(?:ISBN(?:-10)?:? )?(?=[0-9X]{10}$|(?=(?:[0-9]+[-\ ]){3})[-\ 0-9X]{13}$)[0-9]{1,5}[-\ ]?[0-9]+[-\ ]?[0-9]+[-\ ]?[0-9X]$", RegexOptions.Compiled);
|
||||
private static readonly Regex _isbn13Regex = new(@"^(?:ISBN(?:-13)?:? )?(?=[0-9]{13}$|(?=(?:[0-9]+[-\ ]){4})[-\ 0-9]{17}$)97[89][-\ ]?[0-9]{1,5}[-\ ]?[0-9]+[-\ ]?[0-9]+[-\ ]?[0-9]$", RegexOptions.Compiled);
|
||||
private static readonly Regex s_isbn10Regex = new(@"^(?:ISBN(?:-10)?:? )?(?=[0-9X]{10}$|(?=(?:[0-9]+[-\ ]){3})[-\ 0-9X]{13}$)[0-9]{1,5}[-\ ]?[0-9]+[-\ ]?[0-9]+[-\ ]?[0-9X]$", RegexOptions.Compiled);
|
||||
private static readonly Regex s_isbn13Regex = new(@"^(?:ISBN(?:-13)?:? )?(?=[0-9]{13}$|(?=(?:[0-9]+[-\ ]){4})[-\ 0-9]{17}$)97[89][-\ ]?[0-9]{1,5}[-\ ]?[0-9]+[-\ ]?[0-9]+[-\ ]?[0-9]$", RegexOptions.Compiled);
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
@@ -83,7 +83,7 @@ public sealed class Isbn : ValueObject
|
||||
/// <returns><see langword="true"/> if the ISBN-10 is valid, <see langword="false"/> otherwise.</returns>
|
||||
public static bool IsValidIsbn10(string isbn)
|
||||
{
|
||||
if (!_isbn10Regex.IsMatch(isbn))
|
||||
if (!s_isbn10Regex.IsMatch(isbn))
|
||||
return false;
|
||||
// remove any hyphens or spaces
|
||||
isbn = isbn.Replace("-", "").Replace(" ", "").ToUpper();
|
||||
@@ -105,7 +105,7 @@ public sealed class Isbn : ValueObject
|
||||
/// <returns><see langword="true"/> if the ISBN-13 is valid, <see langword="false"/> otherwise.</returns>
|
||||
public static bool IsValidIsbn13(string isbn)
|
||||
{
|
||||
if (!_isbn13Regex.IsMatch(isbn))
|
||||
if (!s_isbn13Regex.IsMatch(isbn))
|
||||
return false;
|
||||
// remove any hyphens or spaces
|
||||
isbn = isbn.Replace("-", "").Replace(" ", "");
|
||||
|
||||
@@ -28,12 +28,12 @@ public class CustomProblemDetailsFactory : ProblemDetailsFactory
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomProblemDetailsFactory"/> class.
|
||||
/// </summary>
|
||||
/// <param name="options">Injected service for retrieving <see cref="ApiBehaviorOptions"/>.</param>
|
||||
/// <param name="apiBehaviorOptions">Injected service for retrieving <see cref="ApiBehaviorOptions"/>.</param>
|
||||
/// <param name="problemDetailsOptions">Injected service for retrieving <see cref="ProblemDetailsOptions"/>.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when the value of options (if any) is <see langword="null"/>.</exception>
|
||||
public CustomProblemDetailsFactory(IOptions<ApiBehaviorOptions> options, IOptions<ProblemDetailsOptions>? problemDetailsOptions = null)
|
||||
public CustomProblemDetailsFactory(IOptions<ApiBehaviorOptions> apiBehaviorOptions, IOptions<ProblemDetailsOptions>? problemDetailsOptions = null)
|
||||
{
|
||||
_options = options?.Value ?? throw new ArgumentNullException(nameof(options));
|
||||
_options = apiBehaviorOptions?.Value ?? throw new ArgumentNullException(nameof(apiBehaviorOptions));
|
||||
_configure = problemDetailsOptions?.Value?.CustomizeProblemDetails;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
@@ -19,8 +19,7 @@ public class UrlStringBinder : IModelBinder
|
||||
/// <returns>A task representing the bind operation.</returns>
|
||||
public Task BindModelAsync(ModelBindingContext bindingContext)
|
||||
{
|
||||
if (bindingContext is null)
|
||||
throw new ArgumentNullException(nameof(bindingContext));
|
||||
ArgumentNullException.ThrowIfNull(bindingContext);
|
||||
string modelName = bindingContext.ModelName;
|
||||
// try to fetch the value of the argument by name
|
||||
ValueProviderResult valueProviderResult = bindingContext.ValueProvider.GetValue(modelName);
|
||||
@@ -38,4 +37,4 @@ public class UrlStringBinder : IModelBinder
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Common.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Utility class for converting from domain image types to known image mime types.
|
||||
/// </summary>
|
||||
public static class MimeTypes
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private static readonly FrozenDictionary<ImageType, string> s_imageTypeToMimeType = new Dictionary<ImageType, string>
|
||||
{
|
||||
{ ImageType.BMP, "image/bmp" },
|
||||
{ ImageType.GIF, "image/gif" },
|
||||
{ ImageType.PNG, "image/png" },
|
||||
{ ImageType.TIFF, "image/tiff" },
|
||||
{ ImageType.JPEG, "image/jpeg" },
|
||||
{ ImageType.JPEG_CANON, "image/jpeg" },
|
||||
{ ImageType.JPEG_UNKNOWN, "image/jpeg" },
|
||||
{ ImageType.PICT, "image/x-pict" },
|
||||
{ ImageType.ICO, "image/x-icon" },
|
||||
{ ImageType.PSD, "image/vnd.adobe.photoshop" },
|
||||
{ ImageType.JPEG2000, "image/jp2" },
|
||||
{ ImageType.AVIF, "image/avif" },
|
||||
{ ImageType.WEBP, "image/webp" },
|
||||
{ ImageType.TGA, "image/x-tga" },
|
||||
{ ImageType.SVG, "image/svg+xml" }
|
||||
}.ToFrozenDictionary();
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the mime type of <paramref name="type"/>.
|
||||
/// </summary>
|
||||
/// <param name="type">The domain image type for which to get the mime type.</param>
|
||||
/// <returns>The mime type for <paramref name="type"/>.</returns>
|
||||
public static string GetMimeType(ImageType type)
|
||||
{
|
||||
return s_imageTypeToMimeType.TryGetValue(type, out string? mimeType) ? mimeType : "application/octet-stream";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
+3
-3
@@ -51,7 +51,7 @@ public class DirectoriesController : ApiController
|
||||
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _mediator.Send(new GetDirectoryTreeQuery(path, includeFiles, includeHiddenElements), cancellationToken).ConfigureAwait(false);
|
||||
if (!result.IsError && result.Value is not null)
|
||||
{
|
||||
foreach (FileSystemTreeNodeResponse treeNode in result.Value)
|
||||
foreach (FileSystemTreeNodeResponse treeNode in result.Value ?? [])
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
@@ -73,7 +73,7 @@ public class DirectoriesController : ApiController
|
||||
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _mediator.Send(new GetTreeDirectoriesQuery(path,includeHiddenElements), cancellationToken).ConfigureAwait(false);
|
||||
if (!result.IsError && result.Value is not null)
|
||||
{
|
||||
foreach (FileSystemTreeNodeResponse directory in result.Value)
|
||||
foreach (FileSystemTreeNodeResponse directory in result.Value ?? [])
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
@@ -95,7 +95,7 @@ public class DirectoriesController : ApiController
|
||||
ErrorOr<IEnumerable<DirectoryResponse>> result = await _mediator.Send(new GetDirectoriesQuery(path, includeHiddenElements), cancellationToken).ConfigureAwait(false);
|
||||
if (!result.IsError && result.Value is not null)
|
||||
{
|
||||
foreach (DirectoryResponse directory in result.Value)
|
||||
foreach (DirectoryResponse directory in result.Value ?? [])
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
|
||||
@@ -5,7 +5,6 @@ using Lumina.Application.Core.FileManagement.Files.Queries.GetTreeFiles;
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Lumina.Presentation.Api.Common.ModelBinders;
|
||||
using Lumina.Presentation.Api.Core.Controllers.Common;
|
||||
using MapsterMapper;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
@@ -49,7 +48,7 @@ public class FilesController : ApiController
|
||||
[FromQuery] bool includeHiddenElements, [EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _mediator.Send(new GetTreeFilesQuery(path, includeHiddenElements), cancellationToken).ConfigureAwait(false);
|
||||
foreach (FileSystemTreeNodeResponse file in result.Value)
|
||||
foreach (FileSystemTreeNodeResponse file in result.Value ?? [])
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
@@ -70,7 +69,7 @@ public class FilesController : ApiController
|
||||
ErrorOr<IEnumerable<FileResponse>> result = await _mediator.Send(new GetFilesQuery(path, includeHiddenElements), cancellationToken).ConfigureAwait(false);
|
||||
if (!result.IsError)
|
||||
{
|
||||
foreach (FileResponse file in result.Value)
|
||||
foreach (FileResponse file in result.Value ?? [])
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Core.FileManagement.Thumbnails.Queries.GetThumbnail;
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Lumina.Presentation.Api.Common.ModelBinders;
|
||||
using Lumina.Presentation.Api.Common.Utilities;
|
||||
using Lumina.Presentation.Api.Core.Controllers.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Controllers.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Controller for managing file system items thumbnails.
|
||||
/// </summary>
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
public class ThumbnailsController : ApiController
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly ISender _mediator;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ThumbnailsController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="mediator">Injected service for mediating commands and queries.</param>
|
||||
public ThumbnailsController(ISender mediator)
|
||||
{
|
||||
_mediator = mediator;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the thumbnail of a file identified by of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file for which to get the thumbnail.</param>
|
||||
/// <param name="quality">The quality to use for the thumbnail.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-thumbnail")]
|
||||
public async Task<IActionResult> GetThumbnail([FromQuery, ModelBinder(typeof(UrlStringBinder))] string path, [FromQuery] int quality, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<ThumbnailResponse> getResult = await _mediator.Send(new GetThumbnailQuery(path, quality), cancellationToken);
|
||||
return getResult.Match(result => File(result.Bytes, MimeTypes.GetMimeType(result.Type)), errors => Problem(errors));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<PageTitle>Not found</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
@@ -3,7 +3,6 @@ using Lumina.Presentation.Web.Common.Exceptions;
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
using Lumina.Presentation.Web.Common.Models.Configuration;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -79,13 +78,7 @@ public class ApiHttpClient : IApiHttpClient
|
||||
/// <returns>An <see cref="IAsyncEnumerable{T}"/> object, which allows for asynchronous iteration over the deserialized items.</returns>
|
||||
public async IAsyncEnumerable<TResponse?> GetAsyncEnumerable<TResponse>(string endpoint, string? token = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
|
||||
{
|
||||
using HttpRequestMessage request = new(HttpMethod.Get, endpoint);
|
||||
// HttpClient is implemented differently in Blazor WASM, because there are no sockets in the browser, so its BrowserHttpHandler is implemented on top of Fetch API,
|
||||
// which can provide response content in one of two forms: BrowserHttpContent, which is based on arrayBuffer method (this means that it will always read the response stream to its completion,
|
||||
// before making the content available), and StreamContent that is wrapping WasmHttpReadStream, which is based on readable streams (this one allows for reading response as it comes).
|
||||
// WasmHttpReadStream can only work when WebAssemblyEnableStreamingResponse is enabled on request, and only on browsers that support it
|
||||
request.SetBrowserResponseStreamingEnabled(true);
|
||||
|
||||
using HttpRequestMessage request = new(HttpMethod.Get, endpoint);
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// send the request and expect only headers initially - this prevents the client from buffering the entire response
|
||||
|
||||
+6
-19
@@ -1,6 +1,5 @@
|
||||
using Lumina.Presentation.Web.Common.Models.Configuration;
|
||||
using Lumina.Presentation.Web.Common.Models.Configuration;
|
||||
using Lumina.Presentation.Web.Common.Utilities;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@@ -12,30 +11,18 @@ namespace Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
internal static class PresentationWebLayerConfiguration
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Extension method for adding the Lumina.Presentation.Web configuration to the <see cref="WebAssemblyHostBuilder"/>.
|
||||
/// </summary>
|
||||
/// <param name="builder">The <see cref="WebAssemblyHostBuilder"/> to add the configuration to.</param>
|
||||
/// <returns>The updated <see cref="WebAssemblyHostBuilder"/>.</returns>
|
||||
public static WebAssemblyHostBuilder AddConfiguration(this WebAssemblyHostBuilder builder)
|
||||
{
|
||||
// add the configuration sources to the configuration builder
|
||||
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||
builder.Configuration.AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true);
|
||||
|
||||
builder.Services.BindConfiguration(builder.Configuration);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extension method for registering the configuration options of the Lumina.Presentation.Web project into the Dependency Injection container.
|
||||
/// </summary>
|
||||
/// <param name="serviceCollection">The <see cref="IServiceCollection"/> to bind the configuration options to.</param>
|
||||
/// <param name="configuration">The configuration to be bound.</param>
|
||||
/// <returns>The updated <see cref="IServiceCollection"/>.</returns>
|
||||
internal static IServiceCollection BindConfiguration(this IServiceCollection serviceCollection, IConfiguration configuration)
|
||||
internal static IServiceCollection BindConfiguration(this IServiceCollection serviceCollection, IConfigurationManager configuration)
|
||||
{
|
||||
// add the configuration sources to the configuration builder
|
||||
configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||
configuration.AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true);
|
||||
|
||||
serviceCollection.AddOptions<ServerConfigurationModel>()
|
||||
.Bind(configuration.GetRequiredSection(ServerConfigurationModel.SECTION_NAME))
|
||||
.ValidateFluently()
|
||||
|
||||
+13
-7
@@ -1,6 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Exceptions;
|
||||
using Lumina.Presentation.Web.Common.Filters;
|
||||
using Lumina.Presentation.Web.Common.Services;
|
||||
using Lumina.Presentation.Web.Core.Services.UI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -11,6 +13,7 @@ using Polly.Wrap;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json.Serialization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
@@ -28,23 +31,25 @@ public static class PresentationWebLayerServices
|
||||
/// <returns>The updated <see cref="IServiceCollection"/>.</returns>
|
||||
public static IServiceCollection AddPresentationWebLayerServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddControllersWithViews(options => options.Filters.Add(typeof(ApiExceptionFilter)))
|
||||
.AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
|
||||
|
||||
// scan the current assembly for validators and register them to the DI container
|
||||
services.AddValidatorsFromAssemblyContaining<Program>(ServiceLifetime.Singleton);
|
||||
|
||||
// handle transient errors like network timeouts or intermittent failures
|
||||
AsyncRetryPolicy<HttpResponseMessage> retryPolicy = Policy
|
||||
AsyncRetryPolicy<HttpResponseMessage> retryPolicy = Policy<HttpResponseMessage>
|
||||
.Handle<HttpRequestException>()
|
||||
.OrResult<HttpResponseMessage>(r =>
|
||||
!r.IsSuccessStatusCode &&
|
||||
r.StatusCode != HttpStatusCode.Forbidden &&
|
||||
r.StatusCode != HttpStatusCode.BadRequest)
|
||||
.OrInner<ApiException>(ex =>
|
||||
ex.HttpStatusCode != HttpStatusCode.BadRequest &&
|
||||
ex.HttpStatusCode != HttpStatusCode.Forbidden)
|
||||
.WaitAndRetryAsync(3, retryAttempt =>
|
||||
TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
|
||||
|
||||
// use a circuit breaker to prevent repeatedly calling a failing service
|
||||
AsyncCircuitBreakerPolicy<HttpResponseMessage> circuitBreakerPolicy = Policy
|
||||
AsyncCircuitBreakerPolicy<HttpResponseMessage> circuitBreakerPolicy = Policy<HttpResponseMessage>
|
||||
.Handle<HttpRequestException>()
|
||||
.OrResult<HttpResponseMessage>(r => r.StatusCode == HttpStatusCode.InternalServerError)
|
||||
.OrInner<ApiException>(ex => ex.HttpStatusCode == HttpStatusCode.InternalServerError)
|
||||
.CircuitBreakerAsync(3, TimeSpan.FromSeconds(30));
|
||||
|
||||
AsyncPolicyWrap<HttpResponseMessage> policy = Policy.WrapAsync(retryPolicy, circuitBreakerPolicy);
|
||||
@@ -56,6 +61,7 @@ public static class PresentationWebLayerServices
|
||||
|
||||
services.AddSingleton<ComboboxService>();
|
||||
services.AddScoped<INotificationService, NotificationService>();
|
||||
services.AddScoped<ApiExceptionFilter>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Exceptions;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Filters;
|
||||
|
||||
/// <summary>
|
||||
/// Filters API exceptions and provides centralized handling for API-related errors.
|
||||
/// </summary>
|
||||
public class ApiExceptionFilter : IExceptionFilter
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Called after an action has thrown an Exception.
|
||||
/// </summary>
|
||||
/// <param name="context">The <see cref="ExceptionContext"/>.</param>
|
||||
public void OnException(ExceptionContext context)
|
||||
{
|
||||
// check if the exception is an ApiException
|
||||
if (context.Exception is ApiException apiException)
|
||||
{
|
||||
// handle unauthorized errors by prompting the user to re-login
|
||||
if (apiException.HttpStatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
SignOutSynchronously(context.HttpContext);
|
||||
string currentUrl = context.HttpContext.Request.GetDisplayUrl();
|
||||
context.HttpContext.Response.Redirect(currentUrl); // force an entire refresh of the current location, so that header and footer are re-rendered too
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder errorMessage = new();
|
||||
if (apiException.ProblemDetails is not null)
|
||||
{
|
||||
errorMessage.AppendLine($"HTTP {apiException.ProblemDetails.Status} {apiException.HttpStatusCode}<br>");
|
||||
if (!string.IsNullOrEmpty(apiException.ProblemDetails.Detail))
|
||||
errorMessage.AppendLine($"<b>{apiException.ProblemDetails.Detail}<b>");
|
||||
else if (!string.IsNullOrEmpty(apiException.ProblemDetails.Title))
|
||||
errorMessage.AppendLine($"<b>{apiException.ProblemDetails.Title}<b>");
|
||||
if (apiException.ProblemDetails.Extensions is not null && apiException.ProblemDetails.Extensions.TryGetValue("errors", out JsonElement errorsObj))
|
||||
{
|
||||
if (errorsObj is JsonElement jsonElement && jsonElement.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
errorMessage.AppendLine("Validation Errors:");
|
||||
foreach (JsonProperty error in jsonElement.EnumerateObject())
|
||||
{
|
||||
string fieldName = error.Name;
|
||||
if (error.Value.ValueKind == JsonValueKind.Array)
|
||||
foreach (JsonElement errorValue in error.Value.EnumerateArray())
|
||||
errorMessage.AppendLine($"- {fieldName}: {errorValue}<br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (apiException.ProblemDetails.Extensions is not null)
|
||||
foreach (KeyValuePair<string, JsonElement> extension in apiException.ProblemDetails.Extensions)
|
||||
if (extension.Key != "errors")
|
||||
errorMessage.AppendLine($"{extension.Key}: {extension.Value}<br>");
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage.AppendLine($"HTTP {apiException.HttpStatusCode}<br>");
|
||||
errorMessage.AppendLine($"{apiException.Message}<br>");
|
||||
}
|
||||
// return a JSON result with the error details
|
||||
context.Result = new JsonResult(new
|
||||
{
|
||||
success = false,
|
||||
errorMessage = errorMessage.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// return a JSON result with the error details
|
||||
context.Result = new JsonResult(new
|
||||
{
|
||||
success = false,
|
||||
errorMessage = context.Exception.Message.ToString()
|
||||
});
|
||||
}
|
||||
// mark the exception as handled to prevent propagation
|
||||
context.ExceptionHandled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signs out the user synchronously by deleting the authentication cookie and token.
|
||||
/// </summary>
|
||||
/// <param name="httpContext">The HttpContext for the current request.</param>
|
||||
private static void SignOutSynchronously(HttpContext httpContext)
|
||||
{
|
||||
Task task = httpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
task.Wait(); // run the task synchronously
|
||||
httpContext.Response.Cookies.Delete("Token");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a response containing a file system path.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public class PathSegmentModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
@@ -11,4 +16,4 @@ public class PathSegmentModel
|
||||
/// </summary>
|
||||
public string Path { get; set; } = null!;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<button type="submit"
|
||||
style="width: @($"{Width}{(UsesPercentForWidth ? "%" : "px")}"); height: @($"{Height}{(UsesPercentForHeight ? "%" : "px")}");"
|
||||
class="@(IsConfirmButton ? "confirm" : "abort")-button f-16 @CssClass" @onclick="OnClick"
|
||||
disabled="@IsDisabled">
|
||||
@ChildContent
|
||||
</button>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment? ChildContent { get; set; }
|
||||
[Parameter] public EventCallback OnClick { get; set; }
|
||||
[Parameter] public bool IsDisabled { get; set; }
|
||||
[Parameter] public bool IsConfirmButton { get; set; } = true;
|
||||
[Parameter] public bool UsesPercentForHeight { get; set; }
|
||||
[Parameter] public bool UsesPercentForWidth { get; set; }
|
||||
[Parameter] public int Width { get; set; } = 100;
|
||||
[Parameter] public int Height { get; set; } = 22;
|
||||
[Parameter] public string? CssClass { get; set; }
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<label class="enlightenment-checkbox-label @CssClass">
|
||||
<input type="checkbox"
|
||||
class="enlightenment-checkbox-hidden"
|
||||
checked="@Checked"
|
||||
@onchange="OnChangeHandler"
|
||||
disabled="@Disabled" />
|
||||
<span class="enlightenment-checkbox"></span>
|
||||
@Label
|
||||
</label>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool Checked { get; set; }
|
||||
[Parameter] public EventCallback<bool> CheckedChanged { get; set; }
|
||||
[Parameter] public string? Label { get; set; }
|
||||
[Parameter] public bool Disabled { get; set; }
|
||||
[Parameter] public string CssClass { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Handles the change event.
|
||||
/// </summary>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private async Task OnChangeHandler(ChangeEventArgs e)
|
||||
{
|
||||
Checked = e?.Value != null ? (bool)e.Value : false;
|
||||
await CheckedChanged.InvokeAsync(Checked).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
.enlightenment-checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
color: #6DCBFE;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.enlightenment-checkbox-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.enlightenment-checkbox {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-top: #000000 1px solid;
|
||||
border-bottom: #333333 1px solid;
|
||||
border-left: #000000 1px solid;
|
||||
border-right: #333333 1px solid;
|
||||
border-radius: 0;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
background: linear-gradient(to bottom, #111, #222 50%, #333);
|
||||
}
|
||||
|
||||
.enlightenment-checkbox-hidden:checked + .enlightenment-checkbox {
|
||||
background-image: linear-gradient(180deg, #5E5D5D, #505050, #424343);
|
||||
border-top: #888888 1px solid;
|
||||
border-bottom: #333333 1px solid;
|
||||
border-left: #666666 1px solid;
|
||||
border-right: #444444 1px solid;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
@using Lumina.Presentation.Web.Common.Models.UI
|
||||
@using Lumina.Presentation.Web.Core.Services.UI
|
||||
|
||||
@typeparam TValue
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
@inject ComboboxService _comboboxService
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<div id="combobox_@Id" class="enlightenment-combobox inline-block w-100 @(IsOpen ? "open" : string.Empty) @CssClass">
|
||||
<div class="shine-effect"></div>
|
||||
<input type="checkbox" class="enlightenment-toggle-checkbox" @bind="IsOpen" id="combobox_checkbox_@Id" @onclick="ToggleDropdownAsync">
|
||||
<label class="enlightenment-toggle" for="combobox_checkbox_@Id">
|
||||
<span class="enlightenment-selected-text">@(SelectedItem?.Text ?? "No item selected")</span>
|
||||
</label>
|
||||
<div class="enlightenment-dropdown">
|
||||
<div class="shine-effect"></div>
|
||||
<div class="enlightenment-item first-item disabled italic" @onclick="() => SelectItem(null)">No item selected</div>
|
||||
|
||||
@for (int i = 0; i < Items?.Count; i++)
|
||||
{
|
||||
var item = Items[i];
|
||||
var cssClass = $"enlightenment-item {(i == Items.Count - 1 ? "last-item" : string.Empty)} {(item.IsEnabled ? string.Empty : "disabled")}";
|
||||
<div class="@cssClass" @onclick="() => SelectItem(item)">@item.Text</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public List<ComboboxItem<TValue>> Items { get; set; } = [];
|
||||
[Parameter] public ComboboxItem<TValue>? SelectedItem { get; set; }
|
||||
[Parameter] public EventCallback<ComboboxItem<TValue>> SelectedItemChanged { get; set; }
|
||||
[Parameter] public string? CssClass { get; set; }
|
||||
|
||||
private bool IsOpen { get; set; }
|
||||
private Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component.
|
||||
/// </summary>
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_comboboxService.ComboboxOpened += CloseIfNotThisAsync;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the dropdown state.
|
||||
/// </summary>
|
||||
private async Task ToggleDropdownAsync()
|
||||
{
|
||||
IsOpen = !IsOpen;
|
||||
if (IsOpen)
|
||||
{
|
||||
_comboboxService.NotifyComboboxOpened("combobox_checkbox_" + Id);
|
||||
await JSRuntime.InvokeVoidAsync("adjustDropdownHeight", "combobox_" + Id).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the dropdown if the provided <paramref name="openedId"/> is not the current <see cref="Id"/>, or if it's <see langword="null"/>.
|
||||
/// </summary>
|
||||
/// <param name="openedId">The optional id of the combobox that initiated the dropdown state change.</param>
|
||||
private async Task CloseIfNotThisAsync(string? openedId)
|
||||
{
|
||||
if (openedId != "combobox_checkbox_" + Id && IsOpen)
|
||||
{
|
||||
IsOpen = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the provided <paramref name="item"/>.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to select.</param>
|
||||
private async Task SelectItem(ComboboxItem<TValue>? item)
|
||||
{
|
||||
SelectedItem = item;
|
||||
IsOpen = false;
|
||||
await SelectedItemChanged.InvokeAsync(item).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the component.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_comboboxService.ComboboxOpened -= CloseIfNotThisAsync;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<input type="@Type"
|
||||
@ref="inputElement"
|
||||
style="width: @($"{Width}{(UsesPercentForWidth ? "%" : "px")}"); height: @($"{Height}{(UsesPercentForHeight ? "%" : "px")}");"
|
||||
class="enlightenment-input @CssClass"
|
||||
name="@Name"
|
||||
autocomplete="@(AutoComplete ? "on" : "off")"
|
||||
value="@Value"
|
||||
@oninput="OnInputHandlerAsync"
|
||||
@onkeydown="OnKeyDownAsync"
|
||||
placeholder="@Placeholder"
|
||||
disabled="@IsDisabled"
|
||||
readonly="@IsReadOnly"
|
||||
data-has-error="@HasError"
|
||||
id="@Id" />
|
||||
|
||||
@code {
|
||||
[Parameter] public string? Id { get; set; }
|
||||
[Parameter] public string Type { get; set; } = "text";
|
||||
[Parameter] public bool UsesPercentForHeight { get; set; }
|
||||
[Parameter] public bool UsesPercentForWidth { get; set; } = true;
|
||||
[Parameter] public int Width { get; set; } = 100;
|
||||
[Parameter] public int Height { get; set; } = 28;
|
||||
[Parameter] public string? CssClass { get; set; }
|
||||
[Parameter] public string? Name { get; set; }
|
||||
[Parameter] public bool AutoComplete { get; set; } = true;
|
||||
[Parameter] public string? Value { get; set; }
|
||||
[Parameter] public EventCallback<string> ValueChanged { get; set; }
|
||||
[Parameter] public EventCallback OnEnterPressed { get; set; }
|
||||
[Parameter] public EventCallback OnEscapePressed { get; set; }
|
||||
[Parameter] public string? Placeholder { get; set; }
|
||||
[Parameter] public bool IsDisabled { get; set; }
|
||||
[Parameter] public bool IsReadOnly { get; set; }
|
||||
[Parameter] public bool HasError { get; set; }
|
||||
|
||||
private ElementReference inputElement;
|
||||
|
||||
/// <summary>
|
||||
/// Handles the event risen after the component was rendered.
|
||||
/// </summary>
|
||||
/// <param name="firstRender">Indicates whether this is the first render or not.</param>
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
await JSRuntime.InvokeVoidAsync("windowKeyDownHandler", inputElement, DotNetObjectReference.Create(this)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the input change event.
|
||||
/// </summary>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private async Task OnInputHandlerAsync(ChangeEventArgs e)
|
||||
{
|
||||
Value = e.Value?.ToString();
|
||||
await ValueChanged.InvokeAsync(Value).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the key down event.
|
||||
/// </summary>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private async Task OnKeyDownAsync(KeyboardEventArgs e)
|
||||
{
|
||||
if (e.Key == "Enter" || e.Code == "NumpadEnter")
|
||||
await OnEnterPressed.InvokeAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Escape key pressed.
|
||||
/// </summary>
|
||||
[JSInvokable]
|
||||
public void EscapePressed()
|
||||
{
|
||||
OnEscapePressed.InvokeAsync(Value);
|
||||
}
|
||||
}
|
||||
@@ -1,921 +0,0 @@
|
||||
@using Lumina.Presentation.Web.Common.Models.Common
|
||||
@using Lumina.Presentation.Web.Common.Api
|
||||
@using Lumina.Presentation.Web.Common.Enums.FileSystem
|
||||
@using Lumina.Presentation.Web.Common.Enums.Notifications
|
||||
@using Lumina.Presentation.Web.Common.Exceptions
|
||||
@using Lumina.Presentation.Web.Common.Models.FileManagement
|
||||
@using Lumina.Presentation.Web.Common.Models.UI
|
||||
@using Lumina.Presentation.Web.Common.Services
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using System.Text.Json
|
||||
@using System.Text
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject IApiHttpClient _apiHttpClient
|
||||
@inject INotificationService _notificationService
|
||||
|
||||
<div id="file-system-browser-dialog" class="container-background above-modal">
|
||||
<div id="file-system-browser-content">
|
||||
<div id="file-system-browser-header">
|
||||
<div id="file-system-browser-shine-spark"></div>
|
||||
<div id="file-system-browser-shine-effect"></div>
|
||||
<div id="file-system-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" @onclick="@(() => ChangeViewModeAsync(FileSystemViewMode.List))" />
|
||||
<img src="images/ui/details.png" id="navigator-details-view" alt="Details View" title="Details View" @onclick="@(() => ChangeViewModeAsync(FileSystemViewMode.Details))" />
|
||||
<img src="images/ui/small-icons.png" id="navigator-small-icons-view" alt="Small Icons View" title="Small Icons View" @onclick="@(() => ChangeIconSizeAsync(FileSystemIconSize.Small))" />
|
||||
<img src="images/ui/medium-icons.png" id="navigator-medium-icons-view" alt="Medium Icons View" title="Medium Icons View" @onclick="@(() => ChangeIconSizeAsync(FileSystemIconSize.Medium))" />
|
||||
<img src="images/ui/large-icons.png" id="navigator-large-icons-view" alt="Large Icons View" title="Large Icons View" @onclick="@(() => ChangeIconSizeAsync(FileSystemIconSize.Large))" />
|
||||
<img src="images/ui/extra-large-icons.png" id="navigator-extra-large-icons-view" alt="Extra Large Icons View" title="Extra Large Icons View" @onclick="@(() => ChangeIconSizeAsync(FileSystemIconSize.ExtraLarge))" />
|
||||
</div>
|
||||
<div id="navigator-navigation-controls-container">
|
||||
<div id="navigator-history">
|
||||
<img src="images/ui/back.svg" class="navigation-icon" alt="Back" title="Back" @onclick="NavigateBackAsync" />
|
||||
<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>
|
||||
<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>
|
||||
<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(5,5) scale(0.85)">
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill @(showHiddenElements ? " enabled" : string.Empty)" filter="url(#glow)" 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" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill @(showHiddenElements ? " enabled" : string.Empty)" filter="url(#glow)" 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 15.9261Z" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill @(showHiddenElements ? " enabled" : string.Empty)" filter="url(#glow)" 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" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
<svg @onclick="ToggleSelectionModeAsync" id="navigator-toggle-selection-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 Selection Mode</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="linearGradient1" 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(8,8) scale(0.030)">
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill @(isSelectionMode ? " enabled" : string.Empty)" filter="url(#glow)" d="M161.9,21.9v21.9h131.2V0H161.9v43.7V21.9v21.9h131.2V0H161.9v43.7V21.9z M406.6,425.9L393,408.7l-52.4,41.6l-79.4-102.1 l-53,61.8l-38.9-217.9l198.1,99.1l-78.6,26.2l100.9,122.4L406.6,425.9L393,408.7L406.6,425.9l16.9-13.9l-60.4-73.2l118.3-39.4 L110.8,114l70.4,394.5l78.2-91.2l73.7,94.7l104.5-82.9l-14.2-17.2L406.6,425.9z M424.3,87.5V0h-87.5v43.7l43.7,0l0,43.7H424.3 L424.3,87.5z M118.1,0H30.7v87.5h43.7l0-43.7l43.7,0V0L118.1,0z M30.7,306.2v87.5h87.5v-43.7l-43.7,0l0-43.7H30.7z M402.5,131.2 h-21.9v87.5h43.7v-87.5h-43.7H402.5h-21.9v87.5h43.7v-87.5h-43.7H402.5z M52.5,262.4h21.9V131.2H30.7v131.2h43.7H52.5h21.9V131.2 H30.7v131.2h43.7H52.5z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
@* <img src="images/ui/toggle-selection.svg" @onclick="ToggleColor"
|
||||
style="@($"--text-color: {_currentTextColor}; --stroke-color: {_currentStrokeColor};")" id="navigator-toggle-selection-button" alt="Toggle Selection Mode" title="Toggle Selection Mode" class="navigator-icon" /> *@
|
||||
@* <object data="images/ui/toggle-selection.svg" type="image/svg+xml" id="navigator-toggle-selection-button" alt="Toggle Selection Mode" title="Toggle Selection Mode" class="navigator-icon ColorScheme-Text" /> *@
|
||||
</div>
|
||||
<div id="navigator-address-bar-container">
|
||||
<div id="navigator-address-bar-group">
|
||||
@if (isNavigationPathEditMode)
|
||||
{
|
||||
<EnlightenmentInput CssClass="navigator-address-bar-input" Type="text" @bind-Value="@Path" Name="navigator-address-bar-input"
|
||||
AutoComplete="true" OnEnterPressed="ExitNavigationPathEditModeAsync" OnEscapePressed="HandleNavigatorInputEscapePressedAsync" Id="navigator-address-bar-input" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div id="navigator-address-bar">
|
||||
<ul id="navigator-path-segments" @onclick="EnterNavigationPathEditModeAsync">
|
||||
@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" checked="@(expandedPathSegmentIndex == localIndex)"
|
||||
@onchange="@(e => ToggleNavigatorPathSegment(e, localIndex))" @onclick:stopPropagation />
|
||||
<label class="navigator-toggle" for="segment-toggle-@i" @onclick:stopPropagation>
|
||||
<span class="navigator-selected-text" @onclick:stopPropagation>@pathSegment.Path</span>
|
||||
<span class="navigator-arrow" @onclick:stopPropagation></span>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<EnlightenmentButton CssClass="navigator-edit-path-button" IsConfirmButton="false" Height="28" Width="35" OnClick="EnterNavigationPathEditModeAsync">
|
||||
<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" OnClick="ExitNavigationPathEditModeAsync">
|
||||
<img src="images/ui/check.svg" id="navigator-navigate-icon" alt="Navigate" title="Navigate" />
|
||||
</EnlightenmentButton>
|
||||
<EnlightenmentButton CssClass="file-system-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="file-system-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="file-system-browser-file-system-container">
|
||||
<!--File System Tree View-->
|
||||
<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)
|
||||
{
|
||||
<FileSystemTreeViewNode Node="node" OnExpandToggle="ToggleTreeViewNode" OnNodeSelected="HandleFileSystemTreeViewNodeSelectedAsync" SelectedNodePath="@selectedNodePath" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<EnlightenmentCombobox CssClass="file-system-browser-file-system-sources" Items="null" @bind-SelectedItem="selectedValue" />
|
||||
</div>
|
||||
<!--End File System Tree View-->
|
||||
<div id="file-system-browser-file-system-directories-container">
|
||||
<div id="file-system-browser-file-system-directories">
|
||||
<div id="file-system-browser-file-system-explorer-container" class="scroll-@(viewMode is FileSystemViewMode.List ? "horizontal" : "vertical")">
|
||||
<div id="file-system-browser-file-system-explorer-details-header" style="height: @(viewMode is FileSystemViewMode.Details ? 20 : 0)px;">
|
||||
<span>Name</span>
|
||||
</div>
|
||||
<div id="file-system-browser-file-system-explorer" class="@viewMode.ToString().ToLower()" style="flex-direction: @(viewMode is FileSystemViewMode.List or FileSystemViewMode.Details ? "column" : "row");">
|
||||
@foreach (FileSystemItemModel fileSystemItem in fileSystemItems)
|
||||
{
|
||||
string iconSizeClass = "list-icons";
|
||||
if (viewMode == FileSystemViewMode.Details)
|
||||
iconSizeClass = "details-icons";
|
||||
else if (viewMode == FileSystemViewMode.Icons)
|
||||
{
|
||||
if (iconSize == FileSystemIconSize.Small)
|
||||
iconSizeClass = "small-icons";
|
||||
else if (iconSize == FileSystemIconSize.Medium)
|
||||
iconSizeClass = "medium-icons";
|
||||
else if (iconSize == FileSystemIconSize.Large)
|
||||
iconSizeClass = "large-icons";
|
||||
else if (iconSize == FileSystemIconSize.ExtraLarge)
|
||||
iconSizeClass = "extra-large-icons";
|
||||
}
|
||||
string itemType = fileSystemItem is FileModel ? "file" : "directory";
|
||||
<div class="e @iconSizeClass" data-path="@fileSystemItem.Path" data-type="@itemType" onmouseup="handleFileSystemEntityMouseUp(event)" onmousedown="handleFileSystemEntityMouseDown(event)">
|
||||
<div class="icon"><img src="/images/icons/Lyra/@(itemType).svg"></div>
|
||||
<div class="text"><span class="@(itemType == "directory" ? "d" : "f") t">@fileSystemItem.Name</span></div>
|
||||
<div class="date-modified @(itemType == "directory" ? "d" : "f")" style="display: none;">@fileSystemItem.DateModified</div>
|
||||
<div class="size @(itemType == "directory" ? "d" : "f")" style="display: none;"> @(itemType == "file" ? (fileSystemItem as FileModel)!.Size : 0)</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="file-system-browser-actions-container">
|
||||
<div id="file-system-browser-actions-path-container">
|
||||
<label class="text-light-one">Directory</label>
|
||||
<EnlightenmentInput Type="text" Name="selected-directory" IsReadOnly="true" AutoComplete="true" />
|
||||
</div>
|
||||
<div id="file-system-browser-actions">
|
||||
<EnlightenmentButton IsConfirmButton="false">Cancel</EnlightenmentButton>
|
||||
<EnlightenmentButton>Open</EnlightenmentButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* <div id="divModal"></div>
|
||||
<label class="text-light-one">Enter new directory name:</label>
|
||||
<EnlightenmentInput Type="text" Name="newDirectoryName" AutoComplete="true" />
|
||||
<EnlightenmentButton IsConfirmButton="false">Cancel</EnlightenmentButton>
|
||||
<EnlightenmentButton>Confirm</EnlightenmentButton> *@
|
||||
</div>
|
||||
<div id="visible-selection-rectangle"></div>
|
||||
<div id="selection-rectangle"></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="@(() => NavigateToPathAsync(directory.Path, isForwardNavigation: false, isBackwardNavigation: false))">@directory.Name</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@code {
|
||||
[Parameter] public string? Path { get; set; }
|
||||
[Parameter] public bool IncludeFiles { get; set; }
|
||||
|
||||
public EventCallback<string> OnNodeSelected { get; set; }
|
||||
|
||||
private List<FileSystemTreeNodeModel> treeViewRootNodes = [];
|
||||
private List<FileSystemItemModel> fileSystemItems = [];
|
||||
private FileSystemTypeModel fileSystemType = null!;
|
||||
private ComboboxItem<string>? selectedValue;
|
||||
private PathSegmentModel[]? pathSegments;
|
||||
private string pathSeparator = "/";
|
||||
private string? selectedNodePath;
|
||||
private string? _path;
|
||||
private bool isSelectionMode;
|
||||
private bool showHiddenElements; // TODO: take from config
|
||||
private bool showFileSystemTreeView = true; // TODO: take from config
|
||||
private bool showPathSegmentDowpDown;
|
||||
private bool isNavigationPathEditMode;
|
||||
private int? expandedPathSegmentIndex;
|
||||
private FileSystemViewMode viewMode = FileSystemViewMode.List; // TODO: take from config
|
||||
private FileSystemIconSize iconSize;
|
||||
private Dictionary<int, List<FileSystemTreeNodeModel>> pathSegmentsSubdirectoriesCache = [];
|
||||
private DotNetObjectReference<FileSystemBrowser>? reference;
|
||||
private readonly Stack<string> undoStack = [];
|
||||
private readonly Stack<string> redoStack = [];
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component.
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await GetFileSystemPropertiesAsync().ConfigureAwait(false);
|
||||
if (Path is not null)
|
||||
{
|
||||
if (!Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
await NavigateToPathAsync(Path, isForwardNavigation: false, isBackwardNavigation: false).ConfigureAwait(false);
|
||||
}
|
||||
await ChangeViewModeAsync(viewMode).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the event risen after the component was rendered.
|
||||
/// </summary>
|
||||
/// <param name="firstRender">Indicates whether this is the first render or not.</param>
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
// on first render, subscribe this component to the javascript function that handles window clicks
|
||||
if (firstRender)
|
||||
{
|
||||
reference = DotNetObjectReference.Create(this);
|
||||
// assign the elements of this component instance to javascript variables, for memoization
|
||||
await JSRuntime.InvokeVoidAsync("initializeFileSystemBrowser", reference).ConfigureAwait(false);
|
||||
// make the navigator path segments horizontally scrollable
|
||||
await JSRuntime.InvokeVoidAsync("addHorizontalScrolling", "navigator-address-bar").ConfigureAwait(false);
|
||||
// subscribe to window clicks
|
||||
await JSRuntime.InvokeVoidAsync("windowClickHandler", reference).ConfigureAwait(false);
|
||||
}
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the window click event.
|
||||
/// </summary>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
[JSInvokable]
|
||||
public async Task OnWindowClickAsync(dynamic e)
|
||||
{
|
||||
// parse the event args and get the initiator of the event
|
||||
var jsonElement = (JsonElement)e;
|
||||
string? sender = jsonElement.GetProperty("sender").GetString();
|
||||
// ignore the event if it was initiated by a path segment (don't collapse an element that was just expanded)
|
||||
if (showPathSegmentDowpDown && sender is not null && !sender.Contains("segment-toggle-"))
|
||||
{
|
||||
// otherwise, collapse all path segments
|
||||
showPathSegmentDowpDown = false;
|
||||
expandedPathSegmentIndex = null;
|
||||
}
|
||||
// exit navigator path edit mode when clicking anywhere outside of it, or on elements that should not exit it
|
||||
if (sender is null || (sender is not null && !sender.Contains("navigator-path-segments") && !sender.Contains("navigator-edit-icon") && !sender.Contains("navigator-address-bar-input")))
|
||||
isNavigationPathEditMode = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expands or collapses a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="node">The node to expand or collapse.</param>
|
||||
private async Task ToggleTreeViewNode(FileSystemTreeNodeModel node)
|
||||
{
|
||||
if (!node.IsExpanded && !node.ChildrenLoaded)
|
||||
{
|
||||
node.Children = new List<FileSystemTreeNodeModel>();
|
||||
node.IsExpanded = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
if (await CheckPathAsync(node.Path).ConfigureAwait(false))
|
||||
{
|
||||
try
|
||||
{
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"directories/get-tree-directories?path={Uri.EscapeDataString(node.Path)}&includeHiddenElements={showHiddenElements}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
if (IncludeFiles)
|
||||
{
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"files/get-tree-files?path={Uri.EscapeDataString(node.Path)}&includeHiddenElements={showHiddenElements}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
HandleApiException(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
node.ChildrenLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
node.IsExpanded = !node.IsExpanded;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the change event.
|
||||
/// </summary>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private async Task ToggleNavigatorPathSegment(ChangeEventArgs e, int toggledIndex)
|
||||
{
|
||||
// uncheck all other path segment checkboxes
|
||||
await JSRuntime.InvokeVoidAsync("uncheckAllExcept", $"segment-toggle-{toggledIndex}").ConfigureAwait(false);
|
||||
// check if the checkbox is checked
|
||||
bool isChecked = (bool)e.Value!;
|
||||
// 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;
|
||||
// fetch directories for the expanded path segment
|
||||
try
|
||||
{
|
||||
if (concatenatedPath != pathSeparator) // on UNIX, dont get the parent, if we are at root path
|
||||
{
|
||||
PathSegmentModel[] parentLocationResponse = await _apiHttpClient.GetAsync<PathSegmentModel[]>($"path/get-path-parent?path={Uri.EscapeDataString(concatenatedPath)}").ConfigureAwait(false);
|
||||
parentConcatenatedPath = parentLocationResponse[0].Path;
|
||||
for (int i = 1; i < parentLocationResponse.Length; i++)
|
||||
parentConcatenatedPath = $"{(parentConcatenatedPath != pathSeparator ? parentConcatenatedPath : string.Empty)}{pathSeparator}{pathSegments[i].Path}";
|
||||
}
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
HandleApiException(ex);
|
||||
}
|
||||
if (!concatenatedPath.EndsWith(pathSeparator))
|
||||
concatenatedPath += pathSeparator;
|
||||
// add current and parent directories too
|
||||
List<FileSystemTreeNodeModel> directories = [new() { Path = concatenatedPath, Name = ".", }, new() { Path = parentConcatenatedPath, Name = ".." }];
|
||||
// add the rest of the subdirectories of the expanded path node
|
||||
await foreach (FileSystemTreeNodeModel? directory in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"directories/get-tree-directories?path={Uri.EscapeDataString(concatenatedPath)}&includeHiddenElements={showHiddenElements}").ConfigureAwait(false))
|
||||
if (directory is not null)
|
||||
directories.Add(directory);
|
||||
// store the directories for this segment
|
||||
pathSegmentsSubdirectoriesCache[toggledIndex] = directories;
|
||||
expandedPathSegmentIndex = toggledIndex;
|
||||
showPathSegmentDowpDown = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// invoke the javascript function that positions the dropdown underneath the toggled path segment
|
||||
await JSRuntime.InvokeVoidAsync("updateDropdownPosition", $"path-segment-{toggledIndex}").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
expandedPathSegmentIndex = null;
|
||||
showPathSegmentDowpDown = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the selection of a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the selected node.</param>
|
||||
/// <param name="isForwardNavigation">Indicates whether the navigation is towards a location in the redo stack or not.</param>
|
||||
/// <param name="isBackwardNavigation">Indicates whether the navigation is towards a location in the undo stack or not.</param>
|
||||
private async Task NavigateToPathAsync(string path, bool isForwardNavigation, bool isBackwardNavigation)
|
||||
{
|
||||
if (await CheckPathAsync(path).ConfigureAwait(false))
|
||||
{
|
||||
// check if backward navigation is possible
|
||||
if (isBackwardNavigation)
|
||||
{
|
||||
if (undoStack.Count > 0)
|
||||
{
|
||||
// get the first path in the backward navigation list
|
||||
string backwardPath = undoStack.Pop();
|
||||
// put the current path in the forward navigationlist, before navigating to the backward path
|
||||
if (Path is not null)
|
||||
{
|
||||
if (!Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
redoStack.Push(Path);
|
||||
}
|
||||
path = backwardPath;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else if (isForwardNavigation) // check if forward navigation is possible
|
||||
{
|
||||
if (redoStack.Count > 0)
|
||||
{
|
||||
// get the first path in the forward navigation list
|
||||
string forwardPath = redoStack.Pop();
|
||||
// put the current path in the backward navigation list, before navigating to the forward path
|
||||
if (Path is not null)
|
||||
{
|
||||
if (!Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
if (undoStack.Count == 0 || (undoStack.Count > 0 && undoStack.Peek() != Path))
|
||||
undoStack.Push(Path);
|
||||
}
|
||||
path = forwardPath;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else // navigation to a brand new location (up, directory browse, manual path edit, etc)
|
||||
{
|
||||
redoStack.Clear();
|
||||
if (Path is not null && Path != path) // when navigating up, Path will be set after navigation
|
||||
{
|
||||
if (undoStack.Count == 0 || (undoStack.Count > 0 && undoStack.Peek() != Path))
|
||||
undoStack.Push(Path);
|
||||
}
|
||||
else if (_path is not null && _path != path) // when editing the address, Path already comes set, check against control value
|
||||
{
|
||||
if (undoStack.Count == 0 || (undoStack.Count > 0 && undoStack.Peek() != _path))
|
||||
undoStack.Push(_path);
|
||||
}
|
||||
}
|
||||
_path = path; // we are about to navigate to the new path, store its value in the control variable
|
||||
try
|
||||
{
|
||||
await GetNavigatorPathAsync(path).ConfigureAwait(false);
|
||||
if (showFileSystemTreeView)
|
||||
await GetFileSystemTreeAsync(path).ConfigureAwait(false);
|
||||
await GetFileSystemItemsAsync(path).ConfigureAwait(false);
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
HandleApiException(ex);
|
||||
}
|
||||
}
|
||||
selectedNodePath = _path;
|
||||
Path = _path; // also update the navigation input address
|
||||
if (Path is not null && !Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
await OnNodeSelected.InvokeAsync(path).ConfigureAwait(false);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides backwards navigation.
|
||||
/// </summary>
|
||||
private async Task NavigateBackAsync()
|
||||
{
|
||||
if (Path is not null)
|
||||
await NavigateToPathAsync(Path, isForwardNavigation: false, isBackwardNavigation: true).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides forwards navigation.
|
||||
/// </summary>
|
||||
private async Task NavigateForwardAsync()
|
||||
{
|
||||
if (Path is not null)
|
||||
await NavigateToPathAsync(Path, isForwardNavigation: true, isBackwardNavigation: false).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides upwards navigation.
|
||||
/// </summary>
|
||||
private async Task NavigateUpAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Path is not null)
|
||||
{
|
||||
// ask the API for the parent path
|
||||
PathSegmentModel[] parentLocationResponse = await _apiHttpClient.GetAsync<PathSegmentModel[]>($"path/get-path-parent?path={Uri.EscapeDataString(Path)}").ConfigureAwait(false);
|
||||
// if the answer was valid, and we can navigate up, reconstruct the provided path from its segments, and navigate to it
|
||||
if (parentLocationResponse is not null)
|
||||
{
|
||||
string parentConcatenatedPath = parentLocationResponse[0].Path;
|
||||
for (int i = 1; i < parentLocationResponse.Length; i++)
|
||||
parentConcatenatedPath = $"{(parentConcatenatedPath != pathSeparator ? parentConcatenatedPath : string.Empty)}{pathSeparator}{parentLocationResponse[i].Path}";
|
||||
if (!parentConcatenatedPath.EndsWith(pathSeparator))
|
||||
parentConcatenatedPath += pathSeparator;
|
||||
await NavigateToPathAsync(parentConcatenatedPath, isForwardNavigation: false, isBackwardNavigation: false).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
HandleApiException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the file system directories double click event.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the double clicked directory.</param>
|
||||
[JSInvokable()]
|
||||
public async Task OnDirectoryDoubleClickAsync(string path)
|
||||
{
|
||||
await NavigateToPathAsync(path, isForwardNavigation: false, isBackwardNavigation: false).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the properties of the file system.
|
||||
/// </summary>
|
||||
private async Task GetFileSystemPropertiesAsync()
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the specified path is a valid file system path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to check.</param>
|
||||
/// <returns><see langword="true"/> if the specified path is valid, <see langword="false"/> otherwise.</returns>
|
||||
private async Task<bool> CheckPathAsync(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var isPathValidResponse = await _apiHttpClient.GetAsync<PathValidModel>($"path/validate?path={Uri.EscapeDataString(path)}").ConfigureAwait(false);
|
||||
if (!isPathValidResponse.IsValid)
|
||||
{
|
||||
_notificationService.Show("Specified path is not valid!", NotificationType.Error); // TODO: should ask error message from server when translation is implemented
|
||||
Path = _path;
|
||||
if (Path is not null && !Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
}
|
||||
PathExistsModel pathExistsResponse = await _apiHttpClient.GetAsync<PathExistsModel>($"path/check-path-exists?path={Uri.EscapeDataString(path)}").ConfigureAwait(false);
|
||||
if (!pathExistsResponse.Exists)
|
||||
{
|
||||
_notificationService.Show("Specified path does not exist!", NotificationType.Error); // TODO: should ask error message from server when translation is implemented
|
||||
return false;
|
||||
}
|
||||
return isPathValidResponse.IsValid;
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
HandleApiException(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the navigator path segments.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the navigator path segments.</param>
|
||||
private async Task GetNavigatorPathAsync(string path)
|
||||
{
|
||||
pathSegments = await _apiHttpClient.GetAsync<PathSegmentModel[]>($"path/split?path={Uri.EscapeDataString(path!)}").ConfigureAwait(false);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file system items that are displayed in the file system tree view pane.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the file system items.</param>
|
||||
private async Task GetFileSystemTreeAsync(string path)
|
||||
{
|
||||
treeViewRootNodes = [];
|
||||
// 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 there was an initial path saved from a previous session, load the full tree up to that initial path
|
||||
List<FileSystemTreeNodeModel> initialTree = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"directories/get-directory-tree?path={Uri.EscapeDataString(path!)}&includeFiles={IncludeFiles}&includeHiddenElements={showHiddenElements}").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(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];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the files and directories for the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the files and directories.</param>
|
||||
private async Task GetFileSystemItemsAsync(string path)
|
||||
{
|
||||
fileSystemItems.Clear();
|
||||
try
|
||||
{
|
||||
await foreach (DirectoryModel? directory in _apiHttpClient.GetAsyncEnumerable<DirectoryModel>($"directories/get-directories?path={Uri.EscapeDataString(path)}&includeHiddenElements={showHiddenElements}").ConfigureAwait(false))
|
||||
{
|
||||
if (directory is not null)
|
||||
{
|
||||
fileSystemItems.Add(directory);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
if (IncludeFiles)
|
||||
{
|
||||
await foreach (FileModel? file in _apiHttpClient.GetAsyncEnumerable<FileModel>($"files/get-files?path={Uri.EscapeDataString(path)}&includeHiddenElements={showHiddenElements}").ConfigureAwait(false))
|
||||
{
|
||||
if (file is not null)
|
||||
{
|
||||
fileSystemItems.Add(file);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
HandleApiException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the current file system explorer view.
|
||||
/// </summary>
|
||||
/// <param name="newViewMode">The new explorer view to change to.</param>
|
||||
private async Task ChangeViewModeAsync(FileSystemViewMode newViewMode)
|
||||
{
|
||||
viewMode = newViewMode;
|
||||
if (viewMode == FileSystemViewMode.List)
|
||||
await JSRuntime.InvokeVoidAsync("addHorizontalScrolling", "file-system-browser-file-system-explorer").ConfigureAwait(false);
|
||||
else
|
||||
await JSRuntime.InvokeVoidAsync("removeHorizontalScrolling", "file-system-browser-file-system-explorer").ConfigureAwait(false);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the icon size for the file system items.
|
||||
/// </summary>
|
||||
/// <param name="newIconSize">Thew new icon size to change to.</param>
|
||||
private async Task ChangeIconSizeAsync(FileSystemIconSize newIconSize)
|
||||
{
|
||||
viewMode = FileSystemViewMode.Icons;
|
||||
iconSize = newIconSize;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enters the edit mode where the navigator path can be edited freely.
|
||||
/// </summary>
|
||||
private async Task EnterNavigationPathEditModeAsync()
|
||||
{
|
||||
isNavigationPathEditMode = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await InvokeAsync(async () =>
|
||||
{
|
||||
await Task.Delay(50); // a small delay is necessary to ensure the DOM has updated
|
||||
await SetFocusOnNavigatorAddressInputAsync().ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exits the edit mode where the navigator path can be edited freely.
|
||||
/// </summary>
|
||||
private async Task ExitNavigationPathEditModeAsync()
|
||||
{
|
||||
isNavigationPathEditMode = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
if (Path is not null)
|
||||
{
|
||||
if (!Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
await NavigateToPathAsync(Path, isForwardNavigation: false, isBackwardNavigation: false).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the selection of a node in the file system tree view.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the newly selected node.</param>
|
||||
private async Task HandleFileSystemTreeViewNodeSelectedAsync(string path)
|
||||
{
|
||||
await InvokeAsync(StateHasChanged);
|
||||
if (selectedNodePath is not null)
|
||||
{
|
||||
Path = path;
|
||||
if (!Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
await NavigateToPathAsync(Path, isForwardNavigation: false, isBackwardNavigation: false).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Escape key being pressed in the navigator address input.
|
||||
/// </summary>
|
||||
private async Task HandleNavigatorInputEscapePressedAsync()
|
||||
{
|
||||
Path = _path;
|
||||
isNavigationPathEditMode = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the focus to the navigator address input.
|
||||
/// </summary>
|
||||
public async Task SetFocusOnNavigatorAddressInputAsync()
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("focusNavigatorInputElement").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables selection mode.
|
||||
/// </summary>
|
||||
private async Task ToggleSelectionModeAsync()
|
||||
{
|
||||
isSelectionMode = !isSelectionMode;
|
||||
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>
|
||||
private async Task ToggleHiddenElementsModeAsync()
|
||||
{
|
||||
showHiddenElements = !showHiddenElements;
|
||||
if (Path is not null)
|
||||
{
|
||||
if (!Path.EndsWith(pathSeparator))
|
||||
Path += pathSeparator;
|
||||
await NavigateToPathAsync(Path, isForwardNavigation: false, isBackwardNavigation: false).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles API exceptions, presenting standard problem details in a user friendly way.
|
||||
/// </summary>
|
||||
/// <param name="ex">The exception to handle</param>
|
||||
private void HandleApiException(ApiException ex)
|
||||
{
|
||||
StringBuilder errorMessage = new StringBuilder();
|
||||
if (ex.ProblemDetails is not null)
|
||||
{
|
||||
errorMessage.AppendLine($"HTTP {ex.ProblemDetails.Status} {ex.HttpStatusCode}<br>");
|
||||
if (!string.IsNullOrEmpty(ex.ProblemDetails.Detail))
|
||||
errorMessage.AppendLine($"<b>{ex.ProblemDetails.Detail}<b>");
|
||||
if (ex.ProblemDetails.Extensions is not null && ex.ProblemDetails.Extensions.TryGetValue("errors", out var errorsObj))
|
||||
{
|
||||
if (errorsObj is JsonElement jsonElement && jsonElement.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
errorMessage.AppendLine("Validation Errors:");
|
||||
foreach (var error in jsonElement.EnumerateObject())
|
||||
{
|
||||
string fieldName = error.Name;
|
||||
if (error.Value.ValueKind == JsonValueKind.Array)
|
||||
foreach (var errorValue in error.Value.EnumerateArray())
|
||||
errorMessage.AppendLine($"- {fieldName}: {errorValue}<br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ex.ProblemDetails.Extensions is not null)
|
||||
foreach (var extension in ex.ProblemDetails.Extensions)
|
||||
if (extension.Key != "errors")
|
||||
errorMessage.AppendLine($"{extension.Key}: {extension.Value}<br>");
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage.AppendLine($"HTTP {ex.HttpStatusCode}<br>");
|
||||
errorMessage.AppendLine($"{ex.Message}<br>");
|
||||
}
|
||||
_notificationService.Show(errorMessage.ToString(), NotificationType.Error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes this component.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
reference?.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
@using Lumina.Presentation.Web.Common.Enums.FileSystem
|
||||
@using Lumina.Presentation.Web.Common.Models.FileManagement
|
||||
|
||||
<div class="tree-node">
|
||||
<span class="node-content @(IsSelected ? "selected" : string.Empty)" @onclick="HandleNodeClick">
|
||||
@if (Node.ItemType == FileSystemItemType.Directory || Node.ItemType == FileSystemItemType.Root)
|
||||
{
|
||||
<span class="expand-button @(Node.IsExpanded ? "expanded" : string.Empty)" @onclick:stopPropagation="true" @onclick="ToggleExpand"></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="spacer"></span>
|
||||
}
|
||||
<span class="node-icon">@GetNodeIcon()</span>
|
||||
<span class="node-name">@Node.Name</span>
|
||||
</span>
|
||||
@if (Node.IsExpanded && Node.Children is not null)
|
||||
{
|
||||
<div class="child-nodes">
|
||||
@foreach (var childNode in Node.Children)
|
||||
{
|
||||
<FileSystemTreeViewNode Node="childNode" OnExpandToggle="OnExpandToggle" OnNodeSelected="OnNodeSelected" SelectedNodePath="@SelectedNodePath" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public FileSystemTreeNodeModel Node { get; set; } = null!;
|
||||
[Parameter] public EventCallback<FileSystemTreeNodeModel> OnExpandToggle { get; set; }
|
||||
[Parameter] public EventCallback<string> OnNodeSelected { get; set; }
|
||||
[Parameter] public string? SelectedNodePath { get; set; }
|
||||
|
||||
private bool IsSelected => Node.Path == SelectedNodePath;
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the expanded state of the node.
|
||||
/// </summary>
|
||||
private async Task ToggleExpand()
|
||||
{
|
||||
await OnExpandToggle.InvokeAsync(Node).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the click event on the node.
|
||||
/// </summary>
|
||||
private async Task HandleNodeClick()
|
||||
{
|
||||
await OnNodeSelected.InvokeAsync(Node.Path).ConfigureAwait(false);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the icon of the node, based on it type.
|
||||
/// </summary>
|
||||
/// <returns>The icon on the node</returns>
|
||||
private string GetNodeIcon()
|
||||
{
|
||||
return Node.ItemType switch
|
||||
{
|
||||
FileSystemItemType.Root => "💿",
|
||||
FileSystemItemType.Directory => Node.IsExpanded ? "📂" : "📁",
|
||||
FileSystemItemType.File => "📄",
|
||||
_ => "❓"
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
@using Lumina.Presentation.Web.Common.Enums.Notifications
|
||||
@using Lumina.Presentation.Web.Common.Models.Common
|
||||
@using Lumina.Presentation.Web.Common.Services
|
||||
|
||||
@inject INotificationService NotificationService
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
<div class="notification-container">
|
||||
@foreach (var notification in _notifications)
|
||||
{
|
||||
<div class="notification @GetNotificationClass(notification.Type)" @key="notification.Id">
|
||||
<div class="shine-effect"></div>
|
||||
<div class="notification-body">
|
||||
<span class="notification-message">@((MarkupString)notification.Message)</span>
|
||||
<button class="close-button" @onclick="() => RemoveNotification(notification.Id)">×</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private List<NotificationModel> _notifications = [];
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component.
|
||||
/// </summary>
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
NotificationService.OnNotification += AddNotification;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a notification to the list of notifications and updates the UI.
|
||||
/// </summary>
|
||||
/// <param name="notification">The notification to be added.</param>
|
||||
private void AddNotification(NotificationModel notification)
|
||||
{
|
||||
string logMessage = $"{notification.Type}: {notification.Message}";
|
||||
|
||||
if (notification.Type == NotificationType.Error)
|
||||
Console.WriteLine($"Error: {notification.Message}");
|
||||
else if (notification.Type == NotificationType.Warning)
|
||||
Console.WriteLine($"Warning: {notification.Message}");
|
||||
else if (notification.Type == NotificationType.Info)
|
||||
Console.WriteLine($"Info: {notification.Message}");
|
||||
else if (notification.Type == NotificationType.Success)
|
||||
Console.WriteLine($"Success: {notification.Message}");
|
||||
_notifications.Add(notification);
|
||||
InvokeAsync(StateHasChanged);
|
||||
_ = RemoveNotificationAfterDelay(notification.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a notification from the list of notifications after a delay of 5 seconds.
|
||||
/// </summary>
|
||||
/// <param name="id">The Id of the notification to be removed.</param>
|
||||
private async Task RemoveNotificationAfterDelay(Guid id)
|
||||
{
|
||||
await Task.Delay(5000); // 5 seconds delay
|
||||
RemoveNotification(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a notification from the list of notifications and updates the UI.
|
||||
/// </summary>
|
||||
/// <param name="id">The Id of the notification to be removed.</param>
|
||||
private void RemoveNotification(Guid id)
|
||||
{
|
||||
_notifications.RemoveAll(notification => notification.Id == id);
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the CSS class for a notification based on its type.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the notification.</param>
|
||||
/// <returns>The CSS class for the notification.</returns>
|
||||
private string GetNotificationClass(NotificationType type) => type switch
|
||||
{
|
||||
NotificationType.Info => "info",
|
||||
NotificationType.Success => "success",
|
||||
NotificationType.Warning => "warning",
|
||||
NotificationType.Error => "error",
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the component.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
NotificationService.OnNotification -= AddNotification;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Controllers.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Controller for managing file system directories.
|
||||
/// </summary>
|
||||
[Route("[controller]")]
|
||||
public class DirectoriesController : Controller
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DirectoriesController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
|
||||
public DirectoriesController(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the directories of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the directories.</param>
|
||||
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-directories")]
|
||||
public async IAsyncEnumerable<DirectoryModel?> GetDirectories([FromQuery] string path, [FromQuery] bool includeHiddenElements, [EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
IAsyncEnumerable<DirectoryModel?> response = _apiHttpClient.GetAsyncEnumerable<DirectoryModel>(
|
||||
$"directories/get-directories?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken: cancellationToken);
|
||||
await foreach (DirectoryModel? directory in response)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
yield return directory;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directories of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the directories.</param>
|
||||
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-tree-directories")]
|
||||
public async IAsyncEnumerable<FileSystemTreeNodeModel?> GetTreeDirectories([FromQuery] string path, [FromQuery] bool includeHiddenElements, [EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
IAsyncEnumerable<FileSystemTreeNodeModel?> response = _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>(
|
||||
$"directories/get-tree-directories?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken: cancellationToken);
|
||||
await foreach (FileSystemTreeNodeModel? directory in response)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
yield return directory;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tree of expanded directories leading up to <paramref name="path"/>, with the additional list of drives, and children of the last child directory.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the directory tree.</param>
|
||||
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-directory-tree")]
|
||||
public async Task<IActionResult> GetDirectoryTree([FromQuery] string path, [FromQuery] bool includeFiles, [FromQuery] bool includeHiddenElements, CancellationToken cancellationToken)
|
||||
{
|
||||
FileSystemTreeNodeModel[] response = await _apiHttpClient.GetAsync<FileSystemTreeNodeModel[]>($"directories/get-directory-tree?path={Uri.EscapeDataString(path)}&includeFiles={includeFiles}&includeHiddenElements={includeHiddenElements}", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { tree = response } });
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Controllers.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Controller for managing file system drives.
|
||||
/// </summary>
|
||||
[Route("[controller]")]
|
||||
public class DrivesController : Controller
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DrivesController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
|
||||
public DrivesController(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Controller action for getting the list of all file system drives.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-drives")]
|
||||
public async Task<IActionResult> GetDrives(CancellationToken cancellationToken)
|
||||
{
|
||||
FileSystemTreeNodeModel[] response = await _apiHttpClient.GetAsync<FileSystemTreeNodeModel[]>($"drives/get-drives", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { drives = response } });
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Controllers.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Controller for managing file systems.
|
||||
/// </summary>
|
||||
[Route("/file-system")]
|
||||
public class FileSystemController : Controller
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileSystemController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
|
||||
public FileSystemController(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the type of the file system.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-type")]
|
||||
public async Task<IActionResult> GetType(CancellationToken cancellationToken)
|
||||
{
|
||||
FileSystemTypeModel response = await _apiHttpClient.GetAsync<FileSystemTypeModel>($"file-system/get-type", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { platformType = response.PlatformType.ToString() } });
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Controllers.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Controller for managing file system files.
|
||||
/// </summary>
|
||||
[Route("[controller]")]
|
||||
public class FilesController : Controller
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FilesController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
|
||||
public FilesController(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the files of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the files.</param>
|
||||
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-tree-files")]
|
||||
public async IAsyncEnumerable<FileSystemTreeNodeModel?> GetTreeFiles([FromQuery] string path, [FromQuery] bool includeHiddenElements, [EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
IAsyncEnumerable<FileSystemTreeNodeModel?> response = _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>(
|
||||
$"files/get-tree-files?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken: cancellationToken);
|
||||
await foreach (FileSystemTreeNodeModel? file in response)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
yield return file;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the files of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the files.</param>
|
||||
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-files")]
|
||||
public async IAsyncEnumerable<FileModel?> GetFiles([FromQuery] string path, [FromQuery] bool includeHiddenElements, [EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
IAsyncEnumerable<FileModel?> response = _apiHttpClient.GetAsyncEnumerable<FileModel>(
|
||||
$"files/get-files?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken: cancellationToken);
|
||||
await foreach (FileModel? file in response)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
yield return file;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Controllers.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Controller for managing file system paths.
|
||||
/// </summary>
|
||||
[Route("[controller]")]
|
||||
public class PathController : Controller
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PathController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
|
||||
public PathController(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the root of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the root.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-path-root")]
|
||||
public async Task<IActionResult> GetPathRoot([FromQuery] string path, CancellationToken cancellationToken)
|
||||
{
|
||||
PathSegmentModel response = await _apiHttpClient.GetAsync<PathSegmentModel>($"path/get-path-root?path={Uri.EscapeDataString(path)}", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { root = response } });
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
PathSeparatorModel response = await _apiHttpClient.GetAsync<PathSeparatorModel>($"path/get-path-separator", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { pathSeparator = response.Separator } });
|
||||
}
|
||||
|
||||
/// <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] string path, CancellationToken cancellationToken)
|
||||
{
|
||||
PathSegmentModel[] response = await _apiHttpClient.GetAsync<PathSegmentModel[]>($"path/get-path-parent?path={Uri.EscapeDataString(path)}", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { pathSegments = response } });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path components of <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to get the path segments.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("split")]
|
||||
public async Task<IActionResult> SplitPath([FromQuery] string path, CancellationToken cancellationToken)
|
||||
{
|
||||
PathSegmentModel[] response = await _apiHttpClient.GetAsync<PathSegmentModel[]>($"path/split?path={Uri.EscapeDataString(path)}", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { pathSegments = response } });
|
||||
}
|
||||
|
||||
/// <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] string path, CancellationToken cancellationToken)
|
||||
{
|
||||
PathValidModel response = await _apiHttpClient.GetAsync<PathValidModel>($"path/validate?path={Uri.EscapeDataString(path)}", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { isValid = response.IsValid } });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether <paramref name="path"/> exists or not.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to be checked.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("check-path-exists")]
|
||||
public async Task<IActionResult> CheckPathExists([FromQuery] string path, CancellationToken cancellationToken)
|
||||
{
|
||||
PathExistsModel response = await _apiHttpClient.GetAsync<PathExistsModel>($"path/check-path-exists?path={Uri.EscapeDataString(path)}", cancellationToken: cancellationToken);
|
||||
return Json(new { success = true, data = new { exists = response.Exists } });
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Lumina.Presentation.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Lumina.Presentation.Web.Controllers;
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
@using Lumina.Presentation.Web.Components
|
||||
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<div id="page">
|
||||
<NavMenu />
|
||||
<main>
|
||||
<article>
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
<Notifications />
|
||||
Whitespace-only changes.
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -6,21 +6,19 @@
|
||||
<BaseOutputPath>$(SolutionDir)..\bin\client\</BaseOutputPath>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyInfo_Shared.cs" Link="Properties\AssemblyInfo_Shared.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="11.9.2" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.7" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
<PackageReference Include="Polly" Version="8.4.1" />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyInfo_Shared.cs" Link="Properties\AssemblyInfo_Shared.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="11.9.2" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
<PackageReference Include="Polly" Version="8.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--disable warnings generated by Mediator source generator-->
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Lumina.Presentation.Web.Models;
|
||||
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
@page "/"
|
||||
|
||||
@using Lumina.Presentation.Web.Components
|
||||
|
||||
<PageTitle>Lumina - Home</PageTitle>
|
||||
|
||||
<FileSystemBrowser IncludeFiles="false" Path="C:\"/>
|
||||
@@ -1,90 +0,0 @@
|
||||
@page "/library/manage"
|
||||
|
||||
<h3 class="text-light-two f-22 mb-10 mt-0 pt-10 text-center">Manage Libraries</h3>
|
||||
|
||||
<div class="enlightenment-panel shadow-effect pl-0 pr-0 pb-0 mx-auto panel mt-10" style="width: 350px; min-width: 350px;">
|
||||
<div class="shine-effect"></div>
|
||||
<div class="available-file-system-card">
|
||||
<div class="available-file-system-button text-center close-data-source" style="color: #FF0000; top: 0px; right: 10px;">×</div>
|
||||
</div>
|
||||
<table class="w-90 mx-auto" data-unique-id="dataSource.EnvironmentId">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p class="text-light-one f-18 mt-0 mb-5 text-center">LocalFileSystem</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Title -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<input type="hidden" name="type" value="local">
|
||||
<label class="text-light-one">Title</label>
|
||||
<input type="text" class="w-100 enlightenment-input" name="title" value="dataSource.Title">
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionTitle</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section URL -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">URL</label>
|
||||
<input type="url" class="w-100 enlightenment-input" name="url" placeholder="example.com" value="dataSource.Url">
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionURL</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Port -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Port</label>
|
||||
<input type="number" class="w-100 enlightenment-input" name="port" value="dataSource.Port">
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionPort</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Username -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Username</label>
|
||||
<input type="text" class="w-100 enlightenment-input" name="username" autocomplete="on" value="dataSource.Username">
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionUsername</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Password -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Password</label>
|
||||
<input type="password" class="w-100 enlightenment-input" name="password" value="dataSource.Password">
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionPassword</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Platform</label>
|
||||
<div class="enlightenment-combobox inline-block w-100">
|
||||
<div class="shine-effect" style="top: 1px;"></div>
|
||||
<input type="checkbox" class="enlightenment-toggle-checkbox" />
|
||||
<label class="enlightenment-toggle">
|
||||
<span class="enlightenment-selected-text">dataSource.PlatformType</span>
|
||||
</label>
|
||||
<div class="enlightenment-dropdown">
|
||||
<div class="shine-effect" style="top: -4px;"></div>
|
||||
<div class="enlightenment-option first-option" data-value="Unix">Unix</div>
|
||||
<div class="enlightenment-option last-option" data-value="Windows">Windows</div>
|
||||
</div>
|
||||
</div>
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionPlatform</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="w-100 text-center">
|
||||
<button type="submit" class="confirm-button f-16 w-100px">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<span class="invalid-feedback hidden"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
@page "/library/manage/item"
|
||||
@page "/library/manage/item/{id:guid}"
|
||||
|
||||
@using Lumina.Presentation.Web.Common.Enums.AudioLibrary
|
||||
@using Lumina.Presentation.Web.Common.Enums.BookLibrary
|
||||
@using Lumina.Presentation.Web.Common.Enums.Library
|
||||
@using Lumina.Presentation.Web.Common.Enums.PhotoLibrary
|
||||
@using Lumina.Presentation.Web.Common.Enums.VideoLibrary
|
||||
@using Lumina.Presentation.Web.Common.Models.Libraries
|
||||
@using Lumina.Presentation.Web.Common.Models.UI
|
||||
@using Lumina.Presentation.Web.Common.Utilities
|
||||
@using Lumina.Presentation.Web.Components
|
||||
|
||||
<h3 class="text-light-two f-22 mb-10 mt-0 pt-10 text-center">@(Id is null ? "Add New Library" : "Edit Library")</h3>
|
||||
|
||||
<div class="enlightenment-panel shadow-effect pl-0 pr-0 pb-0 mx-auto panel mt-10" style="width: 350px; min-width: 350px;">
|
||||
<div class="shine-effect"></div>
|
||||
<table class="w-90 mx-auto">
|
||||
<!-- section Title -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Title</label>
|
||||
<EnlightenmentInput Type="text" Name="title" AutoComplete="true" @bind-Value="dataSource.Title" />
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionTitle</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Library Type -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Library Type</label>
|
||||
<EnlightenmentCombobox Items="@items" @bind-SelectedItem="selectedValue" />
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionLibraryType</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Directories -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Directories</label>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Column 1</th>
|
||||
<th>Column 2</th>
|
||||
<th>Directories</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in tableData)
|
||||
{
|
||||
<tr>
|
||||
<td>@item.Column1</td>
|
||||
<td>@item.Column2</td>
|
||||
<td>
|
||||
@* <MultiDirectorySelector /> *@
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionURL</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Port -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Port</label>
|
||||
<EnlightenmentInput Type="number" Name="port" AutoComplete="true" @bind-Value="dataSource.Title" />
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionPort</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Username -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Username</label>
|
||||
<EnlightenmentInput Type="text" Name="username" AutoComplete="true" @bind-Value="dataSource.Title" />
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionUsername</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- section Password -->
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Password</label>
|
||||
<EnlightenmentInput Type="password" Name="password" AutoComplete="true" @bind-Value="dataSource.Title" />
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionPassword</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<label class="text-light-one">Platform</label>
|
||||
<EnlightenmentCheckbox Checked="false" Label="Is Platform" />
|
||||
<small class="text-disabled" style="margin-left: 25px;">DescriptionPlatform</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="w-100 text-center">
|
||||
<EnlightenmentButton IsConfirmButton="false" OnClick="@CancelOperation" IsDisabled="@isSaving">Cancel</EnlightenmentButton>
|
||||
<EnlightenmentButton OnClick="@SaveData" IsDisabled="@isSaving">Save</EnlightenmentButton>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<span class="invalid-feedback hidden"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
private LibraryModel dataSource = new();
|
||||
|
||||
private List<ComboboxItem<string>> items = new()
|
||||
{
|
||||
new ComboboxItem<string>{ Text = nameof(LibraryType.WrittenContent).SplitCamelCase(), IsEnabled = false },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Book).SplitCamelCase(), Value = nameof(WrittenContentType.Book) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.EBook).SplitCamelCase(), Value = nameof(WrittenContentType.EBook) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.BookSeries).SplitCamelCase(), Value = nameof(WrittenContentType.BookSeries) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.ComicBook).SplitCamelCase(), Value = nameof(WrittenContentType.ComicBook) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.ComicSeries).SplitCamelCase(), Value = nameof(WrittenContentType.ComicSeries) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Magazine).SplitCamelCase(), Value = nameof(WrittenContentType.Magazine) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Manga).SplitCamelCase(), Value = nameof(WrittenContentType.Manga) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.GraphicNovel).SplitCamelCase(), Value = nameof(WrittenContentType.GraphicNovel) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.AcademicPaper).SplitCamelCase(), Value = nameof(WrittenContentType.AcademicPaper) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.SheetMusic).SplitCamelCase(), Value = nameof(WrittenContentType.SheetMusic) },
|
||||
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Screenplay).SplitCamelCase(), Value = nameof(WrittenContentType.Screenplay) },
|
||||
new ComboboxItem<string>{ Text = nameof(LibraryType.VideoContent).SplitCamelCase(), IsEnabled = false },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.TvShow).SplitCamelCase(), Value = nameof(VideoContentType.TvShow) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Movie).SplitCamelCase(), Value = nameof(VideoContentType.Movie) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.FilmSeries).SplitCamelCase(), Value = nameof(VideoContentType.FilmSeries) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.FilmFranchise).SplitCamelCase(), Value = nameof(VideoContentType.FilmFranchise) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Concert).SplitCamelCase(), Value = nameof(VideoContentType.Concert) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Documentary).SplitCamelCase(), Value = nameof(VideoContentType.Documentary) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Tutorial).SplitCamelCase(), Value = nameof(VideoContentType.Tutorial) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Personal).SplitCamelCase(), Value = nameof(VideoContentType.Personal) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Anime).SplitCamelCase(), Value = nameof(VideoContentType.Anime) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Youtube).SplitCamelCase(), Value = nameof(VideoContentType.Youtube) },
|
||||
new ComboboxItem<string>{ Text = nameof(VideoContentType.Videoclip).SplitCamelCase(), Value = nameof(VideoContentType.Videoclip) },
|
||||
new ComboboxItem<string>{ Text = nameof(LibraryType.AudioContent).SplitCamelCase(), IsEnabled = false },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.Music).SplitCamelCase(), Value = nameof(AudioContentType.Music) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.AudioBook).SplitCamelCase(), Value = nameof(AudioContentType.AudioBook) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.LivePerformance).SplitCamelCase(), Value = nameof(AudioContentType.LivePerformance) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.Interview).SplitCamelCase(), Value = nameof(AudioContentType.Interview) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.Cover).SplitCamelCase(), Value = nameof(AudioContentType.Cover) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.Remix).SplitCamelCase(), Value = nameof(AudioContentType.Remix) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.Soundeffect).SplitCamelCase(), Value = nameof(AudioContentType.Soundeffect) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.Podcast).SplitCamelCase(), Value = nameof(AudioContentType.Podcast) },
|
||||
new ComboboxItem<string>{ Text = nameof(AudioContentType.RadioShow).SplitCamelCase(), Value = nameof(AudioContentType.RadioShow) },
|
||||
new ComboboxItem<string>{ Text = nameof(LibraryType.VisualContent).SplitCamelCase(), IsEnabled = false },
|
||||
new ComboboxItem<string>{ Text = nameof(VisualContentType.PhotoAlbum).SplitCamelCase(), Value = nameof(VisualContentType.PhotoAlbum) },
|
||||
new ComboboxItem<string>{ Text = nameof(LibraryType.MiscellaneousContent).SplitCamelCase(), IsEnabled = false },
|
||||
new ComboboxItem<string>{ Text = nameof(MiscellaneousContentType.Other).SplitCamelCase(), Value = nameof(MiscellaneousContentType.Other) },
|
||||
};
|
||||
|
||||
private ComboboxItem<string>? selectedValue;
|
||||
private ComboboxItem<string>? selectedValue2;
|
||||
|
||||
private bool isSaving = false;
|
||||
private bool isCancelling = false;
|
||||
|
||||
private async Task SaveData()
|
||||
{
|
||||
isSaving = true;
|
||||
// Perform save operation
|
||||
isSaving = false;
|
||||
Console.WriteLine("saved");
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task CancelOperation()
|
||||
{
|
||||
isCancelling = true;
|
||||
// Perform cancel operation
|
||||
if (!isCancelling)
|
||||
isCancelling = false;
|
||||
selectedValue2 = new ComboboxItem<string>();
|
||||
if (selectedValue2 is not null)
|
||||
Console.WriteLine("cancelled");
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private List<TableItem> tableData = new List<TableItem>
|
||||
{
|
||||
new TableItem { Column1 = "Value 1", Column2 = "Value 2", Directories = new List<string>() },
|
||||
new TableItem { Column1 = "Value 3", Column2 = "Value 4", Directories = new List<string>() }
|
||||
};
|
||||
|
||||
public class TableItem
|
||||
{
|
||||
public string? Column1 { get; set; }
|
||||
public string? Column2 { get; set; }
|
||||
public List<string>? Directories { get; set; }
|
||||
}
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
@page "/library/written-content/books-library/books"
|
||||
|
||||
<h3>Books</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
-146
@@ -1,146 +0,0 @@
|
||||
@page "/library/written-content-library/books-library/books/item/{id:guid}"
|
||||
|
||||
@using Lumina.Presentation.Web.Common.Enums.BookLibrary
|
||||
@using Lumina.Presentation.Web.Common.Models.Common
|
||||
@using Lumina.Presentation.Web.Common.Models.MediaContributors
|
||||
@using Lumina.Presentation.Web.Common.Models.WrittenContentLibrary
|
||||
@using Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary
|
||||
@using Lumina.Presentation.Web.Common.Requests.WrittenContentLibrary.BookLibrary
|
||||
|
||||
@inject HttpClient _httpClient
|
||||
|
||||
<h1>@(Id.HasValue ? "Edit" : "Add") Book</h1>
|
||||
|
||||
<EditForm Model="@bookRequest" OnValidSubmit="@HandleValidSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Title<span class="mandatory-field">*</span>:</label>
|
||||
<InputText id="title" @bind-Value="bookRequest.Metadata!.Title" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="originalTitle">Original Title:</label>
|
||||
<InputText id="originalTitle" @bind-Value="bookRequest.Metadata.OriginalTitle" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Description:</label>
|
||||
<InputTextArea id="description" @bind-Value="bookRequest.Metadata.Description" class="form-control" />
|
||||
</div>
|
||||
|
||||
<h3>Release Information</h3>
|
||||
<div class="form-group">
|
||||
<label for="originalReleaseDate">Original Release Date:</label>
|
||||
<InputDate id="originalReleaseDate" @bind-Value="bookRequest.Metadata.ReleaseInfo!.OriginalReleaseDate" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="releaseCountry">Release Country:</label>
|
||||
<InputText id="releaseCountry" @bind-Value="bookRequest.Metadata.ReleaseInfo.ReleaseCountry" class="form-control" />
|
||||
</div>
|
||||
|
||||
<h3>Genres</h3>
|
||||
@foreach (var genre in bookRequest.Metadata.Genres!)
|
||||
{
|
||||
<div class="form-group">
|
||||
<InputText @bind-Value="genre.Name" class="form-control" />
|
||||
</div>
|
||||
}
|
||||
<button type="button" class="btn btn-secondary" @onclick="AddGenre">Add Genre</button>
|
||||
|
||||
<h3>Language</h3>
|
||||
<div class="form-group">
|
||||
<label for="languageCode">Language Code:</label>
|
||||
<InputText id="languageCode" @bind-Value="bookRequest.Metadata.Language!.LanguageCode" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="languageName">Language Name:</label>
|
||||
<InputText id="languageName" @bind-Value="bookRequest.Metadata.Language.LanguageName" class="form-control" />
|
||||
</div>
|
||||
|
||||
<h3>Book Details</h3>
|
||||
<div class="form-group">
|
||||
<label for="format">Format:</label>
|
||||
<InputSelect id="format" @bind-Value="bookRequest.Format" class="form-control">
|
||||
@foreach (var format in Enum.GetValues(typeof(BookFormat)))
|
||||
{
|
||||
<option value="@format">@format</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="edition">Edition:</label>
|
||||
<InputText id="edition" @bind-Value="bookRequest.Edition" class="form-control" />
|
||||
</div>
|
||||
|
||||
<h3>Identifiers</h3>
|
||||
<div class="form-group">
|
||||
<label for="isbn">ISBN:</label>
|
||||
<InputText id="isbn" @bind-Value="bookRequest.ISBNs![0].Value" class="form-control" />
|
||||
<InputSelect @bind-Value="bookRequest.ISBNs[0].Format" class="form-control">
|
||||
@foreach (var format in Enum.GetValues(typeof(IsbnFormat)))
|
||||
{
|
||||
<option value="@format">@format</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
|
||||
<h3>Contributors</h3>
|
||||
@foreach (var contributor in bookRequest.Contributors!)
|
||||
{
|
||||
<div class="form-group">
|
||||
@* <InputText @bind-Value="contributor.Name" placeholder="Name" class="form-control" /> *@
|
||||
<InputText @bind-Value="contributor.Role!.Name" placeholder="Role" class="form-control" />
|
||||
</div>
|
||||
}
|
||||
<button type="button" class="btn btn-secondary" @onclick="AddContributor">Add Contributor</button>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
private AddBookRequest bookRequest = new AddBookRequest
|
||||
{
|
||||
Metadata = new WrittenContentMetadataModel
|
||||
{
|
||||
ReleaseInfo = new ReleaseInfoModel(),
|
||||
Genres = new List<GenreModel>(),
|
||||
Language = new LanguageInfoModel()
|
||||
},
|
||||
ISBNs = new List<IsbnModel> { new IsbnModel() },
|
||||
Contributors = new List<MediaContributorModel>()
|
||||
};
|
||||
|
||||
private void AddGenre()
|
||||
{
|
||||
bookRequest.Metadata!.Genres!.Add(new GenreModel());
|
||||
}
|
||||
|
||||
private void AddContributor()
|
||||
{
|
||||
bookRequest.Contributors!.Add(new MediaContributorModel { Role = new MediaContributorRoleModel() });
|
||||
}
|
||||
|
||||
private async Task HandleValidSubmit()
|
||||
{
|
||||
// Send the bookRequest to your API
|
||||
var response = await _httpClient.PostAsJsonAsync("api/books", bookRequest).ConfigureAwait(false);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
// Handle successful submission
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public Guid? Id { get; set; }
|
||||
}
|
||||
@@ -1,37 +1,52 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web;
|
||||
|
||||
/// <summary>
|
||||
/// Application entry point, contains the composition root module, wires up all dependencies of the application.
|
||||
/// </summary>
|
||||
public class Program
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Application entry point.
|
||||
/// </summary>
|
||||
/// <param name="args">Optional command line arguments.</param>
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
builder.AddConfiguration();
|
||||
builder.Services.AddPresentationWebLayerServices();
|
||||
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
|
||||
WebAssemblyHost webAssemblyHost = builder.Build();
|
||||
|
||||
await webAssemblyHost.RunAsync().ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web;
|
||||
|
||||
/// <summary>
|
||||
/// Application entry point, contains the composition root module, wires up all dependencies of the application.
|
||||
/// </summary>
|
||||
public class Program
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Application entry point.
|
||||
/// </summary>
|
||||
/// <param name="args">Optional command line arguments.</param>
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.BindConfiguration(builder.Configuration);
|
||||
builder.Services.AddPresentationWebLayerServices();
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
// configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
//app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
await app.RunAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -16,4 +16,4 @@ using System.Runtime.InteropServices;
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4E3EEA67-7C92-4588-9183-03140627D564")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Lumina.Presentation.Web.UnitTests")]
|
||||
[assembly: InternalsVisibleTo("Lumina.Presentation.Web.UnitTests")]
|
||||
@@ -1,25 +1,23 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
//"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"applicationUrl": "http://localhost:5012",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
//"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"applicationUrl": "https://localhost:7112;http://localhost:5012",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
//"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5012",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
//"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5012;https://localhost:7112",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
using Lumina.Presentation.Web.Common.Models.Configuration;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.ViewComponents;
|
||||
|
||||
/// <summary>
|
||||
/// View component for the file system browser.
|
||||
/// </summary>
|
||||
public class FileSystemBrowserViewComponent : ViewComponent
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly ServerConfigurationModel _serverConfigurationModel;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileSystemBrowserViewComponent"/> class.
|
||||
/// </summary>
|
||||
/// <param name="serverConfigurationModelOptions">Injected service for retrieving <see cref="ServerConfigurationModel"/>.</param>
|
||||
public FileSystemBrowserViewComponent(IOptions<ServerConfigurationModel> serverConfigurationModelOptions)
|
||||
{
|
||||
_serverConfigurationModel = serverConfigurationModelOptions.Value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="FileSystemBrowser"/> view component.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// An <see cref="IViewComponentResult"/> that renders the view with file system browsing configuration.
|
||||
/// </returns>
|
||||
public IViewComponentResult Invoke()
|
||||
{
|
||||
return View(new
|
||||
{
|
||||
Path = @"C:\",
|
||||
ServerBasePath = $"{_serverConfigurationModel.BaseAddress}:{_serverConfigurationModel.Port}/api/v{_serverConfigurationModel.ApiVersion}/",
|
||||
ClientBasePath = "http://localhost:5012/", // TODO: take from appsettings or environment
|
||||
ViewMode = FileSystemViewMode.List,
|
||||
IconSize = FileSystemIconSize.Large
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
@await Component.InvokeAsync("FileSystemBrowser")
|
||||
@@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
||||
@@ -0,0 +1,537 @@
|
||||
@using Lumina.Presentation.Web.Common.Models.Common
|
||||
@using Lumina.Presentation.Web.Common.Api
|
||||
@using Lumina.Presentation.Web.Common.Enums.FileSystem
|
||||
@using Lumina.Presentation.Web.Common.Enums.Notifications
|
||||
@using Lumina.Presentation.Web.Common.Exceptions
|
||||
@using Lumina.Presentation.Web.Common.Models.FileManagement
|
||||
@using Lumina.Presentation.Web.Common.Models.UI
|
||||
@using Lumina.Presentation.Web.Common.Services
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using System.Text.Json
|
||||
@using System.Text
|
||||
|
||||
@inject IApiHttpClient _apiHttpClient
|
||||
@inject INotificationService _notificationService
|
||||
|
||||
<div id="file-system-browser-dialog" class="container-background above-modal">
|
||||
<div id="file-system-browser-content">
|
||||
<div id="file-system-browser-header">
|
||||
<div id="file-system-browser-shine-spark"></div>
|
||||
<div id="file-system-browser-shine-effect"></div>
|
||||
<div id="file-system-browser-header-navigation-container">
|
||||
<!--File System Navigator-->
|
||||
<div id="navigator-view-mode-container">
|
||||
<!--List View Mode-->
|
||||
<svg id="navigator-list-view" 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>List 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="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M3,5 h8 v8 h-8 z M11,9 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M5,7 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M3,13 h8 v8 h-8 z M11,17 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M5,15 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M3,21 h8 v8 h-8 z M11,25 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M5,23 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M20,5 h8 v8 h-8 z M28,9 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M22,7 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M20,13 h8 v8 h-8 z M28,17 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M22,15 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M20,21 h8 v8 h-8 z M28,25 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M22,23 h4 v4 h-4 z" />
|
||||
</g>
|
||||
</svg>
|
||||
<!--Details View Mode-->
|
||||
<svg id="navigator-details-view" 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>Details 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="stroke:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M3,5 h8 v8 h-8 z M11,9 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M5,7 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M3,13 h8 v8 h-8 z M11,17 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M5,15 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M3,21 h8 v8 h-8 z M11,25 h4" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M5,23 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M17.5,8.5 h5 v1 h-5 z" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M17.5,16.5 h5 v1 h-5 z" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M17.5,24.5 h5 v1 h-5 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M25,8.5 h5 v1 h-5 z" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M25,16.5 h5 v1 h-5 z" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M25,24.5 h5 v1 h-5 z" />
|
||||
</g>
|
||||
</svg>
|
||||
<!--Small Icons View Mode-->
|
||||
<svg id="navigator-small-icons-view" 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>Small Icons 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="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M4,5 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M6,7 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M4,13 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M6,15 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M4,21 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M6,23 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M12,5 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M14,7 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M12,13 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M14,15 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M12,21 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M14,23 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M20,5 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M22,7 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M20,13 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M22,15 h4 v4 h-4 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M20,21 h8 v8 h-8 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M22,23 h4 v4 h-4 z" />
|
||||
</g>
|
||||
</svg>
|
||||
<!--Medium Icons View Mode-->
|
||||
<svg id="navigator-medium-icons-view" 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>Medium Icons 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="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M4,5 h12 v12 h-12 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M6,7 h8 v8 h-8 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M4,17 h12 v12 h-12 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M6,19 h8 v8 h-8 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M16,5 h12 v12 h-12 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M18,7 h8 v8 h-8 z" />
|
||||
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M16,17 h12 v12 h-12 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M18,19 h8 v8 h-8 z" />
|
||||
</g>
|
||||
</svg>
|
||||
<!--Large Icons View Mode-->
|
||||
<svg id="navigator-large-icons-view" 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>Large Icons 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="stroke:currentColor;" class="navigator-icon-fill large-icons" filter="url(#glow)" d="M4,5 h24 v24 h-24 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill large-icons" filter="url(#glow)" d="M6,7 h20 v20 h-20 z" />
|
||||
</g>
|
||||
</svg>
|
||||
<!--Extra Large Icons View Mode-->
|
||||
<svg id="navigator-extra-large-icons-view" 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>Extra Large Icons 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="stroke:currentColor;" class="navigator-icon-fill extra-large-icons" filter="url(#glow)" d="M4,5 h24 v24 h-24 z" fill="none" stroke-width="1" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill extra-large-icons" filter="url(#glow)" d="M11,12 L16,17 L21,12 L26,17 V7 H6 V17 Z" fill="none" stroke-width="1" />
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div id="navigator-navigation-controls-container">
|
||||
<!--Navigation-->
|
||||
<div id="navigator-history">
|
||||
<img src="images/ui/back.svg" id="navigator-navigate-back" class="navigation-icon" alt="Back" title="Back" />
|
||||
<img src="images/ui/forward.svg" id="navigator-navigate-forward" class="navigation-icon" alt="Forward" title="Forward" />
|
||||
<img src="images/ui/up.svg" id="navigator-navigate-up" class="navigation-icon" alt="Up One Level" title="Up One Level" />
|
||||
</div>
|
||||
<!--Toggle Tree View-->
|
||||
<svg 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 tree-view" 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>
|
||||
<!--Toggle Thumbnails-->
|
||||
<svg id="navigator-toggle-thumbnails-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 Thumbanils</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(3,2.5) scale(0.32)">
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill" filter="url(#glow)" 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 " />
|
||||
</g>
|
||||
</svg>
|
||||
<!--Toggle Hidden Elements-->
|
||||
<svg 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 Items</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(5,5) scale(0.85)">
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill hidden-elements" filter="url(#glow)" 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" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill hidden-elements" filter="url(#glow)" 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 15.9261Z" />
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill hidden-elements" filter="url(#glow)" 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" />
|
||||
</g>
|
||||
</svg>
|
||||
<!--Toggle Selection Mode-->
|
||||
<svg id="navigator-toggle-selection-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 Selection Mode</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="linearGradient1" 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(8,8) scale(0.030)">
|
||||
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill selection-mode" filter="url(#glow)" d="M161.9,21.9v21.9h131.2V0H161.9v43.7V21.9v21.9h131.2V0H161.9v43.7V21.9z M406.6,425.9L393,408.7l-52.4,41.6l-79.4-102.1 l-53,61.8l-38.9-217.9l198.1,99.1l-78.6,26.2l100.9,122.4L406.6,425.9L393,408.7L406.6,425.9l16.9-13.9l-60.4-73.2l118.3-39.4 L110.8,114l70.4,394.5l78.2-91.2l73.7,94.7l104.5-82.9l-14.2-17.2L406.6,425.9z M424.3,87.5V0h-87.5v43.7l43.7,0l0,43.7H424.3 L424.3,87.5z M118.1,0H30.7v87.5h43.7l0-43.7l43.7,0V0L118.1,0z M30.7,306.2v87.5h87.5v-43.7l-43.7,0l0-43.7H30.7z M402.5,131.2 h-21.9v87.5h43.7v-87.5h-43.7H402.5h-21.9v87.5h43.7v-87.5h-43.7H402.5z M52.5,262.4h21.9V131.2H30.7v131.2h43.7H52.5h21.9V131.2 H30.7v131.2h43.7H52.5z" />
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<!--Navigator-->
|
||||
<div id="navigator-address-bar-container">
|
||||
<div id="navigator-address-bar-group">
|
||||
<input type="text" class="enlightenment-input navigator-address-bar-input" Name="navigator-address-bar-input" autocomplete="on" id="navigator-address-bar-input" />
|
||||
<div id="navigator-address-bar">
|
||||
<ul id="navigator-path-segments">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<button id="navigator-edit-path-button" class="navigator-edit-path-button abort-button f-16" style="height:28px; width:35px;">
|
||||
<img src="images/ui/edit.svg" id="navigator-edit-icon" alt="Edit Path" title="Edit Path" />
|
||||
</button>
|
||||
<button id="navigator-navigate-button" class="navigator-navigate-button confirm-button f-16" style="height:28px; width:35px;">
|
||||
<img src="images/ui/check.svg" id="navigator-navigate-icon" alt="Navigate" title="Navigate" />
|
||||
</button>
|
||||
<button class="file-system-browser-content-new-directory abort-button f-16" style="height:28px; width:35px;">
|
||||
<img src="images/ui/new-directory.svg" id="navigator-new-directory-icon" alt="New Directory" title="New Directory" />
|
||||
</button>
|
||||
<button class="file-system-browser-content-favorite-directory abort-button f-16" style="height:28px; width:35px;">
|
||||
<img src="images/ui/favorite-star.svg" class="navigation-icon favorite-unselected" alt="Favorite directory" title="Favorite directory" />
|
||||
</button>
|
||||
</div>
|
||||
<!--End File System Navigator-->
|
||||
</div>
|
||||
</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">
|
||||
<div id="file-system-browser-treeview" class="treeview">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--End File System Tree View-->
|
||||
<div id="file-system-browser-file-system-directories-container">
|
||||
<div id="file-system-browser-file-system-directories">
|
||||
<div id="file-system-browser-file-system-explorer-container" class="scroll-horizontal">
|
||||
<div id="file-system-browser-file-system-explorer-details-header" style="height: 0px;">
|
||||
<span>Name</span>
|
||||
</div>
|
||||
<div id="file-system-browser-file-system-explorer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="file-system-browser-actions-container">
|
||||
<div id="file-system-browser-actions-path-container">
|
||||
<label class="text-light-one">Directory</label>
|
||||
<input type="text" id="file-system-browser-selected-element" Name="file-system-browser-selected-element" class="enlightenment-input w-100" readonly autocomplete="on" />
|
||||
</div>
|
||||
<div id="file-system-browser-actions">
|
||||
<button id="file-system-browser-cancel-button" class="abort-button w-100px">Cancel</button>
|
||||
<button id="file-system-browser-confirm-button" class="confirm-button w-100px" disabled>Open</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* <div id="divModal"></div>
|
||||
<label class="text-light-one">Enter new directory name:</label>
|
||||
<EnlightenmentInput Type="text" Name="newDirectoryName" AutoComplete="true" />
|
||||
<EnlightenmentButton IsConfirmButton="false">Cancel</EnlightenmentButton>
|
||||
<EnlightenmentButton>Confirm</EnlightenmentButton> *@
|
||||
</div>
|
||||
<div id="visible-selection-rectangle"></div>
|
||||
<div id="selection-rectangle"></div>
|
||||
<script defer src="~/js/file-system-browser-dialog.js" asp-append-version="true"></script>
|
||||
<script defer>
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
await initFileSystemBrowser(
|
||||
'@Model.ServerBasePath',
|
||||
'@Model.ClientBasePath',
|
||||
'@Model.Path.Replace(@"\", @"\\")',
|
||||
'@Model.ViewMode.ToString().ToLower()',
|
||||
'@Model.IconSize.ToString().ToLower()');
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - Lumina</title>
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/button.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/checkbox.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/combobox.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/file-system-browser.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/file-system-tree-view-node.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/navigation-menu.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/notification.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/css/textbox.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/Lumina.Presentation.Web.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<header>
|
||||
@await Html.PartialAsync("_NavMenu")
|
||||
</header>
|
||||
<main role="main">
|
||||
<article>
|
||||
@RenderBody()
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
<!--Modal grid background-->
|
||||
<div id="modal-background"></div>
|
||||
|
||||
<script defer src="~/js/notifications.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,48 @@
|
||||
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
||||
+118
-118
@@ -1,118 +1,118 @@
|
||||
<input type="checkbox" id="hamburger-input" class="burger-shower" />
|
||||
<label id="hamburger-menu" for="hamburger-input">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<nav id="mobile-menu">
|
||||
<div id="mobile-menu-content">
|
||||
<div class="mobile-menu-heading">
|
||||
Account
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="account/login"><span>Login</span></a></li>
|
||||
<li><a href="account/logout"><span>Logout</span></a></li>
|
||||
<li><a href="account/register"><span>Register</span></a></li>
|
||||
<li><a href="account"><span>My Account</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Tools
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="tools/options"><span>Options</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Library
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/manage"><span>Manage libraries</span></a></li>
|
||||
<li><a href="library/manage/item"><span>Add media library</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Written Content
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/written-content/books"><span>Books</span></a></li>
|
||||
<li><a href="library/written-content/magazines"><span>Magazines</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Audio
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/audio/music"><span>Music</span></a></li>
|
||||
<li><a href="library/audio/interviews"><span>Interviews</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Video
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/video/movies"><span>Movies</span></a></li>
|
||||
<li><a href="library/video/tvshows"><span>TV Shows</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Help
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="help/documentation"><span>Documentation</span></a></li>
|
||||
<li><a href="help/about"><span>About</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</label>
|
||||
<nav class="menubar">
|
||||
<ul>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="account-menu" name="menu">
|
||||
<label for="account-menu">Account</label>
|
||||
<ul>
|
||||
<li><a href="account/login">Login</a></li>
|
||||
<li><a href="account/logout">Logout</a></li>
|
||||
<li><a href="account/register">Register</a></li>
|
||||
<li><a href="account">My Account</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="tools-menu" name="menu">
|
||||
<label for="tools-menu">Tools</label>
|
||||
<ul>
|
||||
<li><a href="tools/options">Options</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="library-menu" name="menu">
|
||||
<label for="library-menu">Library</label>
|
||||
<ul>
|
||||
<li tabindex="0"><a href="library/manage">Manage libraries</a></li>
|
||||
<li tabindex="0"><a href="library/manage/item">Add new library</a></li>
|
||||
<li class="has-submenu" tabindex="0">
|
||||
<label>Written Content</label>
|
||||
<ul>
|
||||
<li><a href="library/written-content/books">Books</a></li>
|
||||
<li><a href="library/written-content/magazines">Magazines</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-submenu" tabindex="0">
|
||||
<label>Audio</label>
|
||||
<ul>
|
||||
<li><a href="library/audio/music">Music</a></li>
|
||||
<li><a href="library/audio/interviews">Interviews</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-submenu" tabindex="0">
|
||||
<label>Video</label>
|
||||
<ul>
|
||||
<li><a href="library/video/movies">Movies</a></li>
|
||||
<li><a href="library/video/tvshows">TV Shows</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="help-menu" name="menu">
|
||||
<label for="help-menu">Help</label>
|
||||
<ul>
|
||||
<li><a href="help/documentation">Documentation</a></li>
|
||||
<li><a href="help/about">About</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<input type="checkbox" id="hamburger-input" class="burger-shower" />
|
||||
<label id="hamburger-menu" for="hamburger-input">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<nav id="mobile-menu">
|
||||
<div id="mobile-menu-content">
|
||||
<div class="mobile-menu-heading">
|
||||
Account
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="account/login"><span>Login</span></a></li>
|
||||
<li><a href="account/logout"><span>Logout</span></a></li>
|
||||
<li><a href="account/register"><span>Register</span></a></li>
|
||||
<li><a href="account"><span>My Account</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Tools
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="tools/options"><span>Options</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Library
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/manage"><span>Manage libraries</span></a></li>
|
||||
<li><a href="library/manage/item"><span>Add media library</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Written Content
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/written-content/books"><span>Books</span></a></li>
|
||||
<li><a href="library/written-content/magazines"><span>Magazines</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Audio
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/audio/music"><span>Music</span></a></li>
|
||||
<li><a href="library/audio/interviews"><span>Interviews</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Video
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/video/movies"><span>Movies</span></a></li>
|
||||
<li><a href="library/video/tvshows"><span>TV Shows</span></a></li>
|
||||
</ul>
|
||||
<div class="mobile-menu-heading">
|
||||
Help
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="help/documentation"><span>Documentation</span></a></li>
|
||||
<li><a href="help/about"><span>About</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</label>
|
||||
<nav class="menubar">
|
||||
<ul>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="account-menu" name="menu">
|
||||
<label for="account-menu">Account</label>
|
||||
<ul>
|
||||
<li><a href="account/login">Login</a></li>
|
||||
<li><a href="account/logout">Logout</a></li>
|
||||
<li><a href="account/register">Register</a></li>
|
||||
<li><a href="account">My Account</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="tools-menu" name="menu">
|
||||
<label for="tools-menu">Tools</label>
|
||||
<ul>
|
||||
<li><a href="tools/options">Options</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="library-menu" name="menu">
|
||||
<label for="library-menu">Library</label>
|
||||
<ul>
|
||||
<li tabindex="0"><a href="library/manage">Manage libraries</a></li>
|
||||
<li tabindex="0"><a href="library/manage/item">Add new library</a></li>
|
||||
<li class="has-submenu" tabindex="0">
|
||||
<label>Written Content</label>
|
||||
<ul>
|
||||
<li><a href="library/written-content/books">Books</a></li>
|
||||
<li><a href="library/written-content/magazines">Magazines</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-submenu" tabindex="0">
|
||||
<label>Audio</label>
|
||||
<ul>
|
||||
<li><a href="library/audio/music">Music</a></li>
|
||||
<li><a href="library/audio/interviews">Interviews</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-submenu" tabindex="0">
|
||||
<label>Video</label>
|
||||
<ul>
|
||||
<li><a href="library/video/movies">Movies</a></li>
|
||||
<li><a href="library/video/tvshows">TV Shows</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li tabindex="0">
|
||||
<input type="radio" id="help-menu" name="menu">
|
||||
<label for="help-menu">Help</label>
|
||||
<ul>
|
||||
<li><a href="help/documentation">Documentation</a></li>
|
||||
<li><a href="help/about">About</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
@@ -0,0 +1,3 @@
|
||||
@using Lumina.Presentation.Web
|
||||
@using Lumina.Presentation.Web.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||
@using Microsoft.JSInterop
|
||||
@using Lumina.Presentation.Web
|
||||
@using Lumina.Presentation.Web.Layout
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ServerConfiguration": {
|
||||
"ApiVersion": 1,
|
||||
"BaseAddress": "http://localhost",
|
||||
"Port": 5214
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"ServerConfiguration": {
|
||||
"ApiVersion": 1,
|
||||
"BaseAddress": "http://localhost",
|
||||
"Port": 5214
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
#blazor-error-ui {
|
||||
background: lightyellow;
|
||||
bottom: 0;
|
||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||
display: none;
|
||||
left: 0;
|
||||
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#blazor-error-ui .dismiss {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: 0.75rem;
|
||||
top: 0.5rem;
|
||||
}
|
||||
|
||||
.blazor-error-boundary {
|
||||
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
|
||||
padding: 1rem 1rem 1rem 3.7rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.blazor-error-boundary::after {
|
||||
content: "An error has occurred."
|
||||
}
|
||||
|
||||
.loading-progress {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
margin: 20vh auto 1rem auto;
|
||||
}
|
||||
|
||||
.loading-progress circle {
|
||||
fill: none;
|
||||
stroke: #e0e0e0;
|
||||
stroke-width: 0.6rem;
|
||||
transform-origin: 50% 50%;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.loading-progress circle:last-child {
|
||||
stroke: #1b6ec2;
|
||||
stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
|
||||
transition: stroke-dasharray 0.05s ease-in-out;
|
||||
}
|
||||
|
||||
.loading-progress-text {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
|
||||
}
|
||||
|
||||
.loading-progress-text:after {
|
||||
content: var(--blazor-load-percentage-text, "Loading");
|
||||
}
|
||||
+1
-1
@@ -158,4 +158,4 @@ confirm-button[disabled] {
|
||||
|
||||
.confirm-button[disabled]:active {
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Lumina.Presentation.Web.wwwroot.css
|
||||
{
|
||||
public class checkbox
|
||||
{
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -66,8 +66,8 @@
|
||||
border-right: #202020 1px solid;
|
||||
padding: 3px;
|
||||
z-index: 999;
|
||||
max-height: none;
|
||||
overflow-y: auto;
|
||||
max-height: none;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.enlightenment-dropdown > .shine-effect:first-child {
|
||||
+26
-23
@@ -1,9 +1,10 @@
|
||||
#file-system-browser-dialog {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 12.5%;
|
||||
bottom: 12.5%;
|
||||
left: 10%;
|
||||
right: 10%;
|
||||
left: 8%;
|
||||
right: 8%;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--border-color-dialog);
|
||||
box-shadow: 30px 30px 25px var(--shadow-color);
|
||||
@@ -65,7 +66,7 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
::deep .file-system-browser-content-new-directory {
|
||||
.file-system-browser-content-new-directory {
|
||||
min-width: 35px;
|
||||
flex-basis: 35px;
|
||||
flex-shrink: 0;
|
||||
@@ -137,12 +138,12 @@
|
||||
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-container.collapsed {
|
||||
max-width: 0px;
|
||||
min-width: 0px;
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#file-system-browser-file-system-treeview {
|
||||
background-color: #131313;
|
||||
@@ -158,7 +159,7 @@
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
::deep .file-system-browser-file-system-sources {
|
||||
.file-system-browser-file-system-sources {
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
@@ -198,6 +199,7 @@
|
||||
|
||||
#file-system-browser-file-system-explorer-details-header {
|
||||
color: deepskyblue;
|
||||
background-color: #232323;
|
||||
}
|
||||
|
||||
#file-system-browser-file-system-explorer {
|
||||
@@ -247,6 +249,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
user-select: none;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.e.details-icons {
|
||||
@@ -640,7 +643,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#navigator-history, ::deep .navigator-navigate-button, ::deep .navigator-edit-path-button {
|
||||
#navigator-history, .navigator-navigate-button, .navigator-edit-path-button {
|
||||
flex-shrink: 0; /* don't let them shrink */
|
||||
}
|
||||
|
||||
@@ -675,23 +678,23 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
::deep .navigator-navigate-button, ::deep .navigator-edit-path-button {
|
||||
.navigator-navigate-button, .navigator-edit-path-button {
|
||||
text-align: end !important;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::deep .navigator-navigate-button,
|
||||
::deep .file-system-browser-content-new-directory {
|
||||
.navigator-navigate-button,
|
||||
.file-system-browser-content-new-directory {
|
||||
margin: 0px 10px 2px 0px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::deep .file-system-browser-content-favorite-directory {
|
||||
.file-system-browser-content-favorite-directory {
|
||||
margin: 0px 2px 2px 0px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::deep .navigator-edit-path-button {
|
||||
.navigator-edit-path-button {
|
||||
margin: 0px 10px 2px 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@@ -754,7 +757,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
display: flex;
|
||||
margin-right: 0px;
|
||||
align-items: center;
|
||||
width: 125px;
|
||||
width: 175px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
@@ -766,7 +769,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
}
|
||||
|
||||
|
||||
::deep .navigator-address-bar-input {
|
||||
.navigator-address-bar-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -886,7 +889,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
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 */
|
||||
max-height: calc(100vh - 12.5vh - 60px); /* subtracting a small value ensures a little space is left on top and bottom; -12.5% because parent has "top: 12.5%;" */
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@@ -1067,7 +1070,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::deep .file-system-browser-content-new-directory {
|
||||
.file-system-browser-content-new-directory {
|
||||
min-width: 0;
|
||||
flex-basis: auto;
|
||||
margin-right: 10px;
|
||||
@@ -1103,9 +1106,9 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 399px) {
|
||||
@media screen and (max-width: 449px) {
|
||||
#file-system-browser-dialog {
|
||||
min-width: 400px
|
||||
min-width: 450px
|
||||
}
|
||||
|
||||
.e.extra-large-icons {
|
||||
@@ -1117,7 +1120,7 @@ div[id^="file-system-browser-file-system-explorer"]:not([id*="container"]) {
|
||||
}
|
||||
|
||||
.e.extra-large-icons .text span {
|
||||
max-width: 400px;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.e.large-icons {
|
||||
+4
-15
@@ -1,15 +1,4 @@
|
||||
.treeview {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
padding: 10px;
|
||||
background-color: #f0f0f0;
|
||||
border: 1px solid #ddd;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.tree-node {
|
||||
.tree-node {
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
@@ -50,8 +39,8 @@
|
||||
}
|
||||
|
||||
.node-icon, .expand-button {
|
||||
flex-shrink: 0;
|
||||
align-self: center;
|
||||
flex-shrink: 0;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.child-nodes {
|
||||
@@ -86,4 +75,4 @@
|
||||
word-break: break-all;
|
||||
flex: 1;
|
||||
align-self: end;
|
||||
}
|
||||
}
|
||||
+344
-343
@@ -1,343 +1,344 @@
|
||||
.overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 0.50s, visibility 0.50s, height 0.50s;
|
||||
-webkit-transition: opacity 0.50s, visibility 0.50s, height 0.50s;
|
||||
overflow: hidden;
|
||||
background: black;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
#hamburger-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#hamburger-menu {
|
||||
cursor: pointer;
|
||||
position: fixed;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
display: none;
|
||||
z-index: 2;
|
||||
padding: 5px 0;
|
||||
margin: 0px;
|
||||
font-family: 'Cabin', Sans-serif;
|
||||
background: linear-gradient(to top, #424343 0%, #505050 50%, #5E5D5D 100%);
|
||||
}
|
||||
|
||||
#hamburger-menu > span {
|
||||
display: block;
|
||||
width: 30px;
|
||||
height: 4px;
|
||||
margin: 6px auto;
|
||||
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4));
|
||||
border-radius: 2px;
|
||||
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
#hamburger-menu:hover {
|
||||
background: linear-gradient(to top, #505050 0%, #5E5D5D 50%, #6A6969 100%);
|
||||
}
|
||||
|
||||
#hamburger-menu:hover > span {
|
||||
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.5));
|
||||
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
#hamburger-menu #mobile-menu {
|
||||
visibility: hidden;
|
||||
position: fixed;
|
||||
margin: 0px;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
overflow: auto;
|
||||
color: #6DCBFE;
|
||||
text-align: center;
|
||||
background: #4F4F4F;
|
||||
transition: 0.50s;
|
||||
-webkit-transition: 0.50s;
|
||||
padding: 0px 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#mobile-menu-content {
|
||||
border: 1px solid #777777;
|
||||
border-top-color: #000000;
|
||||
border-left-color: #000000;
|
||||
margin-top: 4px;
|
||||
margin-left: -6px;
|
||||
margin-right: -5px;
|
||||
margin-bottom: 3px;
|
||||
color: #6DCBFE;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||
font-weight: bold;
|
||||
text-shadow: 0px 0px 2px rgba(0,0,0,1);
|
||||
/*background: #000 url(../images/metal-plate.png);*/
|
||||
}
|
||||
|
||||
.mobile-menu-heading {
|
||||
height: 35px;
|
||||
font-size: 28px;
|
||||
background: rgb(10, 11, 11);
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
width: 100%;
|
||||
background-image: linear-gradient(180deg, #505050, #464646, #404040, #363636);
|
||||
}
|
||||
|
||||
#hamburger-menu ul {
|
||||
margin-left: 0px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
padding: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#hamburger-menu li {
|
||||
width: 100%;
|
||||
list-style-type: none;
|
||||
line-height: 2rem;
|
||||
display: flex;
|
||||
font-weight: normal;
|
||||
font-size: 10px;
|
||||
text-shadow: none;
|
||||
text-align: left;
|
||||
border: 1px solid #333333;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
}
|
||||
|
||||
#hamburger-menu li:nth-child(even) {
|
||||
background-color: #191E21;
|
||||
}
|
||||
|
||||
#hamburger-menu li:nth-child(odd) {
|
||||
background-color: #28292B;
|
||||
}
|
||||
|
||||
#hamburger-menu a {
|
||||
padding-left: 5px;
|
||||
width: 100%;
|
||||
color: #6DCBFE;
|
||||
font-weight: normal;
|
||||
font-size: 18px;
|
||||
font-family: 'Arial';
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
margin-left: 0.3em;
|
||||
}
|
||||
#hamburger-menu a:focus,
|
||||
#hamburger-menu a:active {
|
||||
color: #7CACF8;
|
||||
}
|
||||
|
||||
#hamburger-menu a:hover {
|
||||
color: #FFFFFF;
|
||||
background: rgb(10, 11, 11);
|
||||
background-image: linear-gradient(180deg, #505050, #464646, #404040, #363636);
|
||||
}
|
||||
|
||||
#hamburger-input:checked + #hamburger-menu {
|
||||
background: linear-gradient(to bottom, #424343 0%, #505050 50%, #5E5D5D 100%);
|
||||
border: 1px solid #777777;
|
||||
border-top: 1px solid #000000;
|
||||
border-left: 1px solid #000000;
|
||||
}
|
||||
|
||||
#hamburger-input:checked + #hamburger-menu #mobile-menu {
|
||||
visibility: visible;
|
||||
left: 0;
|
||||
top: 71px;
|
||||
}
|
||||
|
||||
#hamburger-input:checked + #hamburger-menu {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#hamburger-input:checked ~ .overlay {
|
||||
visibility: visible;
|
||||
opacity: 0.5;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.menubar {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
padding: 0;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
z-index: 900;
|
||||
}
|
||||
|
||||
.menubar ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.menubar > ul > li {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menubar label,
|
||||
.menubar a {
|
||||
display: block;
|
||||
padding: 2px 10px;
|
||||
text-decoration: none;
|
||||
cursor: default;
|
||||
color: #6DCBFE;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.menubar > ul > li > label:hover,
|
||||
.menubar > ul > li > a:hover {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
border-left: 1px solid #777777;
|
||||
border-right: 1px solid #000000;
|
||||
border-top: 1px solid #505050;
|
||||
border-bottom: 1px solid #222222;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.menubar input[type="radio"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menubar ul ul {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
min-width: 150px;
|
||||
background: #4F4F4F;
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
padding-top: 4px;
|
||||
padding-left: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.menubar ul ul li {
|
||||
background: #232323;
|
||||
border-left: 1px solid #000000;
|
||||
border-right: 1px solid #777777;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menubar ul ul li:first-child {
|
||||
border-top: 1px solid #000000;
|
||||
}
|
||||
|
||||
.menubar ul ul li:last-child {
|
||||
border-bottom: 1px solid #777777;
|
||||
}
|
||||
|
||||
.menubar ul ul li > label:hover,
|
||||
.menubar ul ul li > a:hover {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
border: 1px solid #777777;
|
||||
border-right-color: #000000;
|
||||
border-bottom-color: #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.menubar ul ul ul {
|
||||
left: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.menubar li:focus-within > ul {
|
||||
display: block;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.menubar > ul > li:focus-within > label,
|
||||
.menubar > ul > li:focus-within > a {
|
||||
background-color: #28292B;
|
||||
background: radial-gradient( 115% 115% at 68% 70%, #30303088 0%, #20202044 50%, #101010 100% );
|
||||
border: 1px solid #777777;
|
||||
border-top: 1px solid #000000;
|
||||
border-left: 1px solid #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.menubar .has-submenu > label::after,
|
||||
.menubar .has-submenu > a::after {
|
||||
content: " ▶";
|
||||
font-size: 0.6em;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.menubar .has-submenu:focus-within > label,
|
||||
.menubar .has-submenu:focus-within > a {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
border: 1px solid #777777;
|
||||
border-right-color: #000000;
|
||||
border-bottom-color: #000000;
|
||||
}
|
||||
|
||||
.menubar .has-submenu:focus-within > label::after,
|
||||
.menubar .has-submenu:focus-within > a::after {
|
||||
content: " ▼";
|
||||
color: #FF0000;
|
||||
transform: translateY(-50%) rotate(0deg);
|
||||
}
|
||||
|
||||
.menubar .has-submenu:focus-within > label,
|
||||
.menubar .has-submenu:focus-within > a {
|
||||
color: #7CACF8;
|
||||
}
|
||||
|
||||
/* For phones */
|
||||
@media only screen and (max-width: 768px) {
|
||||
.menubar {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#hamburger-menu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#mobile-menu {
|
||||
height: calc(100% - 70px);
|
||||
}
|
||||
}
|
||||
|
||||
/* For desktop: */
|
||||
@media only screen and (min-width: 768px) {
|
||||
.menubar {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
}
|
||||
.overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 0.50s, visibility 0.50s, height 0.50s;
|
||||
-webkit-transition: opacity 0.50s, visibility 0.50s, height 0.50s;
|
||||
overflow: hidden;
|
||||
background: black;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
#hamburger-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#hamburger-menu {
|
||||
cursor: pointer;
|
||||
position: fixed;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
display: none;
|
||||
z-index: 2;
|
||||
padding: 5px 0;
|
||||
margin: 0px;
|
||||
font-family: 'Cabin', Sans-serif;
|
||||
background: linear-gradient(to top, #424343 0%, #505050 50%, #5E5D5D 100%);
|
||||
}
|
||||
|
||||
#hamburger-menu > span {
|
||||
display: block;
|
||||
width: 30px;
|
||||
height: 4px;
|
||||
margin: 6px auto;
|
||||
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4));
|
||||
border-radius: 2px;
|
||||
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
#hamburger-menu:hover {
|
||||
background: linear-gradient(to top, #505050 0%, #5E5D5D 50%, #6A6969 100%);
|
||||
}
|
||||
|
||||
#hamburger-menu:hover > span {
|
||||
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.5));
|
||||
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
#hamburger-menu #mobile-menu {
|
||||
visibility: hidden;
|
||||
position: fixed;
|
||||
margin: 0px;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
overflow: auto;
|
||||
color: #6DCBFE;
|
||||
text-align: center;
|
||||
background: #4F4F4F;
|
||||
transition: 0.50s;
|
||||
-webkit-transition: 0.50s;
|
||||
padding: 0px 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#mobile-menu-content {
|
||||
border: 1px solid #777777;
|
||||
border-top-color: #000000;
|
||||
border-left-color: #000000;
|
||||
margin-top: 4px;
|
||||
margin-left: -6px;
|
||||
margin-right: -5px;
|
||||
margin-bottom: 3px;
|
||||
color: #6DCBFE;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||
font-weight: bold;
|
||||
text-shadow: 0px 0px 2px rgba(0,0,0,1);
|
||||
/*background: #000 url(../images/metal-plate.png);*/
|
||||
}
|
||||
|
||||
.mobile-menu-heading {
|
||||
height: 35px;
|
||||
font-size: 28px;
|
||||
background: rgb(10, 11, 11);
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
width: 100%;
|
||||
background-image: linear-gradient(180deg, #505050, #464646, #404040, #363636);
|
||||
}
|
||||
|
||||
#hamburger-menu ul {
|
||||
margin-left: 0px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
padding: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#hamburger-menu li {
|
||||
width: 100%;
|
||||
list-style-type: none;
|
||||
line-height: 2rem;
|
||||
display: flex;
|
||||
font-weight: normal;
|
||||
font-size: 10px;
|
||||
text-shadow: none;
|
||||
text-align: left;
|
||||
border: 1px solid #333333;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
}
|
||||
|
||||
#hamburger-menu li:nth-child(even) {
|
||||
background-color: #191E21;
|
||||
}
|
||||
|
||||
#hamburger-menu li:nth-child(odd) {
|
||||
background-color: #28292B;
|
||||
}
|
||||
|
||||
#hamburger-menu a {
|
||||
padding-left: 5px;
|
||||
width: 100%;
|
||||
color: #6DCBFE;
|
||||
font-weight: normal;
|
||||
font-size: 18px;
|
||||
font-family: 'Arial';
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
margin-left: 0.3em;
|
||||
}
|
||||
|
||||
#hamburger-menu a:focus,
|
||||
#hamburger-menu a:active {
|
||||
color: #7CACF8;
|
||||
}
|
||||
|
||||
#hamburger-menu a:hover {
|
||||
color: #FFFFFF;
|
||||
background: rgb(10, 11, 11);
|
||||
background-image: linear-gradient(180deg, #505050, #464646, #404040, #363636);
|
||||
}
|
||||
|
||||
#hamburger-input:checked + #hamburger-menu {
|
||||
background: linear-gradient(to bottom, #424343 0%, #505050 50%, #5E5D5D 100%);
|
||||
border: 1px solid #777777;
|
||||
border-top: 1px solid #000000;
|
||||
border-left: 1px solid #000000;
|
||||
}
|
||||
|
||||
#hamburger-input:checked + #hamburger-menu #mobile-menu {
|
||||
visibility: visible;
|
||||
left: 0;
|
||||
top: 71px;
|
||||
}
|
||||
|
||||
#hamburger-input:checked + #hamburger-menu {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#hamburger-input:checked ~ .overlay {
|
||||
visibility: visible;
|
||||
opacity: 0.5;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.menubar {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
padding: 0;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
z-index: 900;
|
||||
}
|
||||
|
||||
.menubar ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.menubar > ul > li {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menubar label,
|
||||
.menubar a {
|
||||
display: block;
|
||||
padding: 2px 10px;
|
||||
text-decoration: none;
|
||||
cursor: default;
|
||||
color: #6DCBFE;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.menubar > ul > li > label:hover,
|
||||
.menubar > ul > li > a:hover {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
border-left: 1px solid #777777;
|
||||
border-right: 1px solid #000000;
|
||||
border-top: 1px solid #505050;
|
||||
border-bottom: 1px solid #222222;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.menubar input[type="radio"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menubar ul ul {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
min-width: 150px;
|
||||
background: #4F4F4F;
|
||||
border: 1px solid #777777;
|
||||
border-bottom-color: #000000;
|
||||
border-right-color: #000000;
|
||||
padding-top: 4px;
|
||||
padding-left: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.menubar ul ul li {
|
||||
background: #232323;
|
||||
border-left: 1px solid #000000;
|
||||
border-right: 1px solid #777777;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menubar ul ul li:first-child {
|
||||
border-top: 1px solid #000000;
|
||||
}
|
||||
|
||||
.menubar ul ul li:last-child {
|
||||
border-bottom: 1px solid #777777;
|
||||
}
|
||||
|
||||
.menubar ul ul li > label:hover,
|
||||
.menubar ul ul li > a:hover {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
border: 1px solid #777777;
|
||||
border-right-color: #000000;
|
||||
border-bottom-color: #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.menubar ul ul ul {
|
||||
left: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.menubar li:focus-within > ul {
|
||||
display: block;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.menubar > ul > li:focus-within > label,
|
||||
.menubar > ul > li:focus-within > a {
|
||||
background-color: #28292B;
|
||||
background: radial-gradient( 115% 115% at 68% 70%, #30303088 0%, #20202044 50%, #101010 100% );
|
||||
border: 1px solid #777777;
|
||||
border-top: 1px solid #000000;
|
||||
border-left: 1px solid #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.menubar .has-submenu > label::after,
|
||||
.menubar .has-submenu > a::after {
|
||||
content: " ▶";
|
||||
font-size: 0.6em;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.menubar .has-submenu:focus-within > label,
|
||||
.menubar .has-submenu:focus-within > a {
|
||||
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
|
||||
border: 1px solid #777777;
|
||||
border-right-color: #000000;
|
||||
border-bottom-color: #000000;
|
||||
}
|
||||
|
||||
.menubar .has-submenu:focus-within > label::after,
|
||||
.menubar .has-submenu:focus-within > a::after {
|
||||
content: " ▼";
|
||||
color: #FF0000;
|
||||
transform: translateY(-50%) rotate(0deg);
|
||||
}
|
||||
|
||||
.menubar .has-submenu:focus-within > label,
|
||||
.menubar .has-submenu:focus-within > a {
|
||||
color: #7CACF8;
|
||||
}
|
||||
|
||||
/* For phones */
|
||||
@media only screen and (max-width: 768px) {
|
||||
.menubar {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#hamburger-menu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#mobile-menu {
|
||||
height: calc(100% - 70px);
|
||||
}
|
||||
}
|
||||
|
||||
/* For desktop: */
|
||||
@media only screen and (min-width: 768px) {
|
||||
.menubar {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -22,7 +22,6 @@
|
||||
border-bottom: 1px solid #000 !important;
|
||||
box-shadow: 5px 5px 5px var(--shadow-color);
|
||||
animation: fadeIn 0.3s, fadeOut 0.3s 4.7s;
|
||||
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: stretch;
|
||||
@@ -104,4 +103,4 @@
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ main {
|
||||
}
|
||||
|
||||
#modal-background {
|
||||
display: none;
|
||||
z-index: 998;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
@@ -1244,4 +1245,4 @@ main {
|
||||
/* For desktop: */
|
||||
@media only screen and (min-width: 768px) {
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -53,4 +53,4 @@
|
||||
|
||||
textarea {
|
||||
resize: none;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -1,34 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Lumina</title>
|
||||
<base href="/" />
|
||||
<link rel="stylesheet" href="css/blazor.css" />
|
||||
<link rel="stylesheet" href="css/site.css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<link href="Lumina.Presentation.Web.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<svg class="loading-progress">
|
||||
<circle r="40%" cx="50%" cy="50%" />
|
||||
<circle r="40%" cx="50%" cy="50%" />
|
||||
</svg>
|
||||
<div class="loading-progress-text"></div>
|
||||
</div>
|
||||
<!--Modal grid background-->
|
||||
<div id="modal-background" class="block"></div>
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
<script src="js/site.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Enum-like object for notification types.
|
||||
* @readonly
|
||||
* @enum {string}
|
||||
*/
|
||||
const NotificationType = {
|
||||
INFO: 'info',
|
||||
SUCCESS: 'success',
|
||||
WARNING: 'warning',
|
||||
ERROR: 'error'
|
||||
};
|
||||
|
||||
/**
|
||||
* Manages the creation, display, and removal of notifications.
|
||||
*/
|
||||
class NotificationService {
|
||||
/**
|
||||
* Creates an instance of NotificationService.
|
||||
* Initializes the notification container and appends it to the document body.
|
||||
*/
|
||||
constructor() {
|
||||
this.notifications = [];
|
||||
this.container = document.createElement('div');
|
||||
this.container.className = 'notification-container';
|
||||
document.body.appendChild(this.container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a new notification.
|
||||
* @param {string} message - The message to display in the notification.
|
||||
* @param {NotificationType} type - The type of notification.
|
||||
*/
|
||||
show(message, type) {
|
||||
const notification = {
|
||||
id: Date.now().toString(),
|
||||
message,
|
||||
type
|
||||
};
|
||||
|
||||
this.addNotification(notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a notification to the list and displays it.
|
||||
* @param {Object} notification - The notification object to add.
|
||||
* @param {string} notification.id - Unique identifier for the notification.
|
||||
* @param {string} notification.message - The notification message.
|
||||
* @param {NotificationType} notification.type - The type of notification.
|
||||
*/
|
||||
addNotification(notification) {
|
||||
this.notifications.push(notification);
|
||||
this.displayNotification(notification);
|
||||
|
||||
// log the notification to the console
|
||||
const message = `${notification.type.charAt(0).toUpperCase() + notification.type.slice(1)}: ${notification.message}`;
|
||||
if (notification.type === 'info')
|
||||
console.info(message);
|
||||
else if (notification.type === 'warning')
|
||||
console.warn(message);
|
||||
else if (notification.type === 'error')
|
||||
console.error(message);
|
||||
else
|
||||
console.log(message);
|
||||
|
||||
// set a timeout to remove the notification after 5 seconds
|
||||
setTimeout(() => this.removeNotification(notification.id), 5000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a notification from the list and the DOM.
|
||||
* @param {string} id - The ID of the notification to remove.
|
||||
*/
|
||||
removeNotification(id) {
|
||||
const index = this.notifications.findIndex(n => n.id === id);
|
||||
if (index !== -1) {
|
||||
this.notifications.splice(index, 1);
|
||||
const element = document.getElementById(`notification-${id}`);
|
||||
if (element) {
|
||||
element.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and displays a notification element in the DOM.
|
||||
* @param {Object} notification - The notification object to display.
|
||||
* @param {string} notification.id - Unique identifier for the notification.
|
||||
* @param {string} notification.message - The notification message.
|
||||
* @param {NotificationType} notification.type - The type of notification.
|
||||
*/
|
||||
displayNotification(notification) {
|
||||
const notificationElement = document.createElement('div');
|
||||
notificationElement.id = `notification-${notification.id}`;
|
||||
notificationElement.className = `notification ${notification.type}`;
|
||||
notificationElement.innerHTML = `
|
||||
<div class="shine-effect"></div>
|
||||
<div class="notification-body">
|
||||
<span class="notification-message">${notification.message}</span>
|
||||
<button class="close-button" onclick="notificationService.removeNotification('${notification.id}')">×</button>
|
||||
</div>
|
||||
`;
|
||||
this.container.appendChild(notificationElement);
|
||||
}
|
||||
}
|
||||
|
||||
// create a global instance of the NotificationService
|
||||
const notificationService = new NotificationService();
|
||||
@@ -1,17 +1,113 @@
|
||||
const scrollbarHeight = getScrollbarHeight();
|
||||
const scrollbarWidth = getScrollbarWidth();
|
||||
const progressIndicator = document.getElementById('progress-indicator');
|
||||
const progressIndicatorValue = document.getElementById('progress-indicator-value');
|
||||
const progressIndicatorValueShadow = document.getElementById('progress-indicator-value-shadow');
|
||||
const progressIndicatorValueText = document.getElementById('progress-indicator-value-text');
|
||||
|
||||
let selectionStartPosition = { x: 0, y: 0 };
|
||||
let currentMousePosition = { x: 0, y: 0 };
|
||||
let isSelecting = false;
|
||||
let isSelectionMode = false;
|
||||
|
||||
let fileSystemExplorer = null;
|
||||
let fileSystemExplorerContainer = null;
|
||||
let visibleSelectionRectangle = null;
|
||||
let selectionRectangle = null;
|
||||
|
||||
// =================== common helper function ===================
|
||||
let enableConsoleDebugMessages = false; // whether to display debug messages at the developer console, or not
|
||||
|
||||
var ajaxCallCounter = 0;
|
||||
|
||||
|
||||
//+======================================================================================+
|
||||
//| API interaction |
|
||||
//+======================================================================================+
|
||||
|
||||
/**
|
||||
* Performs a GET request to the specified API endpoint.
|
||||
* @param {string} url - The API endpoint URL.
|
||||
* @returns {Promise<any>} The response data if successful, undefined otherwise.
|
||||
*/
|
||||
async function callApiGetAsync(url) {
|
||||
try {
|
||||
// create the URL for the API endpoint
|
||||
const response = await fetch(url); // call the API
|
||||
if (!response.ok)
|
||||
throw new Error('Network response was not ok');
|
||||
const jsonResponse = await response.json();
|
||||
if (jsonResponse.success)
|
||||
return jsonResponse.data;
|
||||
else
|
||||
notificationService.show(jsonResponse.errorMessage, NotificationType.ERROR);
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
notificationService.show(error, NotificationType.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
//+======================================================================================+
|
||||
//| Common Helper Functions |
|
||||
//+======================================================================================+
|
||||
|
||||
/**
|
||||
* Starts progress indicator
|
||||
*/
|
||||
function showBusyIndicator() {
|
||||
//if (ajaxCallCounter === 0)
|
||||
//progressIndicator.classList.remove('hidden');
|
||||
ajaxCallCounter++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides progress indicator
|
||||
*/
|
||||
function hideBusyIndicator() {
|
||||
ajaxCallCounter--;
|
||||
//if (ajaxCallCounter === 0)
|
||||
//progressIndicator.classList.add('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the elements that display a progress operation
|
||||
*/
|
||||
function showOperationProgress() {
|
||||
progressIndicatorValueShadow.classList.remove('hidden');
|
||||
progressIndicatorValue.classList.remove('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the elements that display a progress operation
|
||||
*/
|
||||
function hideOperationProgress() {
|
||||
progressIndicatorValueShadow.classList.add('hidden');
|
||||
progressIndicatorValue.classList.add('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the progress indicator
|
||||
* @param {int} completed - Number of completed elements
|
||||
* @param {int} total - Number of total elements
|
||||
*/
|
||||
function updateOperationProgress(completed, total) {
|
||||
progressIndicatorValueText.innerText = completed + '/' + total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Blob to Base64.
|
||||
* @param {any} blob The blob to convert.
|
||||
* @returns The converted Base64 string.
|
||||
*/
|
||||
async function blobToBase64(blob) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result.split(',')[1]);
|
||||
reader.onerror = reject;
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given file path corresponds to an image file.
|
||||
* @param {string} filePath - The path to the file to be checked.
|
||||
* @returns {boolean} True if the file path ends with an image file extension, false otherwise.
|
||||
*/
|
||||
function isImageFile(filePath) {
|
||||
// Adjust the regex pattern to match the image file extensions you support
|
||||
return /\.(jpe?g|png|gif|bmp|svg|ico|webp)$/i.test(filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current time
|
||||
@@ -82,23 +178,40 @@ function getScrollbarWidth() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables horizontal scrolling to the element identified by the specified id.
|
||||
* Handles the wheel event for horizontal scrolling.
|
||||
* @param {WheelEvent} event - The wheel event object.
|
||||
*/
|
||||
function addHorizontalScrolling(id) {
|
||||
document.getElementById(id).addEventListener('wheel', function (e) {
|
||||
e.preventDefault();
|
||||
this.scrollLeft += (e.deltaY > 0 ? 1 : -1) * 80;
|
||||
}, { passive: false });
|
||||
const scrollHandler = function (event) {
|
||||
event.preventDefault();
|
||||
this.scrollLeft += (event.deltaY > 0 ? 1 : -1) * 80;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables horizontal scrolling to the element identified by the specified id or element.
|
||||
* @param {string|HTMLElement} idOrElement - The id of the element or the element itself.
|
||||
*/
|
||||
function addHorizontalScrolling(idOrElement) {
|
||||
let element = idOrElement;
|
||||
if (typeof idOrElement === 'string')
|
||||
element = document.getElementById(idOrElement);
|
||||
if (element instanceof HTMLElement)
|
||||
element.addEventListener('wheel', scrollHandler, { passive: false });
|
||||
else
|
||||
console.error('Invalid input: Expected an element ID or HTMLElement');
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables horizontal scrolling to the element identified by the specified id.
|
||||
* Disables horizontal scrolling for the element identified by the specified id or element.
|
||||
* @param {string|HTMLElement} idOrElement - The id of the element or the element itself.
|
||||
*/
|
||||
function removeHorizontalScrolling(id) {
|
||||
document.getElementById(id).removeEventListener('wheel', function (e) {
|
||||
e.preventDefault();
|
||||
this.scrollLeft += (e.deltaY > 0 ? 1 : -1) * 80;
|
||||
}, { passive: false });
|
||||
function removeHorizontalScrolling(idOrElement) {
|
||||
let element = idOrElement;
|
||||
if (typeof idOrElement === 'string')
|
||||
element = document.getElementById(idOrElement);
|
||||
if (element instanceof HTMLElement)
|
||||
element.removeEventListener('wheel', scrollHandler, { passive: false });
|
||||
else
|
||||
console.error('Invalid input: Expected an element ID or HTMLElement');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,426 +237,3 @@ function getElementOffset(id) {
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position and size of an HTML element.
|
||||
* @param {string} id - The id of the element to get the rectangle of.
|
||||
* @returns {object} An object containing the element's X (left), Y (top), Width, and Height in pixels.
|
||||
*/
|
||||
function getElementRectangle(id) {
|
||||
const element = document.getElementById(id);
|
||||
const rect = element.getBoundingClientRect();
|
||||
return {
|
||||
x: rect.left,
|
||||
y: rect.top,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
|
||||
// =================== file system browser dialog ===================
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Focuses the navigator address bar input.
|
||||
*/
|
||||
function focusNavigatorInputElement() {
|
||||
const elements = document.getElementsByClassName('navigator-address-bar-input');
|
||||
if (elements.length > 0)
|
||||
elements[0].focus();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all navigator path segments.
|
||||
*/
|
||||
function closeNavigatorPathSegments() {
|
||||
const checkboxes = document.getElementsByClassName('navigator-toggle-checkbox');
|
||||
for (let i = 0; i < checkboxes.length; i++)
|
||||
checkboxes[i].checked = false;
|
||||
}
|
||||
|
||||
// =================== file system browser dialog selection ===================
|
||||
|
||||
/**
|
||||
* Function called at the initialization of fle system browser dialog
|
||||
* @param {any} dotnetHelper - .NET object to invoke methods asynchronously.
|
||||
*/
|
||||
function initializeFileSystemBrowser(dotnetHelper) {
|
||||
// cache frequently accessed elements
|
||||
if (!selectionRectangle)
|
||||
selectionRectangle = document.getElementById('selection-rectangle');
|
||||
if (!visibleSelectionRectangle)
|
||||
visibleSelectionRectangle = document.getElementById('visible-selection-rectangle');
|
||||
if (!fileSystemExplorer) {
|
||||
fileSystemExplorer = document.getElementById('file-system-browser-file-system-explorer');
|
||||
if (fileSystemExplorer)
|
||||
fileSystemExplorer.addEventListener('mouseup', fileSystemExplorerMouseUp);
|
||||
}
|
||||
// event handlers needed for selection
|
||||
if (!fileSystemExplorerContainer) {
|
||||
fileSystemExplorerContainer = document.getElementById('file-system-browser-file-system-explorer-container');
|
||||
if (fileSystemExplorerContainer) {
|
||||
fileSystemExplorerContainer.addEventListener('mousedown', startSelection);
|
||||
fileSystemExplorerContainer.addEventListener('mousemove', updateSelection);
|
||||
fileSystemExplorerContainer.addEventListener('mouseup', endSelection);
|
||||
fileSystemExplorerContainer.addEventListener('wheel', handleSelection);
|
||||
fileSystemExplorerContainer.addEventListener('scroll', handleSelection);
|
||||
}
|
||||
}
|
||||
// handler for the mouse down event of file system browser dialog files and directories elements
|
||||
window.handleFileSystemEntityMouseDown = function (e) {
|
||||
// stop the event from bubbling up to the explorer - we dont want to start selection rectangles when clicking files or directories
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
// handler for the mouse up event of file system browser dialog files and directories elements
|
||||
window.handleFileSystemEntityMouseUp = function (e) {
|
||||
e.preventDefault();
|
||||
if (!isSelecting)
|
||||
e.stopPropagation();
|
||||
const allEClassElements = Array.from(fileSystemExplorer.querySelectorAll('.e'));
|
||||
const currentIndex = allEClassElements.indexOf(e.currentTarget);
|
||||
|
||||
// If a previous click timestamp exists, check the time difference
|
||||
const previousTime = parseInt(e.currentTarget.dataset.selectionStartTime || 0);
|
||||
const currentTime = new Date().getTime();
|
||||
const timeDifference = currentTime - previousTime;
|
||||
|
||||
// TODO: needs to account for when the element is already selected, and a double click occurs - on first click it would check the difference and go to rename -
|
||||
// maybe just wait half second before performing action
|
||||
|
||||
// if time difference is less than 300ms, treat it as a double-click
|
||||
if (timeDifference < 300) {
|
||||
if (e.currentTarget.dataset.type === 'directory') { // directories
|
||||
dotnetHelper.invokeMethodAsync('OnDirectoryDoubleClickAsync', e.currentTarget.dataset.path);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{ // files
|
||||
|
||||
}
|
||||
// reset the timestamp used to track double clicks
|
||||
e.currentTarget.dataset.selectionStartTime = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
e.currentTarget.dataset.selectionStartTime = currentTime; // element was single clicked, update the selection start time to now
|
||||
if (e.ctrlKey || isSelectionMode) { // when CTRL key is pressed
|
||||
// toggle selection for the current clicked item
|
||||
e.currentTarget.classList.toggle('selected');
|
||||
// set the selection start if it's not already set
|
||||
if (fileSystemExplorer.dataset.selectionStart === undefined)
|
||||
fileSystemExplorer.dataset.selectionStart = currentIndex;
|
||||
}
|
||||
else if ((e.shiftKey && fileSystemExplorer.dataset.selectionStart !== undefined) || isSelectionMode) { // when SHIFT key is pressed
|
||||
const start = parseInt(fileSystemExplorer.dataset.selectionStart);
|
||||
// remove all selections
|
||||
allEClassElements.forEach(elem => {
|
||||
elem.classList.remove('selected');
|
||||
});
|
||||
// define the range to select items from and to
|
||||
const [from, to] = start < currentIndex ? [start, currentIndex] : [currentIndex, start];
|
||||
// add the 'selected' class to items in the range
|
||||
for (let i = from; i <= to; i++)
|
||||
allEClassElements[i].classList.add('selected');
|
||||
}
|
||||
else
|
||||
{ // when neither CTRL nor SHIFT keys are pressed
|
||||
if (!isSelectionMode) {
|
||||
// get all elements that are selected
|
||||
const selectedElements = allEClassElements.filter(element => element.classList.contains('selected'));
|
||||
// add 'selected' class to the current clicked item
|
||||
e.currentTarget.classList.add('selected');
|
||||
// if there are no selected elements, or if there are more than one, deselect all of them, and select just the clicked one
|
||||
if ((selectedElements.length === 1 && e.currentTarget !== selectedElements[0]) || selectedElements.length !== 1) {
|
||||
// deselect all items
|
||||
selectedElements.forEach(elem => {
|
||||
if (elem !== e.currentTarget) {
|
||||
elem.classList.remove('selected');
|
||||
// remove selectionStartTime from all items
|
||||
delete elem.dataset.selectionStartTime;
|
||||
}
|
||||
});
|
||||
// set the current item as the selection start
|
||||
fileSystemExplorer.dataset.selectionStart = currentIndex;
|
||||
// store the current timestamp for future double-click checks
|
||||
e.currentTarget.dataset.selectionStartTime = currentTime;
|
||||
}
|
||||
}
|
||||
else // if its selection mode, just toggle selection of item, when clicked
|
||||
e.currentTarget.classList.toggle('selected');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for the mouse up event of the file system browser dialog explorer
|
||||
* @param {MouseEvent} e - The mouseup event object.
|
||||
*/
|
||||
function fileSystemExplorerMouseUp(e) {
|
||||
const explorerScrollbars = hasScrollbars(fileSystemExplorer);
|
||||
// check if clicked on the horizontal scrollbar
|
||||
if (explorerScrollbars.horizontal && e.clientY > fileSystemExplorer.getBoundingClientRect().top + fileSystemExplorer.offsetHeight - scrollbarHeight)
|
||||
return;
|
||||
if (!e.ctrlKey && !e.shiftKey && !isSelectionMode) {
|
||||
// deselect all file system elements when their explorer is clicked
|
||||
fileSystemExplorer.querySelectorAll('.e.selected').forEach(item => {
|
||||
item.classList.remove('selected');
|
||||
});
|
||||
// do not store information about what item was clicked first, in context of Shift-selection
|
||||
fileSystemExplorer.removeAttribute('data-selection-start');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for the file system browser dialog selection start.
|
||||
* @param {MouseEvent} e - The mousedown event object.
|
||||
*/
|
||||
function startSelection(e) {
|
||||
const explorerScrollbars = hasScrollbars(fileSystemExplorer);
|
||||
const containerExplorerScrollbars = hasScrollbars(fileSystemExplorerContainer);
|
||||
// check if clicked on the horizontal or vertical scrollbar
|
||||
if (explorerScrollbars.horizontal && e.clientY > fileSystemExplorer.getBoundingClientRect().top + fileSystemExplorer.offsetHeight - scrollbarHeight)
|
||||
return;
|
||||
if (containerExplorerScrollbars.vertical && e.clientX > fileSystemExplorerContainer.getBoundingClientRect().left + fileSystemExplorerContainer.offsetWidth - scrollbarWidth)
|
||||
return;
|
||||
// store information about selection start
|
||||
isSelecting = true;
|
||||
document.body.style.overflowY = 'hidden'; // needed in order to not put a vertical scrollbar on the document, while in vertical layout selection
|
||||
document.documentElement.style.overflowY = 'hidden';
|
||||
selectionStartPosition.x = e.pageX + fileSystemExplorer.scrollLeft;
|
||||
selectionStartPosition.y = e.pageY + fileSystemExplorerContainer.scrollTop; // not a mistake - in vertical mode, this is the overflow container!
|
||||
// place the selection rectangle at the clicked location (relative to the whole page, and taking into account scroll offset), with 0 size
|
||||
visibleSelectionRectangle.style.left = e.pageX + 'px';
|
||||
visibleSelectionRectangle.style.top = e.pageY + 'px';
|
||||
visibleSelectionRectangle.style.width = '0px';
|
||||
visibleSelectionRectangle.style.height = '0px';
|
||||
visibleSelectionRectangle.style.visibility = 'visible';
|
||||
|
||||
selectionRectangle.style.left = e.pageX + 'px';
|
||||
selectionRectangle.style.top = e.pageY + 'px';
|
||||
selectionRectangle.style.width = '0px';
|
||||
selectionRectangle.style.height = '0px';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for the file system browser dialog selection update.
|
||||
* @param {MouseEvent} e - The mousemove event object.
|
||||
*/
|
||||
function updateSelection(e) {
|
||||
if (!isSelecting)
|
||||
return;
|
||||
currentMousePosition.x = e.pageX;
|
||||
currentMousePosition.y = e.pageY;
|
||||
handleSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for the file system browser dialog selection end.
|
||||
* @param {MouseEvent} e - The mouseup event object.
|
||||
*/
|
||||
function endSelection(e) {
|
||||
// selection ended, hide the selection rectangle
|
||||
isSelecting = false;
|
||||
document.body.style.removeProperty('overflow-y');
|
||||
document.documentElement.style.removeProperty('overflow-y');
|
||||
|
||||
visibleSelectionRectangle.style.visibility = 'hidden';
|
||||
selectionRectangle.style.visibility = 'hidden';
|
||||
|
||||
selectionRectangle.style.left = '0px';
|
||||
selectionRectangle.style.top = '0px';
|
||||
selectionRectangle.style.width = '0px';
|
||||
selectionRectangle.style.height = '0px';
|
||||
visibleSelectionRectangle.style.left = '0px';
|
||||
visibleSelectionRectangle.style.top = '0px';
|
||||
visibleSelectionRectangle.style.width = '0px';
|
||||
visibleSelectionRectangle.style.height = '0px';
|
||||
// go through each .e item that was inside the selection rectangle, and mark it as selected
|
||||
fileSystemExplorer.querySelectorAll('.e.selection-hover').forEach(item => {
|
||||
item.classList.add('selected');
|
||||
item.classList.remove('selection-hover');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for handling the file system browser dialog selection.
|
||||
*/
|
||||
function handleSelection() {
|
||||
if (!isSelecting) // only relevant when we have a selection initialized
|
||||
return;
|
||||
// calculate dimensions of the selection rectangle
|
||||
const currentX = currentMousePosition.x;
|
||||
const currentY = currentMousePosition.y;
|
||||
const width = currentX - (selectionStartPosition.x - fileSystemExplorer.scrollLeft);
|
||||
const height = currentY - (selectionStartPosition.y - fileSystemExplorerContainer.scrollTop);
|
||||
|
||||
// update selection rectangle dimensions
|
||||
visibleSelectionRectangle.style.width = Math.abs(width) + 'px';
|
||||
visibleSelectionRectangle.style.height = Math.abs(height) + 'px';
|
||||
selectionRectangle.style.width = Math.abs(width) + 'px';
|
||||
selectionRectangle.style.height = Math.abs(height) + 'px';
|
||||
|
||||
// adjust position based on selection direction
|
||||
if (width < 0) {
|
||||
selectionRectangle.style.left = currentX + 'px';
|
||||
visibleSelectionRectangle.style.left = currentX + 'px';
|
||||
} else {
|
||||
selectionRectangle.style.left = (selectionStartPosition.x - fileSystemExplorer.scrollLeft) + 'px';
|
||||
visibleSelectionRectangle.style.left = (selectionStartPosition.x - fileSystemExplorer.scrollLeft) + 'px';
|
||||
}
|
||||
if (height < 0) {
|
||||
selectionRectangle.style.top = currentY + 'px';
|
||||
visibleSelectionRectangle.style.top = currentY + 'px';
|
||||
} else {
|
||||
selectionRectangle.style.top = (selectionStartPosition.y - fileSystemExplorerContainer.scrollTop) + 'px';
|
||||
visibleSelectionRectangle.style.top = (selectionStartPosition.y - fileSystemExplorerContainer.scrollTop) + 'px';
|
||||
}
|
||||
|
||||
// do not let the selection rectangle go outside of explorer container, clip it if needed
|
||||
const containerRect = fileSystemExplorerContainer.getBoundingClientRect();
|
||||
const left = parseFloat(visibleSelectionRectangle.style.left);
|
||||
const top = parseFloat(visibleSelectionRectangle.style.top) + 1;
|
||||
const right = left + parseFloat(visibleSelectionRectangle.style.width);
|
||||
const bottom = top + parseFloat(visibleSelectionRectangle.style.height);
|
||||
|
||||
if (left < containerRect.left) {
|
||||
const difference = containerRect.left - left;
|
||||
visibleSelectionRectangle.style.width = (parseFloat(visibleSelectionRectangle.style.width) - difference) + 'px';
|
||||
visibleSelectionRectangle.style.left = containerRect.left + 'px';
|
||||
}
|
||||
if (right > containerRect.right)
|
||||
visibleSelectionRectangle.style.width = (containerRect.right - left) + 'px';
|
||||
|
||||
if (top < containerRect.top) {
|
||||
const difference = containerRect.top - top;
|
||||
visibleSelectionRectangle.style.height = (parseFloat(visibleSelectionRectangle.style.height) - difference) + 'px';
|
||||
visibleSelectionRectangle.style.top = containerRect.top + 'px';
|
||||
}
|
||||
if (bottom > containerRect.bottom)
|
||||
visibleSelectionRectangle.style.height = (containerRect.bottom - top) + 'px';
|
||||
|
||||
// change color of items that fall within selection rectangle
|
||||
const selectionRect = selectionRectangle.getBoundingClientRect();
|
||||
// go through each .e item which has not had its thumbnail retrieved yet
|
||||
fileSystemExplorer.querySelectorAll('.e').forEach(item => {
|
||||
const itemRect = item.getBoundingClientRect();
|
||||
// check if the item is fully or partially visible horizontally and vertically
|
||||
const isFullyVisibleHorizontally = itemRect.left >= selectionRect.left && itemRect.right <= selectionRect.right;
|
||||
const isFullyVisibleVertically = itemRect.top >= selectionRect.top && itemRect.bottom <= selectionRect.bottom;
|
||||
const isPartiallyVisibleHorizontally = itemRect.left < selectionRect.right && itemRect.right > selectionRect.left;
|
||||
const isPartiallyVisibleVertically = itemRect.top < selectionRect.bottom && itemRect.bottom > selectionRect.top;
|
||||
// if the item is fully or partially visible in both directions, add it to our list
|
||||
if ((isFullyVisibleHorizontally || isPartiallyVisibleHorizontally) && (isFullyVisibleVertically || isPartiallyVisibleVertically))
|
||||
item.classList.add('selection-hover');
|
||||
else
|
||||
item.classList.remove('selection-hover');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the state of selection mode.
|
||||
* @param {MouseEvent} e - The mouseup event object.
|
||||
*/
|
||||
function toggleSelectionMode(e) {
|
||||
isSelectionMode = !isSelectionMode;
|
||||
}
|
||||
|
||||
// =================== window functions ===================
|
||||
|
||||
/**
|
||||
* Attaches a click event listener to the window, invoking a .NET method when the window is clicked.
|
||||
* @param {any} dotnetHelper - .NET object to invoke methods asynchronously.
|
||||
*/
|
||||
function windowClickHandler(dotnetHelper) {
|
||||
window.addEventListener('click', (e) => {
|
||||
dotnetHelper.invokeMethodAsync('OnWindowClickAsync', {
|
||||
x: e.clientX,
|
||||
y: e.clientY,
|
||||
sender: e.target.getAttribute('id')
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a keydown event listener to the given element, invoking a .NET method when 'Escape' is pressed.
|
||||
* @param {HTMLElement} element - The HTML element to attach the keydown listener to.
|
||||
* @param {any} dotnetHelper - .NET object to invoke methods asynchronously.
|
||||
*/
|
||||
function windowKeyDownHandler(element, dotnetHelper) {
|
||||
element.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
dotnetHelper.invokeMethodAsync('EscapePressed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
});
|
||||
+7
-7
@@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lumina.Infrastructure", "Lu
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lumina.Presentation.Api", "Lumina.Presentation.Api\Lumina.Presentation.Api.csproj", "{7A49A922-127C-4786-84B7-53E64D816336}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lumina.Presentation.Web", "Lumina.Presentation.Web\Lumina.Presentation.Web.csproj", "{FABC255B-0D21-4A0A-A0E2-7759D929B4D3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lumina.Application.UnitTests", "..\tests\UnitTests\Lumina.Application.UnitTests\Lumina.Application.UnitTests.csproj", "{4DEA94AF-D592-4187-8850-A569C93256C9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lumina.Infrastructure.UnitTests", "..\tests\UnitTests\Lumina.Infrastructure.UnitTests\Lumina.Infrastructure.UnitTests.csproj", "{8DB5300A-B38A-4F6D-8FF7-A722DA47667E}"
|
||||
@@ -84,6 +82,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{
|
||||
..\docs\technical\templates\PULL_REQUEST_TEMPLATE.md = ..\docs\technical\templates\PULL_REQUEST_TEMPLATE.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lumina.Presentation.Web", "Lumina.Presentation.Web\Lumina.Presentation.Web.csproj", "{613C74E8-720C-4205-8BA7-85B23D2E7881}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -110,10 +110,6 @@ Global
|
||||
{7A49A922-127C-4786-84B7-53E64D816336}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7A49A922-127C-4786-84B7-53E64D816336}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7A49A922-127C-4786-84B7-53E64D816336}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FABC255B-0D21-4A0A-A0E2-7759D929B4D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FABC255B-0D21-4A0A-A0E2-7759D929B4D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FABC255B-0D21-4A0A-A0E2-7759D929B4D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FABC255B-0D21-4A0A-A0E2-7759D929B4D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4DEA94AF-D592-4187-8850-A569C93256C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4DEA94AF-D592-4187-8850-A569C93256C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4DEA94AF-D592-4187-8850-A569C93256C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -150,6 +146,10 @@ Global
|
||||
{6BD85BA8-B3C4-4D79-8858-F6D7676FF2CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6BD85BA8-B3C4-4D79-8858-F6D7676FF2CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6BD85BA8-B3C4-4D79-8858-F6D7676FF2CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{613C74E8-720C-4205-8BA7-85B23D2E7881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{613C74E8-720C-4205-8BA7-85B23D2E7881}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{613C74E8-720C-4205-8BA7-85B23D2E7881}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{613C74E8-720C-4205-8BA7-85B23D2E7881}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -160,7 +160,6 @@ Global
|
||||
{9FF9D5FA-1D0C-4743-87E3-CC8C08694CAC} = {3C316ABB-08D5-4450-9A4E-91059DB54254}
|
||||
{D43E63EA-2210-471E-BFED-D1D33D196554} = {3C316ABB-08D5-4450-9A4E-91059DB54254}
|
||||
{7A49A922-127C-4786-84B7-53E64D816336} = {3C316ABB-08D5-4450-9A4E-91059DB54254}
|
||||
{FABC255B-0D21-4A0A-A0E2-7759D929B4D3} = {3C316ABB-08D5-4450-9A4E-91059DB54254}
|
||||
{4DEA94AF-D592-4187-8850-A569C93256C9} = {53B1231B-37F5-44BA-80D5-DBA979775F5C}
|
||||
{8DB5300A-B38A-4F6D-8FF7-A722DA47667E} = {53B1231B-37F5-44BA-80D5-DBA979775F5C}
|
||||
{6050F6A9-F136-4B7B-82D2-57E689463ACA} = {53B1231B-37F5-44BA-80D5-DBA979775F5C}
|
||||
@@ -177,6 +176,7 @@ Global
|
||||
{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}
|
||||
{613C74E8-720C-4205-8BA7-85B23D2E7881} = {3C316ABB-08D5-4450-9A4E-91059DB54254}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4A55A28E-C657-4A0B-95EA-2931AE66004E}
|
||||
|
||||
Reference in new issue
Block a user