From e12fa2ea66d397710bcb7c8ff1ce926424073129 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 21 Nov 2021 18:53:34 -0500 Subject: [PATCH] Add players online count to landing page --- .../Pages/ExternalAuth/LandingPage.cshtml | 13 +++++++++++++ .../Pages/ExternalAuth/LandingPage.cshtml.cs | 7 +++---- ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml index 81716c29..5da7834c 100644 --- a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml +++ b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml @@ -9,4 +9,17 @@ @if (Model.User != null) {

You are currently logged in as @Model.User.Username.

+} + +@if (Model.PlayersOnline == 1) +{ +

There is 1 user currently online.

+} +else if (Model.PlayersOnline == 0) +{ +

There are no users online. Why not hop on?

+} +else +{ +

There are currently @Model.PlayersOnline users online.

} \ No newline at end of file diff --git a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs index 898e97c4..806731fb 100644 --- a/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs +++ b/ProjectLighthouse/Pages/ExternalAuth/LandingPage.cshtml.cs @@ -1,8 +1,8 @@ #nullable enable using System.Threading.Tasks; using JetBrains.Annotations; +using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Pages.Layouts; -using LBPUnion.ProjectLighthouse.Types; using Microsoft.AspNetCore.Mvc; namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth @@ -12,13 +12,12 @@ namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth public LandingPage(Database database) : base(database) {} - public new User? User { get; set; } + public int PlayersOnline; [UsedImplicitly] public async Task OnGet() { - User = await this.Database.UserFromWebRequest(this.Request); - + this.PlayersOnline = await StatisticsHelper.RecentMatches(); return this.Page(); } } diff --git a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml index 9e553841..1cbf2943 100644 --- a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml +++ b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml @@ -51,7 +51,7 @@
-

Page generated by @GitVersionHelper.FullVersion

+

Page generated by @GitVersionHelper.FullVersion.

@if (GitVersionHelper.IsDirty) {

This page was generated using a modified version of Project Lighthouse. Please make sure you are properly disclosing the source code to any users who may be using this instance.