Files
EnvelopeGenerator/EnvelopeGenerator.ReceiverUI/EnvelopeGenerator.ReceiverUI.Client/Program.cs
OlgunR 7aa9853756 Add reusable UI components and toast notification system
- Introduce ActionPanel, EnvelopeInfoCard, TfaForm, ConfirmDialog, StatusPage, and Toast components for modular, presentational UI
- Add ToastService for pub/sub toast notifications; register in DI
- Refactor AccessCodeForm for improved UX and parameterization
- Enhance MainLayout with Toast integration and better error handling
- Standardize and extend app.css for new components and responsive design
- All new components are "dumb" (no service/API knowledge), using EventCallbacks for parent interaction
- ConfirmDialog supports awaitable user confirmation via TaskCompletionSource
2026-03-23 12:37:14 +01:00

29 lines
1.2 KiB
C#

using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using EnvelopeGenerator.ReceiverUI.Client.Auth;
using EnvelopeGenerator.ReceiverUI.Client.Services;
using EnvelopeGenerator.ReceiverUI.Client.State;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// HttpClient: BaseAddress zeigt auf den ReceiverUI-Server (gleiche Domain)
// Von dort werden alle /api/* Calls via YARP an die echte API weitergeleitet
builder.Services.AddScoped(sp =>
new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// Auth: Blazor fragt über diesen Provider "Ist der Nutzer eingeloggt?"
builder.Services.AddAuthorizationCore();
builder.Services.AddScoped<ApiAuthStateProvider>();
builder.Services.AddScoped<AuthenticationStateProvider>(sp =>
sp.GetRequiredService<ApiAuthStateProvider>());
// API-Services: Je ein Service pro API-Controller
builder.Services.AddScoped<IAuthService, AuthService>();
builder.Services.AddScoped<IEnvelopeService, EnvelopeService>();
// State: Ein State-Objekt pro Browser-Tab
builder.Services.AddScoped<EnvelopeState>();
builder.Services.AddScoped<ToastService>();
await builder.Build().RunAsync();