mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-13 08:41:27 +00:00
Display a lock icon next to locked levels (#738)
* Display a lock icon next to locked levels * C# Return Switch shenanigans * No clue where that line break came from * Don't render a semicolon * Move permission level color/lock icon to website extension * Simplify GetLevelLockIcon --------- Co-authored-by: Josh <josh@slendy.pw>
This commit is contained in:
parent
8e096052ce
commit
c50e53ad9a
5 changed files with 25 additions and 19 deletions
|
@ -0,0 +1,19 @@
|
|||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Extensions;
|
||||
|
||||
public static class FormattingExtensions
|
||||
{
|
||||
public static string GetLevelLockIcon(this SlotEntity slot) => slot.InitiallyLocked ? "icon lock" : "";
|
||||
|
||||
public static string ToHtmlColor(this PermissionLevel permissionLevel)
|
||||
{
|
||||
return permissionLevel switch
|
||||
{
|
||||
PermissionLevel.Administrator => "red",
|
||||
PermissionLevel.Moderator => "rgb(200, 130, 0)",
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
@using LBPUnion.ProjectLighthouse.Database
|
||||
@using LBPUnion.ProjectLighthouse.Localization
|
||||
@using LBPUnion.ProjectLighthouse.Types.Users
|
||||
@using LBPUnion.ProjectLighthouse.Servers.Website.Extensions
|
||||
@model LBPUnion.ProjectLighthouse.Types.Entities.Profile.UserEntity
|
||||
|
||||
@{
|
||||
|
|
|
@ -54,13 +54,13 @@
|
|||
@if (showLink)
|
||||
{
|
||||
<h2>
|
||||
<a href="~/slot/@Model.SlotId">@slotName</a>
|
||||
<a href="~/slot/@Model.SlotId">@slotName</a> <i class="@Model.GetLevelLockIcon()"></i>
|
||||
</h2>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h1>
|
||||
@slotName
|
||||
@slotName <i class="@Model.GetLevelLockIcon()"></i>
|
||||
</h1>
|
||||
}
|
||||
}
|
||||
|
@ -69,13 +69,13 @@
|
|||
@if (showLink)
|
||||
{
|
||||
<h3>
|
||||
<a href="~/slot/@Model.SlotId">@slotName</a>
|
||||
<a href="~/slot/@Model.SlotId">@slotName</a> <i class="@Model.GetLevelLockIcon()"></i>
|
||||
</h3>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h3>
|
||||
@slotName
|
||||
@slotName <i class="@Model.GetLevelLockIcon()"></i>
|
||||
</h3>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@using LBPUnion.ProjectLighthouse.Database
|
||||
@using LBPUnion.ProjectLighthouse.Localization
|
||||
@using LBPUnion.ProjectLighthouse.Types.Users
|
||||
@using LBPUnion.ProjectLighthouse.Servers.Website.Extensions;
|
||||
@model LBPUnion.ProjectLighthouse.Types.Entities.Profile.UserEntity
|
||||
|
||||
@{
|
||||
|
|
|
@ -8,17 +8,4 @@ public enum PermissionLevel
|
|||
Default = 0,
|
||||
Moderator = 1,
|
||||
Administrator = 2,
|
||||
}
|
||||
|
||||
public static class PermissionLevelExtensions
|
||||
{
|
||||
public static string ToHtmlColor(this PermissionLevel permissionLevel)
|
||||
{
|
||||
return permissionLevel switch
|
||||
{
|
||||
PermissionLevel.Administrator => "red",
|
||||
PermissionLevel.Moderator => "rgb(200, 130, 0)",
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue