mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-22 01:02:28 +00:00
Squashed commit of the following: commit 47d268cc29560e72b5102eabc80d1f5743c103bb Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 21:14:09 2022 -0400 Make profile pictures square commit a5ae8a53918708fea215a5676beea2116078bd34 Merge: f5d8a9ef06fcc4
Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 18:43:26 2022 -0400 Merge branch 'main' into ui-refresh commit f5d8a9e5ed2d9aaafd63d113a5b064d042f7ba48 Merge: fbf16952ad9804
Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 17:03:33 2022 -0400 Merge branch 'main' into ui-refresh commit fbf16953893b2e294df21a0c60e561dbb409aa92 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 17:02:32 2022 -0400 Fix test failures commit 70cb5513cb8bae9d85b2b04bc9a3fb194f0a66a5 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 16:56:43 2022 -0400 Improve 404 logic commit b2743c4c8af736d2501c7bdd47cce19a6a01902d Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 16:44:36 2022 -0400 Add 404 page commit 3d0926d3c99d347617e5147ac632d8ec6bab18f9 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 16:27:03 2022 -0400 Update icons for slots and team picks commit c61405d83d71d9e67ab4c2775f76b3f7d6c2e827 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 16:12:45 2022 -0400 Add background color, put content on segment commit f7d9ee6a0accc9d664f8d2aefabcce4eb8789cd6 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 15:53:58 2022 -0400 Add colors to mod/admin panel buttons, update fomantic commit e680c5e6eb14f22792dc62bda029072d3f11f423 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 03:20:16 2022 -0400 Fix landing page title commit c779aa4b417af623aa47db0ce9875f49a9ee5c4b Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 03:13:32 2022 -0400 Remove useless css commit 57f6387c1214b319fe3e0b14df32a7bbecf51548 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 03:11:45 2022 -0400 Add hover effect to logo commit 15746911f92037abec115a83fa625ef0fda39e3a Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 02:39:04 2022 -0400 Change currently_online string to english better commit b98a90f1e9f0b3af7e65104cdd0acbc74c6a244e Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 02:33:41 2022 -0400 Run GameApiTests sequentially, fix web tests commit 630c08d3b80b74be11b0648b24011f89de705130 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 02:20:01 2022 -0400 Add user links to comments commit a91f136c87bc973300c74d6f97696cd7cbf1046a Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 02:14:22 2022 -0400 Add ability for photos to have user links commit d9e2a58e37dafe842b0b10b463cde1a2cb962052 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 01:33:21 2022 -0400 Add ability to link to users and include their profile picture commit 200196ce1f58638da7da368025ec0a88cacc14b6 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 01:33:07 2022 -0400 Rename "users" to "people" in Landing Page commit 07d229821099c069979a21bbd529b549c6f4e6b6 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 00:59:17 2022 -0400 Fix bug with name on mobile commit aecad7aeb69b63c0e517e85fba0c4de292d202f4 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 00:44:56 2022 -0400 Make gap between header and title 17px commit 46fa79b84e46b7ae90232724d82f7bd9e1a74f17 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 00:40:00 2022 -0400 Fix user card stats oddity commit 3b4c19f5b7e0199baeb88e27c918fbb17b5f777a Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 00:24:38 2022 -0400 Mobile improvements, make avatars rounded commit cf9533410042cabf456be0cba34ac5d80ef86046 Author: jvyden <jvyden@jvyden.xyz> Date: Fri Aug 19 00:02:01 2022 -0400 Redesign header commit f24aec0367d8375f3eaea94ea3579d86256c94be Author: jvyden <jvyden@jvyden.xyz> Date: Thu Aug 18 23:36:42 2022 -0400 Fix runtime compilation not working commit 3147e12865feecf792a46088711691160c76b0c6 Author: jvyden <jvyden@jvyden.xyz> Date: Thu Aug 18 22:43:21 2022 -0400 Add support for custom fomantic theme
76 lines
No EOL
2.5 KiB
C#
76 lines
No EOL
2.5 KiB
C#
#nullable enable
|
|
using JetBrains.Annotations;
|
|
using LBPUnion.ProjectLighthouse.Helpers;
|
|
using LBPUnion.ProjectLighthouse.Levels;
|
|
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
|
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages;
|
|
|
|
public class LandingPage : BaseLayout
|
|
{
|
|
public LandingPage(Database database) : base(database)
|
|
{}
|
|
|
|
public int PendingAuthAttempts;
|
|
public List<User> PlayersOnline = new();
|
|
|
|
public List<Slot>? LatestTeamPicks;
|
|
public List<Slot>? NewestLevels;
|
|
|
|
[UsedImplicitly]
|
|
public async Task<IActionResult> OnGet()
|
|
{
|
|
User? user = this.Database.UserFromWebRequest(this.Request);
|
|
if (user != null && user.PasswordResetRequired) return this.Redirect("~/passwordResetRequired");
|
|
|
|
if (user != null)
|
|
this.PendingAuthAttempts = await this.Database.AuthenticationAttempts.Include
|
|
(a => a.GameToken)
|
|
.CountAsync(a => a.GameToken.UserId == user.UserId);
|
|
|
|
List<int> userIds = await this.Database.LastContacts.Where(l => TimeHelper.Timestamp - l.Timestamp < 300).Select(l => l.UserId).ToListAsync();
|
|
|
|
this.PlayersOnline = await this.Database.Users.Where(u => userIds.Contains(u.UserId)).ToListAsync();
|
|
|
|
const int maxShownLevels = 5;
|
|
|
|
this.LatestTeamPicks = await this.Database.Slots.Where(s => s.Type == SlotType.User && !s.SubLevel)
|
|
.Where(s => s.TeamPick)
|
|
.OrderByDescending(s => s.FirstUploaded)
|
|
.Take(maxShownLevels)
|
|
.Include(s => s.Creator)
|
|
.ToListAsync();
|
|
|
|
this.NewestLevels = await this.Database.Slots.Where(s => s.Type == SlotType.User && !s.SubLevel)
|
|
.OrderByDescending(s => s.FirstUploaded)
|
|
.Take(maxShownLevels)
|
|
.Include(s => s.Creator)
|
|
.ToListAsync();
|
|
|
|
return this.Page();
|
|
}
|
|
|
|
public ViewDataDictionary GetSlotViewData(int slotId, bool isMobile = false)
|
|
=> new(ViewData)
|
|
{
|
|
{
|
|
"User", this.User
|
|
},
|
|
{
|
|
"CallbackUrl", $"~/slot/{slotId}"
|
|
},
|
|
{
|
|
"ShowLink", true
|
|
},
|
|
{
|
|
"IsMini", true
|
|
},
|
|
{
|
|
"IsMobile", isMobile
|
|
},
|
|
};
|
|
} |