Updated web ui
This commit is contained in:
@@ -4,11 +4,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using DiscordBot.Utilities;
|
|
||||||
using DiscordBotCore;
|
|
||||||
using DiscordBotCore.Modules;
|
|
||||||
using DiscordBotCore.Others;
|
|
||||||
|
|
||||||
namespace DiscordBot;
|
namespace DiscordBot;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using DiscordBot.Utilities;
|
|||||||
using DiscordBotCore;
|
using DiscordBotCore;
|
||||||
using DiscordBotCore.Bot;
|
using DiscordBotCore.Bot;
|
||||||
using DiscordBotCore.Others;
|
using DiscordBotCore.Others;
|
||||||
using DiscordBotCore.Others.Exceptions;
|
|
||||||
using DiscordBotCore.Updater.Application;
|
using DiscordBotCore.Updater.Application;
|
||||||
|
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ namespace DiscordBotCore.Modules
|
|||||||
Modules = new();
|
Modules = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ModuleOnlineData?> ServerGetModuleWithName(string moduleName)
|
||||||
|
{
|
||||||
|
var modules = await ServerGetAllModules();
|
||||||
|
return modules.FirstOrDefault(module => module?.ModuleName == moduleName, null);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<ModuleOnlineData>> ServerGetAllModules(ModuleType? moduleTypeFilter = null)
|
public async Task<List<ModuleOnlineData>> ServerGetAllModules(ModuleType? moduleTypeFilter = null)
|
||||||
{
|
{
|
||||||
string jsonDatabaseRemote = await ServerCom.GetAllTextFromUrl(_ModuleDatabase);
|
string jsonDatabaseRemote = await ServerCom.GetAllTextFromUrl(_ModuleDatabase);
|
||||||
|
|||||||
16
DiscordBotWebUI/Components/Items/Setup/ModuleSetup.razor
Normal file
16
DiscordBotWebUI/Components/Items/Setup/ModuleSetup.razor
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
@using DiscordBotWebUI.Types
|
||||||
|
|
||||||
|
<Marketplace ListedItems="Items"/>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private List<MarketItem> Items = new List<MarketItem>();
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
base.OnInitialized();
|
||||||
|
|
||||||
|
Items.Clear();
|
||||||
|
|
||||||
|
// Load items
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<div style="display: flex; justify-content: center; align-items: center; height: 100vh;">
|
||||||
|
<RadzenCard Style="position: relative; background-color: #2d3748; color: #fff; max-width: 450px; padding: 30px; box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3); border-radius: 12px;">
|
||||||
|
<RadzenHeading Size="H2" Text=@_Title Style="text-align: center; color: #e2e8f0;" />
|
||||||
|
<RadzenText Text=@_Text Style="text-align: center; color: #a0aec0;" />
|
||||||
|
</RadzenCard>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
private static readonly string _Title = "Welcome to Seth Discord Bot setup page";
|
||||||
|
|
||||||
|
private static readonly string _Text =
|
||||||
|
@"
|
||||||
|
Seth Discord Bot is a small yet powerful Discord Bot that allows you to integrate custom commands and events into your Discord server.
|
||||||
|
But let's start with the configuration first. Please click the arrow to the right to begin ...
|
||||||
|
";
|
||||||
|
}
|
||||||
@@ -24,6 +24,13 @@
|
|||||||
var modulesWithType = await Application.CurrentApplication.ModuleManager.ServerGetAllModules(requirement);
|
var modulesWithType = await Application.CurrentApplication.ModuleManager.ServerGetAllModules(requirement);
|
||||||
AppendToList(modulesWithType);
|
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)
|
private void AppendToList(List<ModuleOnlineData> listOfModules)
|
||||||
|
|||||||
19
DiscordBotWebUI/Components/Pages/Setup/Welcome.razor
Normal file
19
DiscordBotWebUI/Components/Pages/Setup/Welcome.razor
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
@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");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ public class Entry : ICommandAction
|
|||||||
|
|
||||||
public bool RequireOtherThread => false;
|
public bool RequireOtherThread => false;
|
||||||
|
|
||||||
public async Task Execute(string[]? args)
|
public Task Execute(string[]? args)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
string appUiComponent = "./Data/Test/libtestlib.dll";
|
string appUiComponent = "./Data/Test/libtestlib.dll";
|
||||||
@@ -49,5 +49,7 @@ public class Entry : ICommandAction
|
|||||||
} catch (Exception dllException) {
|
} catch (Exception dllException) {
|
||||||
Application.Logger.LogException(dllException, this);
|
Application.Logger.LogException(dllException, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user