diff --git a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs index 7557e834..d72c85b9 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminReportController.cs @@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore; namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin; [ApiController] -[Route("admin/report/{id:int}")] +[Route("/modPanel/report/{id:int}")] public class AdminReportController : ControllerBase { private readonly Database database; @@ -73,6 +73,6 @@ public class AdminReportController : ControllerBase await this.database.SaveChangesAsync(); - return this.Redirect("~/admin/reports/0"); + return this.Redirect("~/modPanel/reports/0"); } } \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml index 53e82fcd..c5197ef8 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml @@ -41,6 +41,11 @@ else } } + + + View Mod Panel + +

Commands

@foreach (ICommand command in MaintenanceHelper.Commands) { diff --git a/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml.cs index 6df20cfc..32a294f1 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/Admin/AdminPanelPage.cshtml.cs @@ -27,10 +27,9 @@ public class AdminPanelPage : BaseLayout if (user == null) return this.Redirect("~/login"); if (!user.IsAdmin) return this.NotFound(); - this.Statistics.Add(new AdminPanelStatistic("Users", await StatisticsHelper.UserCount(), "users")); + this.Statistics.Add(new AdminPanelStatistic("Users", await StatisticsHelper.UserCount(), "/admin/users")); this.Statistics.Add(new AdminPanelStatistic("Slots", await StatisticsHelper.SlotCount())); this.Statistics.Add(new AdminPanelStatistic("Photos", await StatisticsHelper.PhotoCount())); - this.Statistics.Add(new AdminPanelStatistic("Reports", await StatisticsHelper.ReportCount(), "reports/0")); if (!string.IsNullOrEmpty(command)) { diff --git a/ProjectLighthouse.Servers.Website/Pages/Admin/ModPanelPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/Admin/ModPanelPage.cshtml new file mode 100644 index 00000000..7268ba0b --- /dev/null +++ b/ProjectLighthouse.Servers.Website/Pages/Admin/ModPanelPage.cshtml @@ -0,0 +1,28 @@ +@page "/modPanel" +@using LBPUnion.ProjectLighthouse.Administration +@using LBPUnion.ProjectLighthouse.Extensions +@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.ModPanelPage + +@{ + Layout = "Layouts/BaseLayout"; + Model.Title = "Moderator Panel"; +} + +@if (!this.Request.IsMobile()) +{ +
+ @foreach (AdminPanelStatistic statistic in Model.Statistics) + { + @await Html.PartialAsync("Partials/AdminPanelStatisticPartial", statistic) + } +
+
+} +else +{ + @foreach (AdminPanelStatistic statistic in Model.Statistics) + { + @await Html.PartialAsync("Partials/AdminPanelStatisticPartial", statistic) +
+ } +} \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Pages/Admin/ModPanelPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/Admin/ModPanelPage.cshtml.cs new file mode 100644 index 00000000..1b91ed67 --- /dev/null +++ b/ProjectLighthouse.Servers.Website/Pages/Admin/ModPanelPage.cshtml.cs @@ -0,0 +1,26 @@ +using LBPUnion.ProjectLighthouse.Administration; +using LBPUnion.ProjectLighthouse.Helpers; +using LBPUnion.ProjectLighthouse.PlayerData.Profiles; +using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; +using Microsoft.AspNetCore.Mvc; + +namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin; + +public class ModPanelPage : BaseLayout +{ + public ModPanelPage(Database database) : base(database) + {} + + public List Statistics = new(); + + public async Task OnGet() + { + User? user = this.Database.UserFromWebRequest(this.Request); + if (user == null) return this.Redirect("~/login"); + if (!user.IsModerator) return this.NotFound(); + + this.Statistics.Add(new AdminPanelStatistic("Reports", await StatisticsHelper.ReportCount(), "/modPanel/reports/0")); + + return this.Page(); + } +} \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml b/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml index f19c67e2..8e4eda35 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml @@ -21,6 +21,10 @@ { Model.NavigationItemsRight.Add(new PageNavigationItem("Admin Panel", "/admin", "cogs")); } + else if(Model.User.IsModerator) + { + Model.NavigationItemsRight.Add(new PageNavigationItem("Mod Panel", "/modPanel", "user shield")); + } Model.NavigationItemsRight.Add(new PageNavigationItem("Log out", "/logout", "user alternate slash")); // should always be last } diff --git a/ProjectLighthouse.Servers.Website/Pages/Partials/AdminPanelStatisticPartial.cshtml b/ProjectLighthouse.Servers.Website/Pages/Partials/AdminPanelStatisticPartial.cshtml index 49db6781..b084b761 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Partials/AdminPanelStatisticPartial.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Partials/AdminPanelStatisticPartial.cshtml @@ -5,7 +5,7 @@ @if (Model.ViewAllEndpoint != null) {

- @Model.StatisticNamePlural + @Model.StatisticNamePlural

} else diff --git a/ProjectLighthouse.Servers.Website/Pages/ReportsPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/ReportsPage.cshtml index 993074dd..5cfba37a 100644 --- a/ProjectLighthouse.Servers.Website/Pages/ReportsPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/ReportsPage.cshtml @@ -1,4 +1,4 @@ -@page "/admin/reports/{pageNumber:int}" +@page "/modPanel/reports/{pageNumber:int}" @using LBPUnion.ProjectLighthouse.Administration.Reports @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.ReportsPage @@ -7,9 +7,9 @@ Model.Title = "Reports"; } -

There are @Model.ReportCount total reports!

+

There are @Model.ReportCount total reports.

-
+
@@ -69,11 +69,11 @@

- + Dismiss - + Remove all related assets @@ -239,10 +239,10 @@ @if (Model.PageNumber != 0) { - Previous Page + Previous Page } @(Model.PageNumber + 1) / @(Model.PageAmount) @if (Model.PageNumber < Model.PageAmount - 1) { - Next Page + Next Page } \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj b/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj index 1f13259f..6aa7cd38 100644 --- a/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj +++ b/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj @@ -10,36 +10,36 @@ - + - + Always - + Always - + Always - + Always - + - - - - + + + +