@page "/slot/{id:int}" @using System.Web @using LBPUnion.ProjectLighthouse.Administration @using LBPUnion.ProjectLighthouse.Configuration @using LBPUnion.ProjectLighthouse.Extensions @using LBPUnion.ProjectLighthouse.Files @using LBPUnion.ProjectLighthouse.Helpers @using LBPUnion.ProjectLighthouse.PlayerData @using LBPUnion.ProjectLighthouse.PlayerData.Reviews @using LBPUnion.ProjectLighthouse.Servers.Website.Extensions @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.SlotPage @{ Layout = "Layouts/BaseLayout"; Model.ShowTitleInPage = false; Model.Title = HttpUtility.HtmlDecode(Model.Slot?.Name ?? ""); Model.Description = HttpUtility.HtmlDecode(Model.Slot?.Description ?? ""); bool isMobile = this.Request.IsMobile(); string language = Model.GetLanguage(); string timeZone = Model.GetTimeZone(); } @if (Model.Slot!.Hidden) {

This level is currently hidden.

Only you and moderators may view this level.

Reason: "@Model.Slot.HiddenReason"

For more information please contact a moderator.

} @await Html.PartialAsync("Partials/SlotCardPartial", Model.Slot, new ViewDataDictionary(ViewData) { { "User", Model.User }, { "CallbackUrl", $"~/slot/{Model.Slot?.SlotId}" }, { "ShowLink", false }, { "IsMobile", Model.Request.IsMobile() }, })

Description

@HttpUtility.HtmlDecode(string.IsNullOrEmpty(Model.Slot?.Description) ? "This level has no description." : Model.Slot.Description)

@if (isMobile) {
}

Tags

@{ string[] authorLabels; if (Model.Slot?.GameVersion == GameVersion.LittleBigPlanet1) { authorLabels = Model.Slot?.LevelTags ?? Array.Empty(); } else { authorLabels = Model.Slot?.AuthorLabels.Split(",") ?? Array.Empty(); // Split() returns an array with an empty character for some reason if (authorLabels.Length == 1) authorLabels = Array.Empty(); } if (authorLabels.Length == 0) {

This level has no tags.

} else { foreach (string label in authorLabels.Where(label => !string.IsNullOrEmpty(label))) {
@LabelHelper.TranslateTag(label)
} } }
@if (isMobile) {
}
@await Html.PartialAsync("Partials/CommentsPartial", ViewData.WithLang(language).WithTime(timeZone))
@if (isMobile) {
}

Reviews

@if (Model.Reviews.Count == 0 && Model.ReviewsEnabled) {

There are no reviews.

} else if (!Model.ReviewsEnabled) { Reviews are disabled on this level. } else { int count = Model.Reviews.Count;

There @(count == 1 ? "is" : "are") @count review@(count == 1 ? "" : "s").

} @for(int i = 0; i < Model.Reviews.Count; i++) { Review review = Model.Reviews[i]; string faceHash = (review.Thumb switch { -1 => review.Reviewer?.BooHash, 0 => review.Reviewer?.MehHash, 1 => review.Reviewer?.YayHash, _ => throw new ArgumentOutOfRangeException(), }) ?? ""; if (string.IsNullOrWhiteSpace(faceHash) || !FileHelper.ResourceExists(faceHash)) { faceHash = ServerConfiguration.Instance.WebsiteConfiguration.MissingIconHash; } string faceAlt = review.Thumb switch { -1 => "Boo!", 0 => "Meh.", 1 => "Yay!", _ => throw new ArgumentOutOfRangeException(), }; int size = isMobile ? 50 : 100;
@faceAlt

@review.Reviewer?.Username

@if (review.Deleted) { if (review.DeletedBy == DeletedBy.LevelAuthor) {

This review has been deleted by the level author.

} else {

This review has been deleted by a moderator.

} } else { @if (review.Labels.Length > 1) { @foreach (string reviewLabel in review.Labels) {
@LabelHelper.TranslateTag(reviewLabel)
} } @if (string.IsNullOrWhiteSpace(review.Text)) {

This review contains no text.

} else { {

@HttpUtility.HtmlDecode(review.Text)

} } }
@if (i != Model.Reviews.Count - 1) {
} }
@if (isMobile) {
}
@if (Model.Photos.Count != 0) {

Most recent photos

@foreach (Photo photo in Model.Photos) {
@await photo.ToHtml(Html, ViewData, language, timeZone)
}
@if (isMobile) {
} } @if (Model.User != null && Model.User.IsModerator) {

Moderation Options

@if (Model.Slot?.TeamPick ?? false) {
Remove Team Pick
} else {
Team Pick
}
Delete
@if (!Model.Slot!.Hidden) {
Hide
} @if (Model.Slot!.CommentsEnabled) { Disable Comments }
@if (isMobile) {
} }