@using Microsoft.AspNetCore.Mvc.ViewFeatures
@inject IFileVersionProvider FileVersionProvider

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <base href="/" />
    @DxResourceManager.RegisterTheme(ActiveTheme)
    @DxResourceManager.RegisterScripts()
    <link href=@AppendVersion("css/site.css") rel="stylesheet" />
    <link href=@AppendVersion("LambertzPortal.styles.css") rel="stylesheet" />
    <HeadOutlet @rendermode="InteractiveServer" />
</head>
<body>
    <Routes @rendermode="InteractiveServer" />
    <script src="_framework/blazor.web.js"></script>
</body>
</html>

@code {

    static readonly ITheme ActiveTheme = Themes.Fluent.Clone(properties =>
    {
        properties.Mode = ThemeMode.Light;
    });

    [CascadingParameter]
    private HttpContext HttpContext { get; set; } = default!;

    private string AppendVersion(string path)
        => FileVersionProvider.AddFileVersionToPath(
            HttpContext.Request.PathBase.HasValue
                ? HttpContext.Request.PathBase.Value
                : "/",
            path);
}
