Initial commit - MassTech UI

This commit is contained in:
2026-08-05 21:15:18 +03:00
commit 866d22ebbc
5337 changed files with 510980 additions and 0 deletions
+158
View File
@@ -0,0 +1,158 @@
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor;
using MudBlazor.Services;
using UI.Components;
using UI.Config.Register;
using SoloX.BlazorJsonLocalization;
using System.Globalization;
using ECommerceModule;
using Microsoft.JSInterop;
using UI.Config.PostBuild;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// builder.Services.AddScoped<HttpClient>(sp =>
// new HttpClient
// {
// BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
// });
builder.Services.AddSingleton(new Uri(builder.HostEnvironment.BaseAddress));
builder.Services.RegLocalization("http://localhost:2004/");
builder.Services.RegisterServices(builder.Configuration);
builder.Services.AddMudServices(config =>
{
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft;
config.SnackbarConfiguration.PreventDuplicates = false;
config.SnackbarConfiguration.NewestOnTop = false;
config.SnackbarConfiguration.ShowCloseIcon = true;
config.SnackbarConfiguration.VisibleStateDuration = 3000;
config.SnackbarConfiguration.HideTransitionDuration = 500;
config.SnackbarConfiguration.ShowTransitionDuration = 500;
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
});
builder.Services.AddAuthorizationCore();
builder.Services.AddBlazoredLocalStorage();
var host = builder.Build();
await host.Services.RetriveCulture();
await host.Services.LoadTranslations();
await host.RunAsync();
// builder.Services.AddScoped(sp => new HttpClient
// {
// BaseAddress = new Uri("http://localhost:5211/api/v1/"),
// });
// builder.Services.AddJsonLocalization(
// options =>
// {
// // Embedded JSON (en-US)
// options.UseEmbeddedJson(embeddedOptions =>
// {
// embeddedOptions.ResourcesPath = "Resources";
// });
// // HTTP JSON (fr-FR, es-ES, etc.)
// options.UseHttpClientJson(httpOptions =>
// {
// httpOptions.ApplicationAssembly = typeof(AuthModule.SharedRes).Assembly;
// httpOptions.ResourcesPath = "_content/AuthModule/Resources";
// });
// });
// Configure for a specific assembly
// builder.Services.AddJsonLocalization(
// builder =>
// {
// builder.UseEmbeddedJson(
// options =>
// {
// options.ResourcesPath = "Resources";
// // The assembly is specified HERE, not via AddAssembly
// options.Assemblies = new [] {assembly};
// });
// // For HTTP loading:
// builder.UseHttpClientJson(
// options =>
// {
// options.ResourcesPath = "_content/AuthModule/Resources";
// options.ApplicationAssembly = assembly;
// });
// });
// var assembly = typeof(SharedRes).Assembly;
// builder.Services.AddHttpClient(
// "Host",
// c =>
// {
// // var hostEnv = sp.GetRequiredService<IWebAssemblyHostEnvironment>();
// c.BaseAddress = new Uri("http://localhost:2004/");
// });
// builder.Services.AddJsonLocalization(b =>
// {
// b.EnableLogger()
// .UseHttpClientJson(options =>
// {
// options.ResourcesPath = "_content/AuthModule/Resources";
// options.ApplicationAssembly = typeof(AuthModule.SharedRes).Assembly;
// options.HttpClientBuilder = sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient("Host");
// })
// .UseHttpClientJson(options =>
// {
// options.ResourcesPath = "_content/LayoutLib/Resources";
// options.ApplicationAssembly = typeof(LayoutLib.SharedRes).Assembly;
// options.HttpClientBuilder = sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient("Host");
// })
// .UseHttpClientJson(options =>
// {
// options.ResourcesPath = "_content/ECommerceModule/Resources";
// options.ApplicationAssembly = typeof(ECommerceModule.SharedRes).Assembly;
// options.HttpClientBuilder = sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient("Host");
// });
// });
// builder.Services.AddJsonLocalization(
// builder => builder.UseEmbeddedJson(
// options => {options.ResourcesPath = "Resources";
// options.Assemblies = new [] {assembly};}
// ));
// var cultureInfo = CultureInfo.GetCultureInfo("en-US");
// CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;