mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-04-19 19:14:51 +00:00
120 lines
No EOL
4.2 KiB
Text
120 lines
No EOL
4.2 KiB
Text
@using LBPUnion.ProjectLighthouse
|
|
@using LBPUnion.ProjectLighthouse.Configuration
|
|
@using LBPUnion.ProjectLighthouse.PlayerData
|
|
@using LBPUnion.ProjectLighthouse.PlayerData.Profiles
|
|
@using Microsoft.EntityFrameworkCore
|
|
@model LBPUnion.ProjectLighthouse.Levels.Slot
|
|
|
|
@{
|
|
User? user = (User?)ViewData["User"];
|
|
|
|
await using Database database = new();
|
|
|
|
string slotName = string.IsNullOrEmpty(Model.Name) ? "Unnamed Level" : Model.Name;
|
|
|
|
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
|
bool mini = (bool?)ViewData["IsMini"] ?? false;
|
|
|
|
bool isQueued = false;
|
|
bool isHearted = false;
|
|
|
|
if (user != null)
|
|
{
|
|
isQueued = await database.QueuedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
|
isHearted = await database.HeartedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
|
}
|
|
|
|
string callbackUrl = (string)ViewData["CallbackUrl"]!;
|
|
bool showLink = (bool?)ViewData["ShowLink"] ?? false;
|
|
|
|
string iconHash = Model.IconHash;
|
|
if (string.IsNullOrWhiteSpace(iconHash) || iconHash.StartsWith('g')) iconHash = ServerConfiguration.Instance.WebsiteConfiguration.MissingIconHash;
|
|
}
|
|
<div class="card">
|
|
@{
|
|
int size = isMobile || mini ? 50 : 100;
|
|
}
|
|
<div>
|
|
<img src="~/assets/slotCardOverlay.png" style="min-width: @(size)px; width: @(size)px; height: @(size)px; pointer-events: none; position: absolute">
|
|
<img class="cardIcon slotCardIcon" src="/gameAssets/@iconHash" style="min-width: @(size)px; width: @(size)px; height: @(size)px">
|
|
</div>
|
|
<div class="cardStats">
|
|
@if (!mini)
|
|
{
|
|
@if (showLink)
|
|
{
|
|
<h2>
|
|
<a href="~/slot/@Model.SlotId">@slotName</a>
|
|
</h2>
|
|
}
|
|
else
|
|
{
|
|
<h1>
|
|
@slotName
|
|
</h1>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
@if (showLink)
|
|
{
|
|
<h3>
|
|
<a href="~/slot/@Model.SlotId">@slotName</a>
|
|
</h3>
|
|
}
|
|
else
|
|
{
|
|
<h3>
|
|
@slotName
|
|
</h3>
|
|
}
|
|
}
|
|
|
|
<div class="cardStatsUnderTitle">
|
|
<i class="pink heart icon" title="Hearts"></i> <span>@Model.Hearts</span>
|
|
<i class="blue play icon" title="Plays"></i> <span>@Model.PlaysUnique</span>
|
|
<i class="green thumbs up icon" title="Yays"></i> <span>@Model.Thumbsup</span>
|
|
<i class="red thumbs down icon" title="Boos"></i> <span>@Model.Thumbsdown</span>
|
|
|
|
@if (Model.GameVersion == GameVersion.LittleBigPlanet1)
|
|
{
|
|
<i class="yellow star icon" title="LBP1 Stars"></i>
|
|
<span>@Model.RatingLBP1</span>
|
|
}
|
|
</div>
|
|
<p>
|
|
<i>Created by <a href="/user/@Model.Creator?.UserId">@Model.Creator?.Username</a> for @Model.GameVersion.ToPrettyString()</i>
|
|
</p>
|
|
</div>
|
|
<div class="cardButtons">
|
|
<br>
|
|
@if (user != null && !mini)
|
|
{
|
|
if (isHearted)
|
|
{
|
|
<a class="ui pink tiny button" href="/slot/@Model.SlotId/unheart?callbackUrl=@callbackUrl" title="Unheart">
|
|
<i class="broken heart icon" style="margin: 0"></i>
|
|
</a>
|
|
}
|
|
else
|
|
{
|
|
<a class="ui pink tiny button" href="/slot/@Model.SlotId/heart?callbackUrl=@callbackUrl" title="Heart">
|
|
<i class="heart icon" style="margin: 0"></i>
|
|
</a>
|
|
}
|
|
|
|
if (isQueued)
|
|
{
|
|
<a class="ui yellow tiny button" href="/slot/@Model.SlotId/unqueue?callbackUrl=@callbackUrl" title="Unqueue">
|
|
<i class="bell slash icon" style="margin: 0"></i>
|
|
</a>
|
|
}
|
|
else
|
|
{
|
|
<a class="ui yellow tiny button" href="/slot/@Model.SlotId/queue?callbackUrl=@callbackUrl" title="Queue">
|
|
<i class="bell icon" style="margin: 0"></i>
|
|
</a>
|
|
}
|
|
}
|
|
</div>
|
|
</div> |