Improved web ui
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
@using DiscordBotCore
|
||||
@using DiscordBotCore.Modules
|
||||
@using DiscordBotCore.Others.Exceptions
|
||||
@using DiscordBotWebUI.Components.Items
|
||||
@using DiscordBotWebUI.Types
|
||||
|
||||
@if(MarketItems.Count > 0)
|
||||
{
|
||||
<Marketplace ListedItems="MarketItems"/>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public ModuleRequirement Requirements { get; set; }
|
||||
private List<MarketItem> MarketItems = new List<MarketItem>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
foreach(var requirement in Requirements.RequiredModulesWithTypes)
|
||||
{
|
||||
var modulesWithType = await Application.CurrentApplication.ModuleManager.ServerGetAllModules(requirement);
|
||||
AppendToList(modulesWithType);
|
||||
}
|
||||
|
||||
foreach (var moduleName in Requirements.RequiredModulesWithNames)
|
||||
{
|
||||
var module = await Application.CurrentApplication.ModuleManager.ServerGetModuleWithName(moduleName);
|
||||
MarketItem item = new MarketItem(module.ModuleName, module.ModuleAuthor, module.ModuleDescription, ItemType.Module);
|
||||
MarketItems.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendToList(List<ModuleOnlineData> listOfModules)
|
||||
{
|
||||
foreach (var module in listOfModules)
|
||||
{
|
||||
MarketItem item = new MarketItem(module.ModuleName, module.ModuleAuthor, module.ModuleDescription, ItemType.Module);
|
||||
MarketItems.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
51
DiscordBotWebUI/Components/Pages/Setup/SetupWizard.razor
Normal file
51
DiscordBotWebUI/Components/Pages/Setup/SetupWizard.razor
Normal file
@@ -0,0 +1,51 @@
|
||||
@page "/setup-wizard"
|
||||
@inject DialogService DialogService
|
||||
|
||||
@using DiscordBotCore
|
||||
@using DiscordBotCore.Others.Exceptions
|
||||
@using DiscordBotWebUI.Components.Items.Setup
|
||||
|
||||
<RadzenCard Style="max-width: 600px; margin: auto; margin-top: 50px; padding: 20px;">
|
||||
<RadzenSteps @bind-Value="currentStep" ShowStepsButtons="false">
|
||||
<RadzenStepsItem Text="Welcome" />
|
||||
<RadzenStepsItem Text="Basic Configuration" />
|
||||
<RadzenStepsItem Text="Download Dependencies" />
|
||||
<RadzenStepsItem Text="Final Setup" />
|
||||
</RadzenSteps>
|
||||
|
||||
<div>
|
||||
@if (currentStep == 0)
|
||||
{
|
||||
<WelcomeComponent NextStep="NextStep" />
|
||||
}
|
||||
else if (currentStep == 1)
|
||||
{
|
||||
<StartupConfigurationComponent NextStep="NextStep" />
|
||||
}
|
||||
else if (currentStep == 2)
|
||||
{
|
||||
<ModuleSetupComponent ModuleRequirementReference="RequirementsToDownload" NextStep="NextStep" />
|
||||
}
|
||||
else if (currentStep == 3)
|
||||
{
|
||||
<FinishSetupComponent CompleteSetup="FinishSetup" />
|
||||
}
|
||||
</div>
|
||||
</RadzenCard>
|
||||
|
||||
@code {
|
||||
[Parameter] public ModuleRequirement RequirementsToDownload { get; set; }
|
||||
|
||||
private int currentStep = 0;
|
||||
|
||||
private void NextStep()
|
||||
{
|
||||
currentStep++;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void FinishSetup()
|
||||
{
|
||||
DialogService.Close(true);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
@page "/welcome"
|
||||
@using DiscordBotWebUI.Components.Items.Setup
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<WelcomeComponent/>
|
||||
|
||||
<RadzenButton
|
||||
Icon="arrow_forward"
|
||||
ButtonStyle="ButtonStyle.Dark"
|
||||
Style="position: absolute; right: -50px; top: 50%; transform: translateY(-50%); background-color: #2d3748; border: none; color: #63b3ed;"
|
||||
Click="GoToNextPage" />
|
||||
|
||||
@code {
|
||||
// Method to navigate to a new page
|
||||
private void GoToNextPage()
|
||||
{
|
||||
Navigation.NavigateTo("/settings");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user