mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 22:11:10 +00:00
Implements directory browser dialog, part 1: file system treeview
This commit is contained in:
1 parent
4a53348013
commit
4e4ecbbfca
318 files changed
+6012
-1184
No files matched your search
@@ -2,12 +2,19 @@
|
||||
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.FileSystem;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Api;
|
||||
@@ -33,12 +40,13 @@ public class ApiHttpClient : IApiHttpClient
|
||||
_httpClient = httpClient;
|
||||
// read the API server configuration values from the configuration, and assign them to the injected client
|
||||
var serverConfigurationModel = serverConfigurationOptions.Value;
|
||||
httpClient.BaseAddress = new Uri(serverConfigurationModel.BaseAddress + ":" + serverConfigurationModel.Port + "/api/v1/");
|
||||
httpClient.BaseAddress = new Uri($"{serverConfigurationModel.BaseAddress}:{serverConfigurationModel.Port}/api/v{serverConfigurationModel.ApiVersion}/");
|
||||
|
||||
_jsonOptions = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
Converters = { new JsonStringEnumConverter() }
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
@@ -57,7 +65,39 @@ public class ApiHttpClient : IApiHttpClient
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, endpoint);
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken);
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a GET request to the specified <paramref name="endpoint"/> as an asynchronous operation and returns the result as a streamable response.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResponse">The expected type of the response content.</typeparam>
|
||||
/// <param name="endpoint">The API endpoint where the request is being sent.</param>
|
||||
/// <param name="token">The token used for authentication with the API.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <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 var request = new HttpRequestMessage(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);
|
||||
|
||||
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
|
||||
using var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||||
response.EnsureSuccessStatusCode();
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
// Deserialize the JSON content asynchronously as an enumerable of TResponse items
|
||||
await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<TResponse>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
yield break;
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,11 +112,11 @@ public class ApiHttpClient : IApiHttpClient
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, endpoint);
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
using var response = await _httpClient.SendAsync(request, cancellationToken);
|
||||
using var response = await _httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
// read the content as a string, for error messages
|
||||
var content = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
var content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||
ProblemDetailsModel? problemDetails = null;
|
||||
try
|
||||
{
|
||||
@@ -86,7 +126,7 @@ public class ApiHttpClient : IApiHttpClient
|
||||
throw new ApiException(problemDetails, response.StatusCode);
|
||||
}
|
||||
// if the response is successful, read it as a byte array
|
||||
byte[] responseContent = await response.Content.ReadAsByteArrayAsync(cancellationToken);
|
||||
byte[] responseContent = await response.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false);
|
||||
string contentType = response.Content.Headers.ContentType?.ToString() ?? "application/octet-stream";
|
||||
return new BlobDataModel { Data = responseContent, ContentType = contentType };
|
||||
}
|
||||
@@ -104,7 +144,7 @@ public class ApiHttpClient : IApiHttpClient
|
||||
using var request = new HttpRequestMessage(HttpMethod.Delete, endpoint);
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken);
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -123,7 +163,7 @@ public class ApiHttpClient : IApiHttpClient
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
request.Content = new StringContent(JsonSerializer.Serialize(data, _jsonOptions), Encoding.UTF8, "application/json");
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken);
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,23 +182,23 @@ public class ApiHttpClient : IApiHttpClient
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
request.Content = new StringContent(JsonSerializer.Serialize(data, _jsonOptions), Encoding.UTF8, "application/json");
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken);
|
||||
return await SendRequestAsync<TResponse>(request, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sends an HTTP request and deserializes the response into the specified type if the request is successful.
|
||||
/// If the request fails, it attempts to deserialize the response content into a <see cref="ProblemDetailsModel"/> and throws an <see cref="ApiException"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResponse">The expected type of the response content.</typeparam>
|
||||
/// <param name="request">The <see cref="HttpRequestMessage"/> to be sent.</param>
|
||||
/// <param name="cancellationToken">A token to cancel the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>The deserialized response content as an object of type <typeparamref name="TResponse"/>.</returns>
|
||||
/// <exception cref="ApiException">Thrown if the response is not successful, with the <see cref="ProblemDetailsModel"/> if available.</exception>
|
||||
private async Task<TResponse> SendRequestAsync<TResponse>(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
// send the HTTP request and read the response
|
||||
var response = await _httpClient.SendAsync(request, cancellationToken);
|
||||
var content = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
var response = await _httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
var content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||
// if the response is successful, deserialize the content to TResponse and return it
|
||||
if (response.IsSuccessStatusCode)
|
||||
return JsonSerializer.Deserialize<TResponse>(content, _jsonOptions)!;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.FileSystem;
|
||||
using Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Api;
|
||||
@@ -20,6 +23,16 @@ public interface IApiHttpClient
|
||||
/// <returns>The deserialized response containing the result of the GET request.</returns>
|
||||
Task<TResponse> GetAsync<TResponse>(string endpoint, string? token = null, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a GET request to the specified <paramref name="endpoint"/> as an asynchronous operation and returns the result as a streamable response.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResponse">The expected type of the response content.</typeparam>
|
||||
/// <param name="endpoint">The API endpoint where the request is being sent.</param>
|
||||
/// <param name="token">The token used for authentication with the API.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="IAsyncEnumerable{T}"/> object, which allows for asynchronous iteration over the deserialized items.</returns>
|
||||
IAsyncEnumerable<TResponse?> GetAsyncEnumerable<TResponse>(string endpoint, string? token = null, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a GET request to the specified <paramref name="endpoint"/> as an asynchronous operation and returns the result.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Books;
|
||||
using Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
using Lumina.Presentation.Web.Common.Enums;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Contracts.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to add a book.
|
||||
/// </summary>
|
||||
public class AddBookRequest
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public WrittenContentMetadataDto? Metadata { get; set; }
|
||||
public BookFormat? Format { get; set; }
|
||||
public string? Edition { get; set; }
|
||||
public int? VolumeNumber { get; set; }
|
||||
public BookSeriesDto? Series { get; set; }
|
||||
public string? ASIN { get; set; }
|
||||
public string? GoodreadsId { get; set; }
|
||||
public string? LCCN { get; set; }
|
||||
public string? OCLCNumber { get; set; }
|
||||
public string? OpenLibraryId { get; set; }
|
||||
public string? LibraryThingId { get; set; }
|
||||
public string? GoogleBooksId { get; set; }
|
||||
public string? BarnesAndNobleId { get; set; }
|
||||
public string? AppleBooksId { get; set; }
|
||||
public List<IsbnDto>? ISBNs { get; set; }
|
||||
public List<MediaContributorDto>? Contributors { get; set; }
|
||||
public List<BookRatingDto>? Ratings { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
using Lumina.Presentation.Web.Common.Models.Configuration;
|
||||
using Lumina.Presentation.Web.Common.Utilities;
|
||||
using Lumina.Presentation.Web.Common.Validators;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
|
||||
|
||||
+7
-4
@@ -1,9 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Core.Services.UI;
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Polly;
|
||||
using System.Net;
|
||||
using FluentValidation;
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Core.Services.UI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Polly;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of audio content libraries.
|
||||
/// </summary>
|
||||
public enum AudioContentType
|
||||
{
|
||||
/// <summary>
|
||||
/// A musical composition typically consisting of vocals and/or instruments.
|
||||
/// </summary>
|
||||
Music,
|
||||
|
||||
/// <summary>
|
||||
/// A recording of a book or other written work being read aloud.
|
||||
/// </summary>
|
||||
AudioBook,
|
||||
|
||||
/// <summary>
|
||||
/// An audio recording of a live musical or spoken word performance.
|
||||
/// </summary>
|
||||
LivePerformance,
|
||||
|
||||
/// <summary>
|
||||
/// A recorded conversation where one person asks questions and another provides answers.
|
||||
/// </summary>
|
||||
Interview,
|
||||
|
||||
/// <summary>
|
||||
/// A new performance or recording of a previously released song.
|
||||
/// </summary>
|
||||
Cover,
|
||||
|
||||
/// <summary>
|
||||
/// An alternative version of a recorded song, typically with altered instrumentation or structure.
|
||||
/// </summary>
|
||||
Remix,
|
||||
|
||||
/// <summary>
|
||||
/// An audio recording used to create a specific acoustic environment or impression.
|
||||
/// </summary>
|
||||
Soundeffect,
|
||||
|
||||
/// <summary>
|
||||
/// A digital audio file made available on the internet for downloading to a computer or mobile device.
|
||||
/// </summary>
|
||||
Podcast,
|
||||
|
||||
/// <summary>
|
||||
/// A regularly scheduled broadcast program consisting of music, talk, or other audio content.
|
||||
/// </summary>
|
||||
RadioShow,
|
||||
|
||||
/// <summary>
|
||||
/// A collection of music used as background sound for a movie, TV show, video game, or other media.
|
||||
/// </summary>
|
||||
Soundtrack,
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the various sources of audio ratings.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
namespace Lumina.Presentation.Web.Common.Enums.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for various book formats.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
namespace Lumina.Presentation.Web.Common.Enums.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the various sources of book ratings.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
namespace Lumina.Presentation.Web.Common.Enums.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the different ISBN (International Standard Book Number) formats.
|
||||
@@ -0,0 +1,62 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of written content libraries.
|
||||
/// </summary>
|
||||
public enum WrittenContentType
|
||||
{
|
||||
/// <summary>
|
||||
/// A printed or written literary work.
|
||||
/// </summary>
|
||||
Book,
|
||||
|
||||
/// <summary>
|
||||
/// An electronic version of a printed book.
|
||||
/// </summary>
|
||||
EBook,
|
||||
|
||||
/// <summary>
|
||||
/// A set of related books published in succession.
|
||||
/// </summary>
|
||||
BookSeries,
|
||||
|
||||
/// <summary>
|
||||
/// A magazine or book containing sequential art in the form of a narrative.
|
||||
/// </summary>
|
||||
ComicBook,
|
||||
|
||||
/// <summary>
|
||||
/// A set of related comic books published in succession.
|
||||
/// </summary>
|
||||
ComicSeries,
|
||||
|
||||
/// <summary>
|
||||
/// A periodical publication containing articles, stories, and other content.
|
||||
/// </summary>
|
||||
Magazine,
|
||||
|
||||
/// <summary>
|
||||
/// A style of Japanese comic books and graphic novels.
|
||||
/// </summary>
|
||||
Manga,
|
||||
|
||||
/// <summary>
|
||||
/// A novel in comic-strip format, typically with sophisticated artwork and complex storylines.
|
||||
/// </summary>
|
||||
GraphicNovel,
|
||||
|
||||
/// <summary>
|
||||
/// A scholarly article presenting original research or analysis.
|
||||
/// </summary>
|
||||
AcademicPaper,
|
||||
|
||||
/// <summary>
|
||||
/// A handwritten or printed form of musical notation.
|
||||
/// </summary>
|
||||
SheetMusic,
|
||||
|
||||
/// <summary>
|
||||
/// A script for a film, television program, or other visual media.
|
||||
/// </summary>
|
||||
Screenplay,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of file system elements.
|
||||
/// </summary>
|
||||
public enum FileSystemItemType
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a file system root, which can be a drive on Windows, and a path separator on Unix.
|
||||
/// </summary>
|
||||
Root,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a directory, which is a directory that can contain other directories or files.
|
||||
/// </summary>
|
||||
Directory,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a file, which is a document, executable, or other data stored on the file system.
|
||||
/// </summary>
|
||||
File
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for platform types.
|
||||
/// </summary>
|
||||
public enum PlatformType
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents Unix-based operating systems, including Linux and macOS.
|
||||
/// </summary>
|
||||
Unix,
|
||||
|
||||
/// <summary>
|
||||
/// Represents Microsoft Windows operating systems.
|
||||
/// </summary>
|
||||
Windows,
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.Library;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of libraries.
|
||||
/// </summary>
|
||||
public enum LibraryType
|
||||
{
|
||||
/// <summary>
|
||||
/// Content that is written, such as books, articles, or other written works.
|
||||
/// </summary>
|
||||
WrittenContent,
|
||||
|
||||
/// <summary>
|
||||
/// Content that is video, such as movies, TV shows, or other video works.
|
||||
/// </summary>
|
||||
VideoContent,
|
||||
|
||||
/// <summary>
|
||||
/// Content that is audio, such as podcasts, radio shows, or other audio works.
|
||||
/// </summary>
|
||||
AudioContent,
|
||||
|
||||
/// <summary>
|
||||
/// Content that is visual, such as images, paintings, or other visual works.
|
||||
/// </summary>
|
||||
VisualContent,
|
||||
|
||||
/// <summary>
|
||||
/// Content that is miscellaneous, such as lyrics, movie posters, or other miscellaneous works.
|
||||
/// </summary>
|
||||
MiscellaneousContent,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.Library;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of miscellaneous content libraries.
|
||||
/// </summary>
|
||||
public enum MiscellaneousContentType
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of media that does not fit into any other category.
|
||||
/// </summary>
|
||||
Other,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.PhotoLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of visual content libraries.
|
||||
/// </summary>
|
||||
public enum VisualContentType
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of photographs organized together.
|
||||
/// </summary>
|
||||
PhotoAlbum,
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.VideoLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the types of video content libraries.
|
||||
/// </summary>
|
||||
public enum VideoContentType
|
||||
{
|
||||
/// <summary>
|
||||
/// A series of related episodes broadcast on television or streaming platforms.
|
||||
/// </summary>
|
||||
TvShow,
|
||||
|
||||
/// <summary>
|
||||
/// A feature-length film produced for cinema or home viewing.
|
||||
/// </summary>
|
||||
Movie,
|
||||
|
||||
/// <summary>
|
||||
/// A collection of related films released in succession.
|
||||
/// </summary>
|
||||
FilmSeries,
|
||||
|
||||
/// <summary>
|
||||
/// A collection of related films, TV shows, and other media sharing a fictional universe.
|
||||
/// </summary>
|
||||
FilmFranchise,
|
||||
|
||||
/// <summary>
|
||||
/// A live musical performance recorded on video.
|
||||
/// </summary>
|
||||
Concert,
|
||||
|
||||
/// <summary>
|
||||
/// A non-fictional film or TV program presenting facts and information about a specific subject.
|
||||
/// </summary>
|
||||
Documentary,
|
||||
|
||||
/// <summary>
|
||||
/// An instructional video designed to teach a skill or provide information on a specific topic.
|
||||
/// </summary>
|
||||
Tutorial,
|
||||
|
||||
/// <summary>
|
||||
/// Privately recorded videos, often for personal use or sharing with friends and family.
|
||||
/// </summary>
|
||||
Personal,
|
||||
|
||||
/// <summary>
|
||||
/// Japanese animated productions, typically characterized by colorful graphics and vibrant characters.
|
||||
/// </summary>
|
||||
Anime,
|
||||
|
||||
/// <summary>
|
||||
/// Videos hosted on or originating from the YouTube platform.
|
||||
/// </summary>
|
||||
Youtube,
|
||||
|
||||
/// <summary>
|
||||
/// A short video, typically set to music, such as a music video or promotional clip.
|
||||
/// </summary>
|
||||
Videoclip,
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
namespace Lumina.Presentation.Web.Common.Enums.VideoLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the various sources of video ratings.
|
||||
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
using System;
|
||||
using System.Net;
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents written content metadata.
|
||||
/// </summary>
|
||||
public class WrittenContentMetadataDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the title of the media item.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original title of the media item.
|
||||
/// </summary>
|
||||
public string? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional description of the media item.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the release information of the media item.
|
||||
/// </summary>
|
||||
public ReleaseInfoDto? ReleaseInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of genres associated with the media item.
|
||||
/// </summary>
|
||||
public List<GenreDto>? Genres { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of tags associated with the media item.
|
||||
/// </summary>
|
||||
public List<TagDto>? Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional language of the media item.
|
||||
/// </summary>
|
||||
public LanguageInfoDto? Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original language of the media item.
|
||||
/// </summary>
|
||||
public LanguageInfoDto? OriginalLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the publisher of the written content.
|
||||
/// </summary>
|
||||
public string? Publisher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of pages in the written content.
|
||||
/// </summary>
|
||||
public int? PageCount { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+6
-1
@@ -1,9 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get genre information.
|
||||
/// </summary>
|
||||
public class GenreDto
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public class GenreModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
+6
-1
@@ -1,9 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get language information.
|
||||
/// </summary>
|
||||
public class LanguageInfoDto
|
||||
[DebuggerDisplay("{LanguageName}")]
|
||||
public class LanguageInfoModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
@@ -0,0 +1,54 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Model that follows the RFC 7807 standard for problem details in HTTP APIs.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Title} ({Status})")]
|
||||
public class ProblemDetailsModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the URI reference that identifies the problem type.
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a short, human-readable summary of the problem type.
|
||||
/// </summary>
|
||||
[JsonPropertyName("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the HTTP status code generated by the server for this occurrence of the problem.
|
||||
/// </summary>
|
||||
[JsonPropertyName("status")]
|
||||
public int? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a detailed explanation specific to this occurrence of the problem.
|
||||
/// </summary>
|
||||
[JsonPropertyName("detail")]
|
||||
public string? Detail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a URI reference that identifies the specific occurrence of the problem.
|
||||
/// </summary>
|
||||
[JsonPropertyName("instance")]
|
||||
public string? Instance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets additional extension data that may be included with the problem details.
|
||||
/// This allows for including extra, non-standard fields in the problem details.
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, JsonElement>? Extensions { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+6
-1
@@ -1,9 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a rating.
|
||||
/// </summary>
|
||||
public abstract class RatingDto
|
||||
[DebuggerDisplay("{Value}/{MaxValue}")]
|
||||
public abstract class RatingModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
+7
-1
@@ -1,9 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get release information.
|
||||
/// </summary>
|
||||
public class ReleaseInfoDto
|
||||
[DebuggerDisplay("{OriginalReleaseDate}")]
|
||||
public class ReleaseInfoModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
+6
-1
@@ -1,9 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get tag information.
|
||||
/// </summary>
|
||||
public class TagDto
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public class TagModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
@@ -1,8 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Model for deserializing server configuration settings.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{SectionName}")]
|
||||
public class ServerConfigurationModel
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
@@ -10,6 +15,11 @@ public class ServerConfigurationModel
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the remote API server path.
|
||||
/// </summary>
|
||||
public required char ApiVersion { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the remote API server path.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media contributor.
|
||||
/// </summary>
|
||||
public class MediaContributorDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name of the contributor.
|
||||
/// </summary>
|
||||
public MediaContributorNameDto? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the role of the contributor.
|
||||
/// </summary>
|
||||
public MediaContributorRoleDto? Role { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a model for storing binary data (blob).
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{ContentType} (Data.Length)")]
|
||||
public class BlobDataModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the binary data as a byte array.
|
||||
/// </summary>
|
||||
public byte[] Data { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content type (MIME type) of the blob data, such as "image/png" for an image or "application/pdf" for a PDF document.
|
||||
/// </summary>
|
||||
public string ContentType { get; set; } = null!;
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Model for files and directories displayed in custom directory/file browser dialogs.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public class FileSystemItemModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the full path to the file system item.
|
||||
/// </summary>
|
||||
public string? Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the file system element.
|
||||
/// </summary>
|
||||
public FileSystemItemType ItemType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the file extension of the item, if applicable (e.g., ".txt", ".jpg").
|
||||
/// </summary>
|
||||
public string? Extension { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the source path or identifier for the icon representing the file system item.
|
||||
/// </summary>
|
||||
public string? IconSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a friendly name for the file system item, which may be a user-friendly display name.
|
||||
/// </summary>
|
||||
public string? FriendlyName { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Generic file system node.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public class FileSystemTreeNodeModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the full path of the file or directory.
|
||||
/// </summary>
|
||||
public string Path { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the file or directory.
|
||||
/// </summary>
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the item, indicating whether it is a file, directory, or drive.
|
||||
/// </summary>
|
||||
public FileSystemItemType ItemType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the node is expanded.
|
||||
/// </summary>
|
||||
public bool IsExpanded { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the child nodes have been loaded.
|
||||
/// </summary>
|
||||
public bool ChildrenLoaded { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of child nodes.
|
||||
/// </summary>
|
||||
public List<FileSystemTreeNodeModel> Children { get; set; } = [];
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Model containing the file system platform type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{PlatformType}")]
|
||||
public class FileSystemTypeModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the file system platform type.
|
||||
/// </summary>
|
||||
public PlatformType PlatformType { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get book series information.
|
||||
/// Represents a response containing a file system path.
|
||||
/// </summary>
|
||||
public class BookSeriesDto
|
||||
public class PathSegmentModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the title of the book series.
|
||||
/// Gets or sets the returned path.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
public string Path { get; set; } = null!;
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// A model representing a file system path separator.
|
||||
/// </summary>
|
||||
/// <param name="Separator">The system's path separator.</param>
|
||||
[DebuggerDisplay("{Separator}")]
|
||||
public record PathSeparatorModel(
|
||||
string Separator
|
||||
);
|
||||
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.Library;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Libraries;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a library element.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Title}")]
|
||||
public class LibraryModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the library.
|
||||
/// </summary>
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the library.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the library.
|
||||
/// </summary>
|
||||
public LibraryType? LibraryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of directories that contain the library files.
|
||||
/// </summary>
|
||||
public List<string> Paths { get; set; } = [];
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.MediaContributors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media contributor.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public class MediaContributorModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name of the contributor.
|
||||
/// </summary>
|
||||
public MediaContributorNameModel? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the role of the contributor.
|
||||
/// </summary>
|
||||
public MediaContributorRoleModel? Role { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+7
-2
@@ -1,9 +1,14 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.MediaContributors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media contributor name.
|
||||
/// </summary>
|
||||
public class MediaContributorNameDto
|
||||
[DebuggerDisplay("{DisplayName}")]
|
||||
public class MediaContributorNameModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
+7
-2
@@ -1,9 +1,14 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.MediaContributors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media contributor role.
|
||||
/// </summary>
|
||||
public class MediaContributorRoleDto
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public class MediaContributorRoleModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
@@ -1,9 +1,14 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.UI;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an item in a combobox.
|
||||
/// </summary>
|
||||
/// <typeparam name="TValue">The type used for the <see cref="Value"/> property of the item.</typeparam>
|
||||
[DebuggerDisplay("{Text}")]
|
||||
public class ComboboxItem<TValue>
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
@@ -16,5 +21,10 @@ public class ComboboxItem<TValue>
|
||||
/// Gets or sets the value of the item, that is used by the application.
|
||||
/// </summary>
|
||||
public TValue? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the property indicating whether this element can be selected or not.
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
#endregion
|
||||
}
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a book.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Title}")]
|
||||
public class BookModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the Id of the media item.
|
||||
/// </summary>
|
||||
public Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title of the media item.
|
||||
/// </summary>
|
||||
public string Title { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original title of the media item.
|
||||
/// </summary>
|
||||
public string? OriginalTitle { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional description of the media item.
|
||||
/// </summary>
|
||||
public string? Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original release date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? OriginalReleaseDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original release year of the media item.
|
||||
/// This is useful when only the year of original release is known.
|
||||
/// </summary>
|
||||
public int? OriginalReleaseYear { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional re-release or reissue date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? ReReleaseDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional re-release or reissue year of the media item.
|
||||
/// </summary>
|
||||
public int? ReReleaseYear { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional country or region of release.
|
||||
/// </summary>
|
||||
public string? ReleaseCountry { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
|
||||
/// </summary>
|
||||
public string? ReleaseVersion { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ISO 639-1 two-letter language code.
|
||||
/// </summary>
|
||||
public string? LanguageCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full name of the language in English.
|
||||
/// </summary>
|
||||
public string? LanguageName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an optional native name of the language.
|
||||
/// </summary>
|
||||
public string? LanguageNativeName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional ISO 639-1 two-letter original language code.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional full name of the original language in English.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an optional native name of the original language.
|
||||
/// </summary>
|
||||
public string? OriginalLanguageNativeName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of tags associated with the media item.
|
||||
/// </summary>
|
||||
public HashSet<TagModel> Tags { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of genres associated with the media item.
|
||||
/// </summary>
|
||||
public HashSet<GenreModel> Genres { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the publisher of the written content.
|
||||
/// </summary>
|
||||
public string? Publisher { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of pages in the written content.
|
||||
/// </summary>
|
||||
public int? PageCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the format of the book (e.g., Hardcover, Paperback), if applicable.
|
||||
/// </summary>
|
||||
public string Format { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the edition of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? Edition { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the volume or book number in the series, if applicable.
|
||||
/// </summary>
|
||||
public int? VolumeNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the series id, if the book is part of a series.
|
||||
/// </summary>
|
||||
//public Guid? BookSeriesId { get; init; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ASIN (Amazon Standard Identification Number) of the book.
|
||||
/// </summary>
|
||||
public string? ASIN { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Goodreads ID of the book.
|
||||
/// </summary>
|
||||
public string? GoodreadsId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Library of Congress Control Number (LCCN) of the book.
|
||||
/// </summary>
|
||||
public string? LCCN { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OCLC Number (WorldCat identifier) of the book.
|
||||
/// </summary>
|
||||
public string? OCLCNumber { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Open Library ID of the book.
|
||||
/// </summary>
|
||||
public string? OpenLibraryId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LibraryThing ID of the book.
|
||||
/// </summary>
|
||||
public string? LibraryThingId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Google Books ID of the book.
|
||||
/// </summary>
|
||||
public string? GoogleBooksId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Barnes & Noble ID of the book.
|
||||
/// </summary>
|
||||
public string? BarnesAndNobleId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Apple Books ID of the book.
|
||||
/// </summary>
|
||||
public string? AppleBooksId { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of ISBN (International Standard Book Number) of the book.
|
||||
/// </summary>
|
||||
public List<IsbnModel> ISBNs { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of media contributors (actors, directors, etc) starring in this book.
|
||||
/// </summary>
|
||||
//public List<ContributorIdModel> ContributorIds { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of ratings for this book.
|
||||
/// </summary>
|
||||
public List<BookRatingModel> Ratings { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional time and date when the entity was updated.
|
||||
/// </summary>
|
||||
public DateTime? Updated { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+6
-4
@@ -1,18 +1,20 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.BookLibrary;
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
using Lumina.Presentation.Web.Common.Enums;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a book rating.
|
||||
/// </summary>
|
||||
public class BookRatingDto : RatingDto
|
||||
[DebuggerDisplay("{Value}/{MaxValue}")]
|
||||
public class BookRatingModel : RatingModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the optional source of the rating (e.g., "Goodreads", "Amazon").
|
||||
/// Gets or sets the source of the book rating (e.g., a specific website or platform).
|
||||
/// </summary>
|
||||
public BookRatingSource? Source { get; set; }
|
||||
#endregion
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get book series information.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Title}")]
|
||||
public class BookSeriesModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the book series.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+7
-5
@@ -1,22 +1,24 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums;
|
||||
using Lumina.Presentation.Web.Common.Enums.BookLibrary;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get ISBN information.
|
||||
/// </summary>
|
||||
public class IsbnDto
|
||||
[DebuggerDisplay("{Value} ({Format})")]
|
||||
public class IsbnModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the value of the ISBN.
|
||||
/// Gets or sets the ISBN value.
|
||||
/// </summary>
|
||||
public string? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the format of the ISBN.
|
||||
/// Gets or sets the format of the ISBN (e.g., ISBN-10 or ISBN-13).
|
||||
/// </summary>
|
||||
public IsbnFormat? Format { get; set; }
|
||||
#endregion
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.WrittenContentLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Represents written content metadata.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Title}")]
|
||||
public class WrittenContentMetadataModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the written content.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the original title of the written content, if different from the current title.
|
||||
/// </summary>
|
||||
public string? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a brief description or summary of the written content.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release information, including release date and other relevant details.
|
||||
/// </summary>
|
||||
public ReleaseInfoModel? ReleaseInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of genres associated with the written content.
|
||||
/// </summary>
|
||||
public List<GenreModel>? Genres { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of tags that further describe or categorize the written content.
|
||||
/// </summary>
|
||||
public List<TagModel>? Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language in which the written content is written.
|
||||
/// </summary>
|
||||
public LanguageInfoModel? Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the original language of the written content, if it has been translated.
|
||||
/// </summary>
|
||||
public LanguageInfoModel? OriginalLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the publisher of the written content.
|
||||
/// </summary>
|
||||
public string? Publisher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of pages in the written content.
|
||||
/// </summary>
|
||||
public int? PageCount { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.BookLibrary;
|
||||
using Lumina.Presentation.Web.Common.Models.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Models.WrittenContentLibrary;
|
||||
using Lumina.Presentation.Web.Common.Models.WrittenContentLibrary.BookLibrary;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Requests.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to add a book.
|
||||
/// </summary>
|
||||
public class AddBookRequest
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the written content metadata of the book.
|
||||
/// </summary>
|
||||
public WrittenContentMetadataModel? Metadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the format of the book (e.g., Hardcover, Paperback), if applicable.
|
||||
/// </summary>
|
||||
public BookFormat? Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the edition of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? Edition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the volume or book number in the series, if applicable.
|
||||
/// </summary>
|
||||
public int? VolumeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the series name, if the book is part of a series.
|
||||
/// </summary>
|
||||
public BookSeriesModel? Series { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ASIN (Amazon Standard Identification Number) of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? ASIN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Goodreads ID of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? GoodreadsId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Library of Congress Control Number (LCCN) of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? LCCN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the OCLC Number (WorldCat identifier) of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? OCLCNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Open Library ID of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? OpenLibraryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LibraryThing ID of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? LibraryThingId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Google Books ID of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? GoogleBooksId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Barnes & Noble ID of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? BarnesAndNobleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Apple Books ID of the book, if applicable.
|
||||
/// </summary>
|
||||
public string? AppleBooksId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of ISBN (International Standard Book Number) of the book.
|
||||
/// </summary>
|
||||
public List<IsbnModel>? ISBNs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of media contributors (actors, directors, etc) starring in this book.
|
||||
/// </summary>
|
||||
public List<MediaContributorModel>? Contributors { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of ratings for this book.
|
||||
/// </summary>
|
||||
public List<BookRatingModel>? Ratings { get; set; }
|
||||
#endregion
|
||||
}
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Presentation.Web.Common.Validation;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Text.RegularExpressions;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for strings.
|
||||
/// </summary>
|
||||
public static class StringUtilities
|
||||
{
|
||||
#region ================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Splits a camel case string into separate words.
|
||||
/// </summary>
|
||||
/// <param name="input">The string to be split.</param>
|
||||
/// <returns>The split string.</returns>
|
||||
public static string SplitCamelCase(this string input)
|
||||
{
|
||||
return Regex.Replace(input, "([A-Z])", " $1", RegexOptions.Compiled).Trim();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Validation;
|
||||
@@ -8,7 +10,7 @@ namespace Lumina.Presentation.Web.Common.Validation;
|
||||
/// <summary>
|
||||
/// Provides options for fluent validation of a specific options type.
|
||||
/// </summary>
|
||||
/// <typeparam name="TOptions">The type of options being validated</typeparam>
|
||||
/// <typeparam name="TOptions">The type of options being validated.</typeparam>
|
||||
public class FluentValidationOptions<TOptions> : IValidateOptions<TOptions> where TOptions : class
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
|
||||
@@ -18,6 +18,7 @@ public class ServerConfigurationModelValidator : AbstractValidator<ServerConfigu
|
||||
{
|
||||
RuleFor(x => x.BaseAddress).NotEmpty().WithMessage("Base address cannot be empty!");
|
||||
RuleFor(x => x.Port).InclusiveBetween((ushort)0, (ushort)65535).WithMessage("Port number must be between 0 and 65535!");
|
||||
RuleFor(x => x.ApiVersion).InclusiveBetween((char)0, (char)255).WithMessage("API version must be between 0 and 255!");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
@using Lumina.Presentation.Web.Common.Models.UI
|
||||
|
||||
<div id="directory-browser-dialog" class="container-background above-modal">
|
||||
<div id="directory-browser-content">
|
||||
<div id="directory-browser-header">
|
||||
<div id="directory-browser-shine-spark"></div>
|
||||
<div id="directory-browser-shine-effect"></div>
|
||||
<div id="directory-browser-header-navigation-container">
|
||||
<div class="directory-browser-header-navigation">
|
||||
<img src="images/ui/back.svg" class="navigation-icon" alt="Back" title="Back"/>
|
||||
<img src="images/ui/forward.svg" class="navigation-icon" alt="Forward" title="Forward" />
|
||||
<img src="images/ui/up.svg" class="navigation-icon" alt="Up one level" title="Up one level" />
|
||||
</div>
|
||||
<div id="directory-browser-header-address-bar-container">
|
||||
<EnlightenmentInput CssClass="directory-browser-header-address-bar-url" Type="text" Name="addressBar" Height="22" AutoComplete="true" />
|
||||
<div class="directory-browser-header-address-bar-actions">
|
||||
<img src="images/ui/favorite-star.svg" class="navigation-icon favorite-unselected" alt="Favorite directory" title="Favorite directory" />
|
||||
<EnlightenmentButton CssClass="directory-browser-content-new-directory" Width="120">New Directory</EnlightenmentButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="directory-browser-file-system-container">
|
||||
<div id="directory-browser-file-system-treeview-container">
|
||||
<div id="directory-browser-file-system-treeview">
|
||||
<FileSystemTreeView InitialPath="@savedPath" OnNodeSelected="HandleNodeSelected" />
|
||||
</div>
|
||||
<EnlightenmentCombobox CssClass="directory-browser-file-system-sources" Items="null" @bind-SelectedItem="selectedValue" />
|
||||
</div>
|
||||
<div id="directory-browser-file-system-directories-container">
|
||||
<div id="directory-browser-file-system-directories"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="directory-browser-actions-container">
|
||||
<div id="directory-browser-actions-path-container">
|
||||
<label class="text-light-one">Directory</label>
|
||||
<EnlightenmentInput Type="text" Name="selectedDirectory" IsReadOnly="true" AutoComplete="true" />
|
||||
</div>
|
||||
<div id="directory-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>
|
||||
|
||||
@code {
|
||||
private ComboboxItem<string>? selectedValue;
|
||||
private string savedPath = string.Empty;
|
||||
|
||||
private void HandleNodeSelected(string path)
|
||||
{
|
||||
Console.WriteLine($"Selected node: {path}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
#directory-browser-dialog {
|
||||
position: absolute;
|
||||
top: 12.5%;
|
||||
bottom: 12.5%;
|
||||
left: 10%;
|
||||
right: 10%;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--border-color-dialog);
|
||||
}
|
||||
|
||||
#directory-browser-content {
|
||||
margin: 0px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
gap: 0px;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
#directory-browser-header {
|
||||
border-radius: 5px 5px 0 0;
|
||||
border: 1px solid;
|
||||
background: linear-gradient(to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100%);
|
||||
border-color: var(--border-color-light) var(--border-color-dark) var(--border-color-dark) var(--border-color-light);
|
||||
height: 40px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: stretch;
|
||||
justify-content: flex-start;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#directory-browser-header-navigation-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
gap: 5px;
|
||||
flex-grow: 1;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
#directory-browser-header-address-bar-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
gap: 5px;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.directory-browser-header-address-bar-url {
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
::deep .directory-browser-content-new-directory {
|
||||
min-width: 120px;
|
||||
flex-basis: 120px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.navigation-icon {
|
||||
width: 20px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.navigation-icon.disabled {
|
||||
opacity: 0.7;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.directory-browser-header-navigation {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.directory-browser-header-address-bar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.favorite-unselected {
|
||||
filter: grayscale(100%) opacity(50%);
|
||||
}
|
||||
|
||||
.favorite-unselected, .favorite-selected {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
transition: filter 0.3s ease;
|
||||
}
|
||||
|
||||
#directory-browser-file-system-container {
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: stretch;
|
||||
overflow: hidden;
|
||||
gap: 0px;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
#directory-browser-file-system-treeview-container {
|
||||
background-color: #131313;
|
||||
border-top: 1px solid var(--border-color-light);
|
||||
border-left: 1px solid var(--border-color-light);
|
||||
border-right: 1px solid var(--border-color-dark);
|
||||
min-width: 170px;
|
||||
max-width: 400px;
|
||||
width: 400px;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
flex-grow: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
gap: 0px;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
#directory-browser-file-system-treeview {
|
||||
background-color: #131313;
|
||||
border: 1px solid var(--border-color-light);
|
||||
border-top: 1px solid var(--border-color-dark);
|
||||
border-left: 1px solid var(--border-color-dark);
|
||||
margin-bottom: 10px;
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
box-shadow: inset 2px 2px 5px var(--shadow-color);
|
||||
overflow: auto;
|
||||
max-height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
::deep .directory-browser-file-system-sources {
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
#directory-browser-file-system-directories-container {
|
||||
background-color: #131313;
|
||||
border-top: 1px solid var(--border-color-light);
|
||||
border-left: 1px solid var(--border-color-light-medium);
|
||||
flex-grow: 1;
|
||||
min-width: 135px;
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#directory-browser-file-system-directories {
|
||||
background-color: #262626;
|
||||
border: 1px solid var(--border-color-light);
|
||||
border-top: 1px solid var(--border-color-dark);
|
||||
border-left: 1px solid var(--border-color-dark);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: inset 2px 2px 5px var(--shadow-color);
|
||||
}
|
||||
|
||||
#directory-browser-actions-container {
|
||||
flex-grow: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: flex-start;
|
||||
align-content: center;
|
||||
gap: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#directory-browser-actions {
|
||||
flex-grow: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-end;
|
||||
gap: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#directory-browser-actions-path-container {
|
||||
margin-top: 5px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#directory-browser-shine-effect {
|
||||
background: linear-gradient(to right, transparent, #fff, transparent);
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
flex-shrink: 0;
|
||||
pointer-events: none; /* ensure it doesn't interfere with interactions */
|
||||
}
|
||||
|
||||
#directory-browser-shine-spark {
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
left: -20px; /* start off-screen */
|
||||
width: 20px;
|
||||
height: 5px;
|
||||
background: radial-gradient(ellipse at center, rgba(255,255,255,1) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%);
|
||||
border-radius: 50%;
|
||||
filter: blur(1px);
|
||||
opacity: 0;
|
||||
animation: spark-animation 30s cubic-bezier(0.25, 0.9, 0.9, 0.1) infinite;
|
||||
}
|
||||
|
||||
#directory-browser-shine-spark::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: white;
|
||||
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
|
||||
transform: translate(-50%, -50%);
|
||||
filter: blur(0.5px);
|
||||
animation: star-rotation 5s linear infinite;
|
||||
}
|
||||
|
||||
#directory-browser-shine-spark::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@keyframes spark-animation {
|
||||
40% {
|
||||
left: -20px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
60% {
|
||||
left: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes star-rotation {
|
||||
from {
|
||||
transform: translate(-50%, -50%) rotate(0deg);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translate(-50%, -50%) rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
#directory-browser-header {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#directory-browser-header-navigation-container {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
#directory-browser-header-address-bar-container {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.directory-browser-header-address-bar-url {
|
||||
width: 100%;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.directory-browser-header-navigation {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.directory-browser-header-address-bar-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::deep .directory-browser-content-new-directory {
|
||||
min-width: 0;
|
||||
flex-basis: auto;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,18 @@
|
||||
<button type="submit" class="@(IsConfirmButton ? "confirm" : "abort")-button f-16 w-100px @CssClass" @onclick="OnClick" disabled="@IsDisabled">@ChildContent</button>
|
||||
<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; }
|
||||
}
|
||||
@@ -22,6 +22,6 @@
|
||||
private async Task OnChangeHandler(ChangeEventArgs e)
|
||||
{
|
||||
Checked = e?.Value != null ? (bool)e.Value : false;
|
||||
await CheckedChanged.InvokeAsync(Checked);
|
||||
await CheckedChanged.InvokeAsync(Checked).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -6,21 +6,22 @@
|
||||
@implements IDisposable
|
||||
|
||||
@inject ComboboxService _comboboxService
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<div class="enlightenment-combobox inline-block w-100 @(IsOpen ? "open" : string.Empty) @CssClass">
|
||||
<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="@Id" @onclick="ToggleDropdown">
|
||||
<label class="enlightenment-toggle" for="@Id">
|
||||
<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" @onclick="() => SelectItem(null)">No item selected</div>
|
||||
<div class="enlightenment-item first-item disabled italic" @onclick="() => SelectItem(null)">No item selected</div>
|
||||
|
||||
@for (int i = 0; i < Items.Count; i++)
|
||||
@for (int i = 0; i < Items?.Count; i++)
|
||||
{
|
||||
var item = Items[i];
|
||||
var cssClass = $"enlightenment-item {(i == Items.Count - 1 ? "last-item" : string.Empty)}";
|
||||
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>
|
||||
@@ -33,7 +34,7 @@
|
||||
[Parameter] public string? CssClass { get; set; }
|
||||
|
||||
private bool IsOpen { get; set; }
|
||||
private string Id { get; set; } = $"combobox_{Guid.NewGuid()}";
|
||||
private Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component.
|
||||
@@ -46,11 +47,14 @@
|
||||
/// <summary>
|
||||
/// Toggles the dropdown state.
|
||||
/// </summary>
|
||||
private void ToggleDropdown()
|
||||
private async Task ToggleDropdownAsync()
|
||||
{
|
||||
IsOpen = !IsOpen;
|
||||
if (IsOpen)
|
||||
_comboboxService.NotifyComboboxOpened(Id);
|
||||
{
|
||||
_comboboxService.NotifyComboboxOpened("combobox_checkbox_" + Id);
|
||||
await JSRuntime.InvokeVoidAsync("adjustDropdownHeight", "combobox_" + Id).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -59,7 +63,7 @@
|
||||
/// <param name="openedId">The optional id of the combobox that initiated the dropdown state change.</param>
|
||||
private void CloseIfNotThis(string? openedId)
|
||||
{
|
||||
if (openedId != Id && IsOpen)
|
||||
if (openedId != "combobox_checkbox_" + Id && IsOpen)
|
||||
{
|
||||
IsOpen = false;
|
||||
StateHasChanged();
|
||||
@@ -74,7 +78,7 @@
|
||||
{
|
||||
SelectedItem = item;
|
||||
IsOpen = false;
|
||||
await SelectedItemChanged.InvokeAsync(item);
|
||||
await SelectedItemChanged.InvokeAsync(item).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -66,6 +66,8 @@
|
||||
border-right: #202020 1px solid;
|
||||
padding: 3px;
|
||||
z-index: 999;
|
||||
max-height: none;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.enlightenment-dropdown > .shine-effect:first-child {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<input type="@Type"
|
||||
class="enlightenment-input w-100 @CssClass"
|
||||
style="width: @($"{Width}{(UsesPercentForWidth ? "%" : "px")}"); height: @($"{Height}{(UsesPercentForHeight ? "%" : "px")}");"
|
||||
class="enlightenment-input @CssClass"
|
||||
name="@Name"
|
||||
autocomplete="@(AutoComplete ? "on" : "off")"
|
||||
value="@Value"
|
||||
@@ -11,6 +12,10 @@
|
||||
|
||||
@code {
|
||||
[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;
|
||||
@@ -28,6 +33,6 @@
|
||||
private async Task OnInputHandlerAsync(ChangeEventArgs e)
|
||||
{
|
||||
Value = e.Value?.ToString();
|
||||
await ValueChanged.InvokeAsync(Value);
|
||||
await ValueChanged.InvokeAsync(Value).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
font-size: 14px;
|
||||
padding: 5px;
|
||||
border: 1px solid;
|
||||
border-color: var(--border-unlit) var(--border-lit) var(--border-lit) var(--border-unlit);
|
||||
border-color: var(--border-color-dark) var(--border-color-light) var(--border-color-light) var(--border-color-dark);
|
||||
border-radius: 3px;
|
||||
background: linear-gradient(0deg, #90c247, #509c00);
|
||||
transition: background 0.3s, color 0.3s;
|
||||
@@ -26,7 +26,7 @@
|
||||
color: #333;
|
||||
background: linear-gradient(0deg, #6AAFF8, #82E9F7);
|
||||
box-shadow: inset 4px 6px 8px rgba(0,0,0,0.6);
|
||||
border-color: var(--border-unlit) var(--border-lit) var(--border-lit) var(--border-unlit);
|
||||
border-color: var(--border-color-dark) var(--border-color-light) var(--border-color-light) var(--border-color-dark);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@@ -36,12 +36,13 @@
|
||||
|
||||
.enlightenment-input:disabled {
|
||||
color: #999;
|
||||
background: var(--window-back-color);
|
||||
background: var(--container-background);
|
||||
}
|
||||
|
||||
.enlightenment-input[readonly] {
|
||||
color: #999;
|
||||
background: var(--window-back-color);
|
||||
background: var(--container-background);
|
||||
border-color: var(--border-color-light) var(--border-color-dark) var(--border-color-dark) var(--border-color-light);
|
||||
}
|
||||
|
||||
.enlightenment-input[data-has-error="true"] {
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
@using System.Collections.Generic
|
||||
@using Lumina.Presentation.Web.Common.Api
|
||||
@using Lumina.Presentation.Web.Common.Enums
|
||||
@using Lumina.Presentation.Web.Common.Enums.FileSystem
|
||||
@using Lumina.Presentation.Web.Common.Models.FileManagement
|
||||
|
||||
@inject IApiHttpClient _apiHttpClient
|
||||
|
||||
<div class="treeview">
|
||||
@foreach (FileSystemTreeNodeModel node in RootNodes)
|
||||
{
|
||||
<FileSystemTreeViewNode Node="node" OnExpand="ExpandNode" OnNodeSelected="HandleNodeSelected" SelectedNodePath="@SelectedNodePath" />
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public string? InitialPath { get; set; }
|
||||
[Parameter] public List<FileSystemTreeNodeModel> RootNodes { get; set; } = new List<FileSystemTreeNodeModel>();
|
||||
[Parameter] public EventCallback<string> OnNodeSelected { get; set; }
|
||||
|
||||
private string? SelectedNodePath { get; set; }
|
||||
private string PathSeparator { get; set; } = "/";
|
||||
private FileSystemTypeModel fileSystemType = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component.
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
fileSystemType = await _apiHttpClient.GetAsync<FileSystemTypeModel>("file-system/get-type").ConfigureAwait(false);
|
||||
// ask the API server for the system path separator
|
||||
PathSeparatorModel pathSeparator = await _apiHttpClient.GetAsync<PathSeparatorModel>("path/get-path-separator").ConfigureAwait(false);
|
||||
PathSeparator = pathSeparator.Separator; // TODO: handle error
|
||||
// on Windows, ask the list of drives
|
||||
if (fileSystemType.PlatformType == PlatformType.Windows)
|
||||
{
|
||||
List<FileSystemTreeNodeModel> drives = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>("drives/get-drives").ConfigureAwait(false);
|
||||
RootNodes.AddRange(drives);
|
||||
}
|
||||
else
|
||||
{
|
||||
// on UNIX, just add the root "/"
|
||||
RootNodes.Add(new FileSystemTreeNodeModel()
|
||||
{
|
||||
Path = pathSeparator.Separator,
|
||||
IsExpanded = true,
|
||||
ItemType = FileSystemItemType.Root,
|
||||
Name = pathSeparator.Separator
|
||||
});
|
||||
}
|
||||
// if there was an initial path saved from a previous session, load the full tree up to that initial path
|
||||
if (InitialPath is not null)
|
||||
{
|
||||
// ask the whole tree for the saved path
|
||||
List<FileSystemTreeNodeModel> initialTree = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"directories/get-directory-tree?path={Uri.EscapeDataString(InitialPath)}").ConfigureAwait(false);
|
||||
if (initialTree is not null && initialTree.Count > 0)
|
||||
{
|
||||
// take the root of the retrieved tree, and try to match it against a drive in the retrieved list of drives, on Windows; on Unix, add it as the unique root path
|
||||
PathSegmentModel pathRoot = await _apiHttpClient.GetAsync<PathSegmentModel>($"path/get-path-root?path={Uri.EscapeDataString(InitialPath)}").ConfigureAwait(false);
|
||||
if (fileSystemType.PlatformType == PlatformType.Windows)
|
||||
{
|
||||
FileSystemTreeNodeModel? driveNode = RootNodes.FirstOrDefault(drive => drive.Path.Equals(pathRoot.Path, StringComparison.OrdinalIgnoreCase));
|
||||
// if a drive was matched, make the retrieved tree a child of it
|
||||
if (driveNode is not null)
|
||||
{
|
||||
int index = RootNodes.IndexOf(driveNode);
|
||||
RootNodes[index] = initialTree[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
RootNodes[0] = initialTree[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expands or collapses a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="node">The node to expand or collapse.</param>
|
||||
private async Task ExpandNode(FileSystemTreeNodeModel node)
|
||||
{
|
||||
if (!node.IsExpanded && !node.ChildrenLoaded)
|
||||
{
|
||||
node.Children = new List<FileSystemTreeNodeModel>();
|
||||
node.IsExpanded = true;
|
||||
StateHasChanged();
|
||||
try
|
||||
{
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"directories/get-directories?path={Uri.EscapeDataString(node.Path)}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
await foreach (FileSystemTreeNodeModel? childNode in _apiHttpClient.GetAsyncEnumerable<FileSystemTreeNodeModel>($"files/get-files?path={Uri.EscapeDataString(node.Path)}").ConfigureAwait(false))
|
||||
{
|
||||
if (childNode is not null)
|
||||
{
|
||||
node.Children.Add(childNode);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"Error expanding node: {ex.Message}"); // TODO: display to the user when notification system is implemented
|
||||
}
|
||||
finally
|
||||
{
|
||||
node.ChildrenLoaded = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
node.IsExpanded = !node.IsExpanded;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the child nodes for a given path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to get child nodes for.</param>
|
||||
/// <returns>A list of <see cref="FileSystemTreeNodeModel"/> representing the child nodes.</returns>
|
||||
private async Task<List<FileSystemTreeNodeModel>> GetChildNodes(string path)
|
||||
{
|
||||
List<FileSystemTreeNodeModel> directories = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"directories/get-directories?path={Uri.EscapeDataString(path)}").ConfigureAwait(false);
|
||||
List<FileSystemTreeNodeModel> files = await _apiHttpClient.GetAsync<List<FileSystemTreeNodeModel>>($"files/get-files?path={Uri.EscapeDataString(path)}").ConfigureAwait(false);
|
||||
directories.AddRange(files);
|
||||
return directories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the selection of a node in the tree view.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the selected node.</param>
|
||||
private async Task HandleNodeSelected(string path)
|
||||
{
|
||||
SelectedNodePath = path;
|
||||
await OnNodeSelected.InvokeAsync(path).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
@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" OnExpand="OnExpand" OnNodeSelected="OnNodeSelected" SelectedNodePath="@SelectedNodePath" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public FileSystemTreeNodeModel Node { get; set; } = null!;
|
||||
[Parameter] public EventCallback<FileSystemTreeNodeModel> OnExpand { 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 OnExpand.InvokeAsync(Node).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the click event on the node.
|
||||
/// </summary>
|
||||
private async Task HandleNodeClick()
|
||||
{
|
||||
await OnNodeSelected.InvokeAsync(Node.Path).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <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 => "📄",
|
||||
_ => "❓"
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
.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 {
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
.node-content {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
cursor: pointer;
|
||||
padding: 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid transparent;
|
||||
flex-wrap: wrap;
|
||||
min-width: 100%;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.node-content:hover {
|
||||
background-color: #131313;
|
||||
border-top: 1px solid var(--border-color-light);
|
||||
border-left: 1px solid var(--border-color-light);
|
||||
border-right: 1px solid var(--border-color-dark);
|
||||
background-color: var(--container-background);
|
||||
}
|
||||
|
||||
.node-content.selected {
|
||||
background-color: #131313;
|
||||
border-bottom: 1px solid var(--border-color-light);
|
||||
border-right: 1px solid var(--border-color-light);
|
||||
border-left: 1px solid var(--border-color-dark);
|
||||
background-color: var(--container-background);
|
||||
}
|
||||
|
||||
.node-icon {
|
||||
margin-right: 5px;
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.node-icon, .expand-button {
|
||||
flex-shrink: 0;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.child-nodes {
|
||||
padding-left: 20px;
|
||||
border-left: 1px dotted #ccc;
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.expand-button {
|
||||
display: inline-flex;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-right: 5px;
|
||||
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%231E90FF' d='M6 4l4 4-4 4z'/></svg>");
|
||||
background-size: contain;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.expand-button.expanded {
|
||||
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%23f00' d='M6 4l4 4-4 4z'/></svg>");
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.spacer {
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
.node-name {
|
||||
margin-left: 3px;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-all;
|
||||
flex: 1;
|
||||
align-self: end;
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
namespace Lumina.Presentation.Web.Core.Services.UI;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Services.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Service for managing comboboxes.
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
Library
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="library/management/libraries"><span>Manage libraries</span></a></li>
|
||||
<li><a href="library/management/library"><span>Add media library</span></a></li>
|
||||
<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
|
||||
@@ -81,8 +81,8 @@
|
||||
<input type="radio" id="library-menu" name="menu">
|
||||
<label for="library-menu">Library</label>
|
||||
<ul>
|
||||
<li tabindex="0"><a href="library/management/libraries">Manage libraries</a></li>
|
||||
<li tabindex="0"><a href="library/management/library">Add new library</a></li>
|
||||
<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>
|
||||
|
||||
@@ -181,6 +181,11 @@
|
||||
.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 {
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<BaseOutputPath>..\..\bin\</BaseOutputPath>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<BaseOutputPath>$(SolutionDir)..\bin\client\</BaseOutputPath>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyInfo_Shared.cs" Link="Properties\AssemblyInfo_Shared.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
@page "/"
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
@using Lumina.Presentation.Web.Components
|
||||
|
||||
<PageTitle>Lumina - Home</PageTitle>
|
||||
|
||||
<DirectoryBrowserComponent />
|
||||
@@ -0,0 +1,90 @@
|
||||
@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 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
@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");
|
||||
}
|
||||
|
||||
private async Task CancelOperation()
|
||||
{
|
||||
isCancelling = true;
|
||||
// Perform cancel operation
|
||||
isCancelling = false;
|
||||
Console.WriteLine("cancelled");
|
||||
}
|
||||
|
||||
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
@@ -0,0 +1,7 @@
|
||||
@page "/library/written-content/books-library/books"
|
||||
|
||||
<h3>Books</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
@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,9 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Lumina.Presentation.Web.Common.DependencyInjection;
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Application.Common.Models.FileSystem;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web;
|
||||
@@ -32,7 +31,7 @@ public class Program
|
||||
|
||||
var webAssemblyHost = builder.Build();
|
||||
|
||||
await webAssemblyHost.RunAsync();
|
||||
await webAssemblyHost.RunAsync().ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"ServerConfiguration": {
|
||||
"BaseAddress": "https://localhost",
|
||||
"Port": 7057
|
||||
"ApiVersion": 1,
|
||||
"BaseAddress": "http://localhost",
|
||||
"Port": 5214
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
:root {
|
||||
--background-color: #222;
|
||||
--border-color-light: #777777;
|
||||
--container-background: #232323;
|
||||
--border-color-light: #363636;
|
||||
--border-color-light-medium: #555555;
|
||||
--border-color-light-high: #777777;
|
||||
--border-color-dark: #000000;
|
||||
--border-color-dialog: #1E90FF;
|
||||
--shadow-color: #000000;
|
||||
--text-foreground: #6DCBFE;
|
||||
}
|
||||
|
||||
html,
|
||||
@@ -35,7 +41,7 @@ body {
|
||||
#page {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: var(--border-color-light) var(--border-color-dark) var(--border-color-dark) var(--border-color-light);
|
||||
border-color: var(--border-color-light-high) var(--border-color-dark) var(--border-color-dark) var(--border-color-light-high);
|
||||
background-color: #222;
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
@@ -45,6 +51,21 @@ main {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
#modal-background {
|
||||
z-index: 998;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
background-color: #000000;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.above-modal {
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.shine-effect {
|
||||
position: relative;
|
||||
top: -11px;
|
||||
@@ -61,7 +82,7 @@ main {
|
||||
|
||||
.enlightenment-panel {
|
||||
border-radius: 5px;
|
||||
background: linear-gradient(135deg, #404040, #232323);
|
||||
background: linear-gradient(135deg, #404040, var(--container-background));
|
||||
border-top: 1px solid #505050;
|
||||
border-left: 1px solid #505050;
|
||||
border-right: 1px solid #000;
|
||||
@@ -69,8 +90,8 @@ main {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||
.container-background {
|
||||
background-color: var(--container-background);
|
||||
}
|
||||
|
||||
.panel {
|
||||
@@ -1146,6 +1167,14 @@ main {
|
||||
font-size: 24px !important;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"> -->
|
||||
<!-- <defs> -->
|
||||
<!-- <radialGradient id="circleGradient" cx="25%" cy="25%" r="75%" fx="30%" fy="15%"> -->
|
||||
<!-- <stop offset="0%" stop-color="#C1D0E5"/> -->
|
||||
<!-- <stop offset="100%" stop-color="#006CBE"/> -->
|
||||
<!-- </radialGradient> -->
|
||||
<!-- </defs> -->
|
||||
<!-- <circle cx="150" cy="150" r="150" fill="url(#circleGradient)" /> -->
|
||||
<!-- <path d="M180 75 L100 150 L180 225" fill="none" stroke="#FFFFFF" stroke-width="30" stroke-linecap="round" stroke-linejoin="round"/> -->
|
||||
<!-- </svg> -->
|
||||
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300">
|
||||
<defs>
|
||||
<radialGradient id="baseGradient" cx="10%" cy="10%" r="100%" fx="20%" fy="5%">
|
||||
<stop offset="0%" stop-color="#76AD7D" stop-opacity="0.1"/>
|
||||
<stop offset="50%" stop-color="#006B0E" stop-opacity="1"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="highlightGradient" cx="75%" cy="95%" r="100%" fx="80%" fy="80%">
|
||||
<stop offset="0%" stop-color="#91EF86" stop-opacity="0.9"/>
|
||||
<stop offset="64%" stop-color="#54AC5F" stop-opacity="0.1"/>
|
||||
<stop offset="65%" stop-color="#FFFFFF" stop-opacity="0.3"/>
|
||||
<stop offset="100%" stop-color="#54AC5F" stop-opacity="0.3"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="refractionGradient" cx="75%" cy="75%" r="50%">
|
||||
<stop offset="0%" stop-color="#FFFFFF" stop-opacity="0.3"/>
|
||||
<stop offset="100%" stop-color="transparent" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<circle cx="150" cy="150" r="150" fill="url(#baseGradient)" />
|
||||
<circle cx="150" cy="150" r="150" fill="url(#highlightGradient)" />
|
||||
<circle cx="150" cy="150" r="150" fill="url(#refractionGradient)" />
|
||||
<path d="M180 75 L100 150 L180 225" fill="none" stroke="#FFFFFF" stroke-width="30" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,17 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
|
||||
<defs>
|
||||
<linearGradient id="starGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#ffd700;stop-opacity:1" />
|
||||
<stop offset="100%" style="stop-color:#ffaa00;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<filter id="innerShadow" x="-20%" y="-20%" width="140%" height="140%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="3" result="blur"/>
|
||||
<feOffset dx="2" dy="2"/>
|
||||
<feComposite in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowDiff"/>
|
||||
<feFlood flood-color="#000000" flood-opacity="0.75"/>
|
||||
<feComposite in2="shadowDiff" operator="in"/>
|
||||
<feComposite in2="SourceGraphic" operator="over"/>
|
||||
</filter>
|
||||
</defs>
|
||||
<path d="M50,0 L63,38 H100 L69,61 L81,100 L50,76 L19,100 L31,61 L0,38 H37 Z" fill="url(#starGradient)" filter="url(#innerShadow)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 942 B |
@@ -0,0 +1,22 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300">
|
||||
<defs>
|
||||
<radialGradient id="baseGradient" cx="10%" cy="10%" r="100%" fx="20%" fy="5%">
|
||||
<stop offset="0%" stop-color="#76AD7D" stop-opacity="0.1"/>
|
||||
<stop offset="50%" stop-color="#006B0E" stop-opacity="1"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="highlightGradient" cx="75%" cy="95%" r="100%" fx="80%" fy="80%">
|
||||
<stop offset="0%" stop-color="#91EF86" stop-opacity="0.9"/>
|
||||
<stop offset="64%" stop-color="#54AC5F" stop-opacity="0.1"/>
|
||||
<stop offset="65%" stop-color="#FFFFFF" stop-opacity="0.3"/>
|
||||
<stop offset="100%" stop-color="#54AC5F" stop-opacity="0.3"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="refractionGradient" cx="75%" cy="75%" r="50%">
|
||||
<stop offset="0%" stop-color="#FFFFFF" stop-opacity="0.3"/>
|
||||
<stop offset="100%" stop-color="transparent" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<circle cx="150" cy="150" r="150" fill="url(#baseGradient)" />
|
||||
<circle cx="150" cy="150" r="150" fill="url(#highlightGradient)" />
|
||||
<circle cx="150" cy="150" r="150" fill="url(#refractionGradient)" />
|
||||
<path d="M120 75 L200 150 L120 225" fill="none" stroke="#FFFFFF" stroke-width="30" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,22 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300">
|
||||
<defs>
|
||||
<radialGradient id="baseGradient" cx="10%" cy="10%" r="100%" fx="20%" fy="5%">
|
||||
<stop offset="0%" stop-color="#76AD7D" stop-opacity="0.1"/>
|
||||
<stop offset="50%" stop-color="#006B0E" stop-opacity="1"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="highlightGradient" cx="75%" cy="95%" r="100%" fx="80%" fy="80%">
|
||||
<stop offset="0%" stop-color="#91EF86" stop-opacity="0.9"/>
|
||||
<stop offset="64%" stop-color="#54AC5F" stop-opacity="0.1"/>
|
||||
<stop offset="65%" stop-color="#FFFFFF" stop-opacity="0.3"/>
|
||||
<stop offset="100%" stop-color="#54AC5F" stop-opacity="0.3"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="refractionGradient" cx="75%" cy="75%" r="50%">
|
||||
<stop offset="0%" stop-color="#FFFFFF" stop-opacity="0.3"/>
|
||||
<stop offset="100%" stop-color="transparent" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<circle cx="150" cy="150" r="150" fill="url(#baseGradient)" />
|
||||
<circle cx="150" cy="150" r="150" fill="url(#highlightGradient)" />
|
||||
<circle cx="150" cy="150" r="150" fill="url(#refractionGradient)" />
|
||||
<path d="M75 180 L150 100 L225 180" fill="none" stroke="#FFFFFF" stroke-width="30" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Lumina.Presentation.Web</title>
|
||||
<title>Lumina</title>
|
||||
<base href="/" />
|
||||
<link rel="stylesheet" href="css/blazor.css" />
|
||||
<link rel="stylesheet" href="css/site.css" />
|
||||
@@ -20,13 +20,15 @@
|
||||
</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>
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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) {
|
||||
const combobox = document.getElementById(comboboxId);
|
||||
const dropdown = combobox.querySelector('.enlightenment-dropdown');
|
||||
// get the bounds of the combobox and the height of the viewport
|
||||
const comboboxRect = combobox.getBoundingClientRect();
|
||||
const viewportHeight = window.innerHeight;
|
||||
// calculate the space available between the combobox and the bottom of the viewport, with a 10px margin
|
||||
const dropdownTopPosition = comboboxRect.top + comboboxRect.height;
|
||||
const availableSpace = viewportHeight - dropdownTopPosition - 10; // 10px margin
|
||||
dropdown.style.maxHeight = `${availableSpace}px`;
|
||||
}
|
||||
|
||||
window.showDirectoryPicker = async () => {
|
||||
try {
|
||||
const dirHandle = await window.showDirectoryPicker().ConfigureAwait(false);
|
||||
return dirHandle.name;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user