initial commit

This commit is contained in:
robotics_x1
2026-10-12 15:24:08 +07:00
commit 55228b3772
367 changed files with 162893 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
@implements IAsyncDisposable
@inject StateService State
@inject ISnackbar Snackbar
@inject ScriptLogService ScriptLog
@* Component không render gì — lắng nghe notification, ghi vào output log + Snackbar *@
@code {
[Parameter] public bool Muted { get; set; }
protected override async Task OnInitializedAsync()
{
await State.StartAsync();
State.NotificationReceived += OnNotification;
}
private void OnNotification(NotificationDto n)
{
ScriptLog.LogNotification(n);
// Snackbar toast — chỉ khi chưa tắt
if (!Muted)
{
var severity = n.Level switch
{
"success" => Severity.Success,
"error" => Severity.Error,
"warning" => Severity.Warning,
"heartbeat" => Severity.Normal,
_ => Severity.Info,
};
Snackbar.Add(n.Message, severity);
}
}
public ValueTask DisposeAsync()
{
State.NotificationReceived -= OnNotification;
return ValueTask.CompletedTask;
}
}