diff --git a/.gitignore b/.gitignore index f5c663e..1fff553 100644 --- a/.gitignore +++ b/.gitignore @@ -70,7 +70,6 @@ project.fragment.lock.json _ReSharper*/ *.resharper *.dotCover -.idea/ *.coverage *.coveragejson TestResult.xml @@ -81,7 +80,6 @@ nunit-*.xml .DS_Store # Rider logs/cache -.idea/ .idea/.idea.* .idea/*workspace* .idea/httpRequests diff --git a/Bimix.UI.Mobile/MauiProgram.cs b/Bimix.UI.Mobile/MauiProgram.cs index fc6826c..cb6a038 100644 --- a/Bimix.UI.Mobile/MauiProgram.cs +++ b/Bimix.UI.Mobile/MauiProgram.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using MudBlazor.Services; namespace Bimix.UI.Mobile; @@ -18,6 +19,10 @@ public static class MauiProgram builder.Logging.AddDebug(); #endif + builder.Services.AddMudBlazorDialog(); + builder.Services.AddMudBlazorSnackbar(); + builder.Services.AddMudBlazorResizeListener(); + return builder.Build(); } } \ No newline at end of file diff --git a/Bimix.UI.Shared/Bimix.UI.Shared.csproj b/Bimix.UI.Shared/Bimix.UI.Shared.csproj index 4a4ba9a..a0bad0f 100644 --- a/Bimix.UI.Shared/Bimix.UI.Shared.csproj +++ b/Bimix.UI.Shared/Bimix.UI.Shared.csproj @@ -13,11 +13,16 @@ + - - - + + + + + + + diff --git a/Bimix.UI.Shared/Component1.razor b/Bimix.UI.Shared/Component1.razor deleted file mode 100644 index 1c5c447..0000000 --- a/Bimix.UI.Shared/Component1.razor +++ /dev/null @@ -1,3 +0,0 @@ -
- This component is defined in the Bimix.UI.Shared library. -
diff --git a/Bimix.UI.Shared/Component1.razor.css b/Bimix.UI.Shared/Component1.razor.css deleted file mode 100644 index 757bfd3..0000000 --- a/Bimix.UI.Shared/Component1.razor.css +++ /dev/null @@ -1,6 +0,0 @@ -.my-component { - border: 2px dashed red; - padding: 1em; - margin: 1em 0; - background-image: url('background.png'); -} diff --git a/Bimix.UI.Shared/Components/Dashboard.razor b/Bimix.UI.Shared/Components/Dashboard.razor new file mode 100644 index 0000000..d662978 --- /dev/null +++ b/Bimix.UI.Shared/Components/Dashboard.razor @@ -0,0 +1,5 @@ +@page "/dashboard" +@using MudBlazor + +Dashboard +

Tutaj znajdzie się panel ogólny aplikacji

\ No newline at end of file diff --git a/Bimix.UI.Shared/Components/Index.razor b/Bimix.UI.Shared/Components/Index.razor new file mode 100644 index 0000000..fa039a8 --- /dev/null +++ b/Bimix.UI.Shared/Components/Index.razor @@ -0,0 +1,15 @@ +@page "/" +@inject NavigationManager Navigation + +@code +{ + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + Navigation.NavigateTo("/dashboard"); + } + + await base.OnAfterRenderAsync(firstRender); + } +} diff --git a/Bimix.UI.Shared/Components/NavMenu.razor b/Bimix.UI.Shared/Components/NavMenu.razor new file mode 100644 index 0000000..75b2926 --- /dev/null +++ b/Bimix.UI.Shared/Components/NavMenu.razor @@ -0,0 +1,10 @@ +@using Microsoft.AspNetCore.Components.Routing +@using MudBlazor + + + Dashboard + + + Produkty + + \ No newline at end of file diff --git a/Bimix.UI.Shared/Components/ProductList.razor b/Bimix.UI.Shared/Components/ProductList.razor new file mode 100644 index 0000000..87dd5c8 --- /dev/null +++ b/Bimix.UI.Shared/Components/ProductList.razor @@ -0,0 +1,5 @@ +@page "/products" +@using MudBlazor + +Produkty +

Lista produktów zostanie tutaj zaimplementowana

\ No newline at end of file diff --git a/Bimix.UI.Shared/Components/Routes.razor b/Bimix.UI.Shared/Components/Routes.razor new file mode 100644 index 0000000..d612c43 --- /dev/null +++ b/Bimix.UI.Shared/Components/Routes.razor @@ -0,0 +1,18 @@ +@using Microsoft.AspNetCore.Components.Routing +@using MudBlazor + + + + + + + + + + + Strona nieznaleziona. + + + + + \ No newline at end of file diff --git a/Bimix.UI.Shared/ExampleJsInterop.cs b/Bimix.UI.Shared/ExampleJsInterop.cs deleted file mode 100644 index 4307311..0000000 --- a/Bimix.UI.Shared/ExampleJsInterop.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.JSInterop; - -namespace Bimix.UI.Shared; - -// This class provides an example of how JavaScript functionality can be wrapped -// in a .NET class for easy consumption. The associated JavaScript module is -// loaded on demand when first needed. -// -// This class can be registered as scoped DI service and then injected into Blazor -// components for use. - -public class ExampleJsInterop : IAsyncDisposable -{ - private readonly Lazy> moduleTask; - - public ExampleJsInterop(IJSRuntime jsRuntime) - { - moduleTask = new (() => jsRuntime.InvokeAsync( - "import", "./_content/Bimix.UI.Shared/exampleJsInterop.js").AsTask()); - } - - public async ValueTask Prompt(string message) - { - var module = await moduleTask.Value; - return await module.InvokeAsync("showPrompt", message); - } - - public async ValueTask DisposeAsync() - { - if (moduleTask.IsValueCreated) - { - var module = await moduleTask.Value; - await module.DisposeAsync(); - } - } -} diff --git a/Bimix.UI.Shared/MainLayout.razor b/Bimix.UI.Shared/MainLayout.razor new file mode 100644 index 0000000..122aa31 --- /dev/null +++ b/Bimix.UI.Shared/MainLayout.razor @@ -0,0 +1,66 @@ +@using MudBlazor +@inherits LayoutComponentBase + + + + + + + + + + + Bimix + + + + + Dashboard + Products + + + + + + @Body + + + + +@code { + + private bool _drawerOpen = true; + private DrawerVariant _drawerVariant = DrawerVariant.Persistent; + + void ToggleDrawer() + { + Console.WriteLine($"ToogleDrawer clickkk {DateTime.Now}"); + _drawerOpen = !_drawerOpen; + } + + private void OnBreakpointChanged(Breakpoint breakpoint) + { + if (breakpoint < Breakpoint.Md) + { + _drawerVariant = DrawerVariant.Temporary; + _drawerOpen = false; + } + else + { + _drawerVariant = DrawerVariant.Persistent; + _drawerOpen = true; + } + + StateHasChanged(); + } +} \ No newline at end of file diff --git a/Bimix.UI.Shared/_Imports.razor b/Bimix.UI.Shared/_Imports.razor index dc10de7..62860d7 100644 --- a/Bimix.UI.Shared/_Imports.razor +++ b/Bimix.UI.Shared/_Imports.razor @@ -1 +1,11 @@ -@using Microsoft.AspNetCore.Components.Web +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using Bimix.UI.Shared +@using Bimix.UI.Shared.Components +@using MudBlazor \ No newline at end of file diff --git a/Bimix.UI.Shared/wwwroot/background.png b/Bimix.UI.Shared/wwwroot/background.png deleted file mode 100644 index e15a3bd..0000000 Binary files a/Bimix.UI.Shared/wwwroot/background.png and /dev/null differ diff --git a/Bimix.UI.Shared/wwwroot/exampleJsInterop.js b/Bimix.UI.Shared/wwwroot/exampleJsInterop.js deleted file mode 100644 index 5294766..0000000 --- a/Bimix.UI.Shared/wwwroot/exampleJsInterop.js +++ /dev/null @@ -1,6 +0,0 @@ -// This is a JavaScript module that is loaded on demand. It can export any number of -// functions, and may import other JavaScript modules if required. - -export function showPrompt(message) { - return prompt(message, 'Type anything here'); -} diff --git a/Bimix.UI.Web/Bimix.UI.Web.csproj b/Bimix.UI.Web/Bimix.UI.Web.csproj index a3f4936..84cadf1 100644 --- a/Bimix.UI.Web/Bimix.UI.Web.csproj +++ b/Bimix.UI.Web/Bimix.UI.Web.csproj @@ -10,4 +10,8 @@
+ + + + diff --git a/Bimix.UI.Web/Components/App.razor b/Bimix.UI.Web/Components/App.razor index 83d9f0e..f7d4146 100644 --- a/Bimix.UI.Web/Components/App.razor +++ b/Bimix.UI.Web/Components/App.razor @@ -2,17 +2,34 @@ - - - - - - + + + + + + + + + - + + + +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + \ No newline at end of file diff --git a/Bimix.UI.Web/Components/Pages/Home.razor b/Bimix.UI.Web/Components/Pages/Home.razor deleted file mode 100644 index dfcdf75..0000000 --- a/Bimix.UI.Web/Components/Pages/Home.razor +++ /dev/null @@ -1,7 +0,0 @@ -@page "/" - -Home - -

Hello, world!

- -Welcome to your new app. \ No newline at end of file diff --git a/Bimix.UI.Web/Components/Routes.razor b/Bimix.UI.Web/Components/Routes.razor deleted file mode 100644 index ae94e9e..0000000 --- a/Bimix.UI.Web/Components/Routes.razor +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Bimix.UI.Web/Components/_Imports.razor b/Bimix.UI.Web/Components/_Imports.razor index 39371b1..65684ed 100644 --- a/Bimix.UI.Web/Components/_Imports.razor +++ b/Bimix.UI.Web/Components/_Imports.razor @@ -7,4 +7,7 @@ @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop @using Bimix.UI.Web -@using Bimix.UI.Web.Components \ No newline at end of file +@using Bimix.UI.Web.Components +@using Bimix.UI.Shared +@using Bimix.UI.Shared.Components +@using MudBlazor \ No newline at end of file diff --git a/Bimix.UI.Web/Program.cs b/Bimix.UI.Web/Program.cs index 7fe4ea8..08ddc3c 100644 --- a/Bimix.UI.Web/Program.cs +++ b/Bimix.UI.Web/Program.cs @@ -1,27 +1,31 @@ +using Bimix.UI.Shared; using Bimix.UI.Web.Components; +using MudBlazor.Services; var builder = WebApplication.CreateBuilder(args); -// Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); +builder.Services.AddMudServices(); +builder.Services.AddHttpClient("BimixAPI", client => +{ + client.BaseAddress = new Uri("https://localhost:7071"); +}); var app = builder.Build(); -// Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); - app.UseStaticFiles(); app.UseAntiforgery(); app.MapRazorComponents() - .AddInteractiveServerRenderMode(); + .AddInteractiveServerRenderMode() + .AddAdditionalAssemblies(typeof(MainLayout).Assembly); app.Run(); \ No newline at end of file diff --git a/Bimix.UI.Web/wwwroot/app.css b/Bimix.UI.Web/wwwroot/app.css deleted file mode 100644 index e398853..0000000 --- a/Bimix.UI.Web/wwwroot/app.css +++ /dev/null @@ -1,29 +0,0 @@ -h1:focus { - outline: none; -} - -.valid.modified:not([type=checkbox]) { - outline: 1px solid #26b050; -} - -.invalid { - outline: 1px solid #e50000; -} - -.validation-message { - color: #e50000; -} - -.blazor-error-boundary { - background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; - padding: 1rem 1rem 1rem 3.7rem; - color: white; -} - - .blazor-error-boundary::after { - content: "An error has occurred." - } - -.darker-border-checkbox.form-check-input { - border-color: #929292; -}