From 248af498a8abf6c5437ea858bb9732ef88f2dfd8 Mon Sep 17 00:00:00 2001 From: ChiaraBm Date: Wed, 21 Jan 2026 17:01:32 +0100 Subject: [PATCH] Added setup wizard component for initial installation flow and integrated it into app routing. --- Moonlight.Frontend/UI/App.razor | 58 ++++--- .../UI/Shared/Components/Setup.razor | 147 ++++++++++++++++++ 2 files changed, 182 insertions(+), 23 deletions(-) create mode 100644 Moonlight.Frontend/UI/Shared/Components/Setup.razor diff --git a/Moonlight.Frontend/UI/App.razor b/Moonlight.Frontend/UI/App.razor index f9c663dd..edadd0bd 100644 --- a/Moonlight.Frontend/UI/App.razor +++ b/Moonlight.Frontend/UI/App.razor @@ -2,10 +2,13 @@ @using LucideBlazor @using Microsoft.AspNetCore.Components.Authorization @using Moonlight.Frontend.UI.Shared +@using Moonlight.Frontend.UI.Shared.Components @using ShadcnBlazor.Emptys @using Moonlight.Frontend.UI.Shared.Components.Auth @using Moonlight.Frontend.UI.Shared.Partials +@inject NavigationManager Navigation + @@ -30,33 +33,42 @@ } else { - + var uri = new Uri(Navigation.Uri); + + if (uri.LocalPath.StartsWith("/setup")) + { + + } + else + { + + } } - @if (context is HttpRequestException { StatusCode: HttpStatusCode.Unauthorized }) - { - - } - else - { -
- - - - - - - Critical Application Error - - - @context.ToString() - - - -
- } + @if (context is HttpRequestException { StatusCode: HttpStatusCode.Unauthorized }) + { + + } + else + { +
+ + + + + + + Critical Application Error + + + @context.ToString() + + + +
+ }
\ No newline at end of file diff --git a/Moonlight.Frontend/UI/Shared/Components/Setup.razor b/Moonlight.Frontend/UI/Shared/Components/Setup.razor new file mode 100644 index 00000000..947b6a00 --- /dev/null +++ b/Moonlight.Frontend/UI/Shared/Components/Setup.razor @@ -0,0 +1,147 @@ +@using LucideBlazor +@using ShadcnBlazor.Cards +@using ShadcnBlazor.Spinners +@using ShadcnBlazor.Buttons +@using ShadcnBlazor.Inputs +@using ShadcnBlazor.Labels + +
+ + @if (!IsLoaded) + { +
+ @if (CurrentStep == 0) + { +
+ Moonlight Logo +
+ +
+

Welcome to Moonlight Panel

+

+ You successfully installed moonlight. Now you are ready to perform some initial steps to complete your installation +

+
+ } + else if (CurrentStep == 1) + { +
+ +
+ +
+

Admin Account Creation

+

+ To continue please fill in the account details of the user you want to use as the initial administrator account. + If you use an external OIDC provider, these details need to match with your desired OIDC account +

+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ } + else if (CurrentStep == 2) + { +
+ +
+ +
+

You are all set!

+

+ You are now ready to finish the initial setup. + The configured options will be applied to the instance. + You will be redirected to the login after changes have been applied successfully +

+
+ } +
+
+ @for (var step = 0; step < StepCount; step++) + { + if (step == CurrentStep) + { +
+
+ } + else + { +
+
+ } + } +
+
+ @if (CurrentStep > 0) + { + + } + @if (CurrentStep != StepCount - 1) + { + + } + else + { + + } +
+
+
+ } + else + { +
+ +
+ } +
+
+ +@code +{ + private bool IsLoaded = false; + + private int CurrentStep = 0; + private int StepCount = 3; + + private string Email; + private string Username; + private string Password; + + private void Navigate(int diff) => CurrentStep += diff; +} \ No newline at end of file