mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-13 00:31:28 +00:00
* Simplify website rank badges to use semantic classes * Fix ambiguity between partial display types * Add profile vanity tags and needed migration * Make form field read only to non-administrators * Display lock icon if user is not admin to minimize confusion * Also display lock icon for username field since it's readonly * Fix up naming consistency issues and edit migration accordingly * Apply suggestions from code review * Add space between placeholder property and ternary operator
35 lines
No EOL
1.2 KiB
C#
35 lines
No EOL
1.2 KiB
C#
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
|
using LBPUnion.ProjectLighthouse.Types.Moderation.Cases;
|
|
using LBPUnion.ProjectLighthouse.Types.Users;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Extensions;
|
|
|
|
public static class FormattingExtensions
|
|
{
|
|
public static string GetLevelLockIcon(this SlotEntity slot) => slot.InitiallyLocked ? "ui icon lock" : "";
|
|
|
|
public static string GetCaseTypeIcon(this CaseType caseType)
|
|
{
|
|
return caseType switch
|
|
{
|
|
CaseType.UserBan => "ui icon ban",
|
|
CaseType.UserRestriction => "ui icon user alternate slash",
|
|
CaseType.UserSilence => "ui icon volume off",
|
|
CaseType.UserDisableComments => "ui icon comment slash",
|
|
CaseType.LevelHide => "ui icon eye slash",
|
|
CaseType.LevelLock => "ui icon lock",
|
|
CaseType.LevelDisableComments => "ui icon comment slash",
|
|
_ => "ui icon question",
|
|
};
|
|
}
|
|
|
|
public static string ToHtmlColor(this PermissionLevel permissionLevel)
|
|
{
|
|
return permissionLevel switch
|
|
{
|
|
PermissionLevel.Administrator => "red",
|
|
PermissionLevel.Moderator => "orange",
|
|
_ => "",
|
|
};
|
|
}
|
|
} |