ProjectLighthouse/ProjectLighthouse.Servers.Website/Pages/LandingPage.cshtml

130 lines
No EOL
4.2 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>
}
}
}
@if (Model.LatestAnnouncement != null)
{
<div class="ui blue segment" style="position: relative;">
<div>
<h3>@Model.LatestAnnouncement.Title</h3>
<div style="padding-bottom: 2em;">
@if (Model.LatestAnnouncement.Content.Length > 250)
{
<span style="white-space: pre-line">@Model.LatestAnnouncement.Content[..250]...<a href="@ServerConfiguration.Instance.ExternalUrl/notifications">read more</a></span>
}
else
{
<span style="white-space: pre-line">@Model.LatestAnnouncement.Content</span>
}
</div>
@if (Model.LatestAnnouncement.Publisher != null)
{
<div class="ui tiny bottom left attached label">
Posted by
<a style="color: black" href="~/user/@Model.LatestAnnouncement.Publisher.UserId">
@Model.LatestAnnouncement.Publisher.Username
</a>
</div>
}
</div>
</div>
}
else
{
<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>