about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/MainLayout.razor
blob: 691acbbd3a6f3019dffa6c700cae93d09ce88d30 (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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@using System.Net
@inherits LayoutComponentBase

<div class="page">
    <div class="sidebar">
        <NavMenu/>
    </div>

    <main>
        <div class="top-row px-4">
            <PortableDevTools></PortableDevTools>
            <a href="https://git.rory.gay/MatrixRoomUtils.git/" target="_blank">Git</a>
            <a href="https://matrix.to/#/%23mru%3Arory.gay?via=rory.gay&via=matrix.org&via=feline.support" target="_blank">Matrix</a>
            @if (showDownload) {
                <a href="/MRU.tar.xz" target="_blank">Download</a>
            }
        </div>

        <article class="Content px-4">
            @Body
        </article>
    </main>
</div>

@code {
    private bool showDownload { get; set; }

    protected override async Task OnInitializedAsync() {
        using var hc = new HttpClient();
        var hr = await hc.SendAsync(new HttpRequestMessage(HttpMethod.Head, NavigationManager.ToAbsoluteUri("/MRU-BIN.tar.xz").AbsoluteUri));
        showDownload = hr.StatusCode == HttpStatusCode.OK;
        
        // TODO: fix console logging toggle
        // if (!LocalStorageWrapper.Settings.DeveloperSettings.EnableConsoleLogging) {
        //     Console.WriteLine("Console logging disabled!");
        //     var sw = new StringWriter();
        //     Console.SetOut(sw);
        //     Console.SetError(sw);
        // }

        await base.OnInitializedAsync();
    }

}