summary refs log tree commit diff
path: root/extra/admin-api/Utilities/Spacebar.Client/Components/DebugBanner.razor
blob: 4cc627817b86cfb96e787811a34f85abbabaf098 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<span class="@("dbgBanner " + (_bannerVisible ? "" : "hidden"))"><b class="code">@(Name)</b>: @_status</span>

@code {
    
    private bool _bannerVisible = true;
    private string? _status = "initializing...";
    
    [Parameter]
    public required string Name { get; set; }
    
    public async Task SetStatus(string? message, int closeDelay = 0) {
        _bannerVisible = !string.IsNullOrWhiteSpace(message);
        if (!_bannerVisible) {
            await Task.Delay(closeDelay);
            StateHasChanged();
            await Task.Delay(1000);
        }

        _status = message;
        StateHasChanged();
        await Task.Yield();
    }
}