diff --git a/src/Application/Common/Configurations/DashbordSettings.cs b/src/Application/Common/Configurations/DashbordSettings.cs index 8471eeeb3..afb00513f 100644 --- a/src/Application/Common/Configurations/DashbordSettings.cs +++ b/src/Application/Common/Configurations/DashbordSettings.cs @@ -13,41 +13,50 @@ public class DashboardSettings /// public const string Key = nameof(DashboardSettings); + /// + /// Specifies whether to enable the loading screen + /// + public bool EnableLoadingScreen { get; set; } = true; + + /// + /// Specifies the duration of the loading screen in milliseconds + /// + public int LoadingScreenDuration { get; set; } = 3000; + /// /// Current application version /// public string Version { get; set; } = "1.3.0"; - + /// /// Application framework /// - + public string App { get; set; } = "Blazor"; - + /// /// The application name / title /// public string AppName { get; set; } = "Blazor Dashboard"; - + /// /// Application framework including the version /// - + public string AppFlavor { get; set; } = "Blazor .NET 7.0"; - + /// /// Application .NET version /// public string AppFlavorSubscript { get; set; } = ".NET 7"; - + /// /// The name of the company /// public string Company { get; set; } = "Company"; - + /// /// Copyright watermark /// public string Copyright { get; set; } = "@2023 Copyright"; - -} +} \ No newline at end of file diff --git a/src/Blazor.Server.UI/App.razor b/src/Blazor.Server.UI/App.razor index ff8ad08e6..5003f3432 100644 --- a/src/Blazor.Server.UI/App.razor +++ b/src/Blazor.Server.UI/App.razor @@ -1,33 +1,51 @@ - +@using Blazor.Server.UI.Services.Layout @inject IStringLocalizer L - - - - - - - @L["Please wait, we are authorizing you..."] - - - @if (@context.User.Identity?.IsAuthenticated??false) - { -

@L["You are not authorized to be here. For more information, contact your system administrator."]

- } - else - { - - } -
-
+ + + + + + + + @L["Please wait, we are authorizing you..."] + + + @if (context.User.Identity?.IsAuthenticated ?? false) + { +

@L["You are not authorized to be here. For more information, contact your system administrator."]

+ } + else + { + + } +
+
+ +
+ + Not found + + +

+ @L["Sorry, there's nothing at this address."] @L["Go Home"] +

+
+
+
+
+
+
+ +@code{ + + [Inject] + private LayoutService LayoutService { get; set; } + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + LayoutService.SetBaseTheme(Theme.Theme.ApplicationTheme()); + await LayoutService.ApplyUserPreferences(true); + } -
- - Not found - - -

@L["Sorry, there's nothing at this address."] @L["Go Home"]

-
-
-
-
-
+} \ No newline at end of file diff --git a/src/Blazor.Server.UI/Components/Shared/LoadingScreen.razor b/src/Blazor.Server.UI/Components/Shared/LoadingScreen.razor new file mode 100644 index 000000000..ac0516624 --- /dev/null +++ b/src/Blazor.Server.UI/Components/Shared/LoadingScreen.razor @@ -0,0 +1,148 @@ +@using Blazor.Server.UI.Services.Layout +@inherits LayoutComponentBase + +@if (_isLoaded) +{ + @ChildContent +} +else +{ + var randomNumber = new Random().Next(-45, -15) + "%"; + var randomNumber2 = new Random().Next(10, 30) + "%"; +
+ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+} + +@code { + + [Parameter] + public RenderFragment ChildContent { get; set; } + + [Parameter] + public LayoutService LayoutService { get; set; } + + [Parameter] + public int LoadingDelayMs { get; set; } + + private bool _isLoaded; + + private string Gradient => $"background-image: linear-gradient(-120deg, {(LayoutService.IsDarkMode ? LayoutService.CurrentTheme.PaletteDark.Background : LayoutService.CurrentTheme.Palette.Background)} 50%, {(LayoutService.IsDarkMode ? LayoutService.CurrentTheme.PaletteDark.Surface : LayoutService.CurrentTheme.Palette.Surface)} 50%);"; + + protected override async Task OnInitializedAsync() + { + await Task.Delay(LoadingDelayMs); + _isLoaded = true; + } +} \ No newline at end of file diff --git a/src/Blazor.Server.UI/appsettings.json b/src/Blazor.Server.UI/appsettings.json index e23c7503e..9aa421ed1 100644 --- a/src/Blazor.Server.UI/appsettings.json +++ b/src/Blazor.Server.UI/appsettings.json @@ -25,6 +25,8 @@ "Resilience": false }, "DashboardSettings": { + "EnableLoadingScreen": true, + "LoadingScreenDuration": 3000, "Version": "1.3.0", "App": "Blazor", "AppName": "Blazor Dashboard",