diff --git a/Moonlight/Core/CoreFeature.cs b/Moonlight/Core/CoreFeature.cs index ae4bc9c..3f8cbda 100644 --- a/Moonlight/Core/CoreFeature.cs +++ b/Moonlight/Core/CoreFeature.cs @@ -7,9 +7,10 @@ using MoonCoreUI.Services; using Moonlight.Core.Configuration; using Moonlight.Core.Database; using Moonlight.Core.Database.Entities; -using Moonlight.Core.Implementations.AdminColumns; using Moonlight.Core.Implementations.Diagnose; +using Moonlight.Core.Implementations.UI.Admin.AdminColumns; using Moonlight.Core.Interfaces; +using Moonlight.Core.Interfaces.Ui.Admin; using Moonlight.Core.Models; using Moonlight.Core.Models.Abstractions; using Moonlight.Core.Models.Abstractions.Feature; diff --git a/Moonlight/Core/Implementations/AdminColumns/UserCount.cs b/Moonlight/Core/Implementations/AdminColumns/UserCount.cs deleted file mode 100644 index f4b5461..0000000 --- a/Moonlight/Core/Implementations/AdminColumns/UserCount.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.AspNetCore.Components; -using MoonCoreUI.Helpers; -using Moonlight.Core.Interfaces; -using Moonlight.Core.UI.Components.Cards; - -namespace Moonlight.Core.Implementations.AdminColumns; - -public class UserCount : IAdminDashboardColumn -{ - public Task Get() - { - var res = ComponentHelper.FromType(); - - return Task.FromResult(res); - } -} \ No newline at end of file diff --git a/Moonlight/Core/Implementations/UI/Admin/AdminColumns/UserCount.cs b/Moonlight/Core/Implementations/UI/Admin/AdminColumns/UserCount.cs new file mode 100644 index 0000000..328cb07 --- /dev/null +++ b/Moonlight/Core/Implementations/UI/Admin/AdminColumns/UserCount.cs @@ -0,0 +1,20 @@ +using MoonCoreUI.Helpers; +using Moonlight.Core.Interfaces.Ui.Admin; +using Moonlight.Core.Models.Abstractions; +using Moonlight.Core.UI.Components.Cards; + +namespace Moonlight.Core.Implementations.UI.Admin.AdminColumns; + +public class UserCount : IAdminDashboardColumn +{ + public Task Get() + { + var res = new UiComponent() + { + Component = ComponentHelper.FromType(), + Index = int.MinValue + }; + + return Task.FromResult(res); + } +} \ No newline at end of file diff --git a/Moonlight/Core/Interfaces/IAdminDashboardColumn.cs b/Moonlight/Core/Interfaces/IAdminDashboardColumn.cs deleted file mode 100644 index 7e92eab..0000000 --- a/Moonlight/Core/Interfaces/IAdminDashboardColumn.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Microsoft.AspNetCore.Components; - -namespace Moonlight.Core.Interfaces; - -public interface IAdminDashboardColumn -{ - public Task Get(); -} \ No newline at end of file diff --git a/Moonlight/Core/Interfaces/IAdminDashboardComponent.cs b/Moonlight/Core/Interfaces/IAdminDashboardComponent.cs deleted file mode 100644 index 4f1e0e7..0000000 --- a/Moonlight/Core/Interfaces/IAdminDashboardComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Microsoft.AspNetCore.Components; - -namespace Moonlight.Core.Interfaces; - -public interface IAdminDashboardComponent -{ - public Task Get(); -} \ No newline at end of file diff --git a/Moonlight/Core/Interfaces/UI/Admin/IAdminDashboardColumn.cs b/Moonlight/Core/Interfaces/UI/Admin/IAdminDashboardColumn.cs new file mode 100644 index 0000000..e47db08 --- /dev/null +++ b/Moonlight/Core/Interfaces/UI/Admin/IAdminDashboardColumn.cs @@ -0,0 +1,8 @@ +using Moonlight.Core.Models.Abstractions; + +namespace Moonlight.Core.Interfaces.Ui.Admin; + +public interface IAdminDashboardColumn +{ + public Task Get(); +} \ No newline at end of file diff --git a/Moonlight/Core/Interfaces/UI/Admin/IAdminDashboardComponent.cs b/Moonlight/Core/Interfaces/UI/Admin/IAdminDashboardComponent.cs new file mode 100644 index 0000000..52a3937 --- /dev/null +++ b/Moonlight/Core/Interfaces/UI/Admin/IAdminDashboardComponent.cs @@ -0,0 +1,8 @@ +using Moonlight.Core.Models.Abstractions; + +namespace Moonlight.Core.Interfaces.Ui.Admin; + +public interface IAdminDashboardComponent +{ + public Task Get(); +} \ No newline at end of file diff --git a/Moonlight/Core/Models/Abstractions/UiComponent.cs b/Moonlight/Core/Models/Abstractions/UiComponent.cs new file mode 100644 index 0000000..60329f6 --- /dev/null +++ b/Moonlight/Core/Models/Abstractions/UiComponent.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Components; + +namespace Moonlight.Core.Models.Abstractions; + +public class UiComponent +{ + public required RenderFragment Component { get; set; } + + public int Index { get; set; } = 0; +} \ No newline at end of file diff --git a/Moonlight/Core/UI/Views/Admin/Index.razor b/Moonlight/Core/UI/Views/Admin/Index.razor index 0b6399a..a7c6747 100644 --- a/Moonlight/Core/UI/Views/Admin/Index.razor +++ b/Moonlight/Core/UI/Views/Admin/Index.razor @@ -2,6 +2,8 @@ @using MoonCore.Abstractions @using Moonlight.Core.Database.Entities @using Moonlight.Core.Interfaces +@using Moonlight.Core.Interfaces.Ui.Admin +@using Moonlight.Core.Models.Abstractions @using Moonlight.Core.Services @using Moonlight.Features.Servers.Entities @@ -11,17 +13,17 @@
- @foreach(var column in Columns) + @foreach(var column in Columns.OrderBy(x => x.Index)) {
- @column + @column.Component
}
- @foreach (var component in Components) + @foreach (var component in Components.OrderBy(x => x.Index)) {
- @component + @component.Component
}
@@ -29,8 +31,8 @@ @code { - private List Columns = new(); - private List Components = new(); + private List Columns = new(); + private List Components = new(); private async Task Load(LazyLoader arg) { diff --git a/Moonlight/Features/Servers/Implementations/AdminColumns/ServerCount.cs b/Moonlight/Features/Servers/Implementations/AdminColumns/ServerCount.cs deleted file mode 100644 index 2d743d4..0000000 --- a/Moonlight/Features/Servers/Implementations/AdminColumns/ServerCount.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.AspNetCore.Components; -using MoonCoreUI.Helpers; -using Moonlight.Core.Interfaces; -using Moonlight.Features.Servers.UI.Components.Cards; - -namespace Moonlight.Features.Servers.Implementations.AdminColumns; - -public class ServerCount : IAdminDashboardColumn -{ - public Task Get() - { - var res = ComponentHelper.FromType(); - - return Task.FromResult(res); - } -} \ No newline at end of file diff --git a/Moonlight/Features/Servers/Implementations/UI/Admin/AdminColumns/ServerCount.cs b/Moonlight/Features/Servers/Implementations/UI/Admin/AdminColumns/ServerCount.cs new file mode 100644 index 0000000..fa18e6d --- /dev/null +++ b/Moonlight/Features/Servers/Implementations/UI/Admin/AdminColumns/ServerCount.cs @@ -0,0 +1,19 @@ +using MoonCoreUI.Helpers; +using Moonlight.Core.Interfaces.Ui.Admin; +using Moonlight.Core.Models.Abstractions; +using Moonlight.Features.Servers.UI.Components.Cards; + +namespace Moonlight.Features.Servers.Implementations.UI.Admin.AdminColumns; + +public class ServerCount : IAdminDashboardColumn +{ + public Task Get() + { + var res = new UiComponent() + { + Component = ComponentHelper.FromType() + }; + + return Task.FromResult(res); + } +} \ No newline at end of file diff --git a/Moonlight/Features/Servers/ServersFeature.cs b/Moonlight/Features/Servers/ServersFeature.cs index 89e0075..3c3da66 100644 --- a/Moonlight/Features/Servers/ServersFeature.cs +++ b/Moonlight/Features/Servers/ServersFeature.cs @@ -2,13 +2,14 @@ using MoonCore.Helpers; using MoonCore.Services; using Moonlight.Core.Configuration; using Moonlight.Core.Interfaces; +using Moonlight.Core.Interfaces.Ui.Admin; using Moonlight.Core.Models.Abstractions.Feature; using Moonlight.Core.Services; using Moonlight.Features.Servers.Actions; using Moonlight.Features.Servers.Configuration; using Moonlight.Features.Servers.Http.Middleware; -using Moonlight.Features.Servers.Implementations.AdminColumns; using Moonlight.Features.Servers.Implementations.Diagnose; +using Moonlight.Features.Servers.Implementations.UI.Admin.AdminColumns; using Moonlight.Features.Servers.Models.Enums; using Moonlight.Features.Servers.Services; using Moonlight.Features.Servers.UI.Components.Cards; diff --git a/Moonlight/Moonlight.csproj b/Moonlight/Moonlight.csproj index 34bbe64..d706b91 100644 --- a/Moonlight/Moonlight.csproj +++ b/Moonlight/Moonlight.csproj @@ -53,7 +53,7 @@ - + @@ -75,6 +75,7 @@ +