ProjectLighthouse/ProjectLighthouse.Servers.Website/Pages/LandingPage.cshtml
koko 21dbdff20a
Add proper ban page when logging in (#773)
* Add proper ban page upon logging in

* Remove two extra line break tags that don't need to be there

* Fix timestamp formatting

* Properly display timestamps in correct timezone

* Fix formatting issues with ban page

* Remove extra parenthesis which would be rendered on-page

* Add to redirect middleware to prevent navigating to other pages

* Small nitpick, renaming UserBannedPage to BannedUserPage

* Resolve nitpicks from reviewers

* Remove un-necessary log message in LoginForm

* Fix ban reason translatable string argument

* Word choice nitpick ("Ban Created" -> "Ban Issued")

* Final adjustments and nitpicks, visual and grammatical

* Resolve requested changes from reviewers
2023-05-30 19:25:31 +00:00

100 lines
No EOL
3.1 KiB
Text

@page "/"
@using LBPUnion.ProjectLighthouse.Configuration
@using LBPUnion.ProjectLighthouse.Extensions
@using LBPUnion.ProjectLighthouse.Localization.StringLists
@using LBPUnion.ProjectLighthouse.Servers.Website.Extensions
@using LBPUnion.ProjectLighthouse.Types.Entities.Level
@using LBPUnion.ProjectLighthouse.Types.Entities.Profile
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.LandingPage
@{
Layout = "Layouts/BaseLayout";
Model.ShowTitleInPage = false;
bool isMobile = Request.IsMobile();
string language = Model.GetLanguage();
string timeZone = Model.GetTimeZone();
}
<h1 class="lighthouse-welcome lighthouse-title">
@Model.Translate(LandingPageStrings.Welcome, ServerConfiguration.Instance.Customization.ServerName)
</h1>
@if (Model.User != null)
{
<p>@Model.Translate(LandingPageStrings.LoggedInAs, Model.User.Username)</p>
if (Model.PendingAuthAttempts > 0)
{
<p>
<b>
<a href="/authentication">@Model.Translate(LandingPageStrings.AuthAttemptsPending, Model.PendingAuthAttempts)</a>
</b>
</p>
}
}
@switch (Model.PlayersOnline.Count)
{
case 0:
<p>@Model.Translate(LandingPageStrings.UsersNone)</p>
break;
case 1:
<p>@Model.Translate(LandingPageStrings.UsersSingle)</p>
break;
default:
<p>@Model.Translate(LandingPageStrings.UsersMultiple, Model.PlayersOnline.Count)</p>
break;
}
@{
int i = 0;
foreach (UserEntity user in Model.PlayersOnline)
{
i++;
@await user.ToLink(Html, ViewData, language, timeZone, true)
@* whitespace has forced my hand *@
if (i != Model.PlayersOnline.Count)
{
<span>,</span>
}
}
}
<br><br>
<div class="@(isMobile ? "" : "ui center aligned grid")">
<div class="eight wide column">
<div class="ui inverted pink segment">
<h1>
<i class="star icon"></i>@Model.Translate(LandingPageStrings.LatestTeamPicks)
</h1>
<div class="ui divider"></div>
<div class="ui left aligned segment">
@foreach (SlotEntity slot in Model.LatestTeamPicks!) @* Can't reach a point where this is null *@
{
@await slot.ToHtml(Html, ViewData, Model.User, $"~/slot/{slot.SlotId}", language, timeZone, isMobile, true, true)
<br>
}
</div>
</div>
</div>
@if (isMobile)
{
<br>
}
<div class="eight wide column">
<div class="ui inverted blue segment">
<h1>
<i class="globe americas icon"></i>@Model.Translate(LandingPageStrings.NewestLevels)
</h1>
<div class="ui divider"></div>
<div class="ui left aligned segment">
@foreach (SlotEntity slot in Model.NewestLevels!) @* Can't reach a point where this is null *@
{
@await slot.ToHtml(Html, ViewData, Model.User, $"~/slot/{slot.SlotId}", language, timeZone, isMobile, true, true)
<br>
}
</div>
</div>
</div>
</div>