Tech stack stub page and changing project to be just one Web Assembly project for now
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
@using System.Timers
|
||||
@using WebAssembly.Components.Feedback
|
||||
@using WebAssembly.Data
|
||||
@implements IDisposable;
|
||||
|
||||
@inject IToastService ToastService
|
||||
|
||||
@if (ToastService.HasToasts())
|
||||
{
|
||||
<div class="toastsContainer">
|
||||
@foreach (var toast in Toasts)
|
||||
{
|
||||
<ToastComponent Toast="toast"/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<style>
|
||||
.toastsContainer {
|
||||
position: fixed;
|
||||
top: 64px;
|
||||
right: 64px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@code {
|
||||
private List<ToastModel> Toasts => ToastService.GetToasts();
|
||||
|
||||
private Timer _ageTimer = null!;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
ToastService.Subscribe(OnUpdate);
|
||||
|
||||
_ageTimer = new Timer(10);
|
||||
_ageTimer.Elapsed += OnAge!;
|
||||
_ageTimer.Enabled = true;
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
ToastService.Unsubscribe(OnUpdate);
|
||||
}
|
||||
|
||||
|
||||
void OnAge(object? sender, ElapsedEventArgs elapsedEventArgs)
|
||||
{
|
||||
ToastService.AgeToasts();
|
||||
_ageTimer.Enabled = true;
|
||||
}
|
||||
|
||||
|
||||
void OnUpdate()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user