ProjectLighthouse/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml
2022-08-01 18:29:43 -04:00

148 lines
No EOL
4.6 KiB
Text

@page "/user/{userId:int}"
@using System.Web
@using LBPUnion.ProjectLighthouse.Extensions
@using LBPUnion.ProjectLighthouse.Localization.StringLists
@using LBPUnion.ProjectLighthouse.PlayerData
@using LBPUnion.ProjectLighthouse.Types
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.UserPage
@{
Layout = "Layouts/BaseLayout";
Model.ShowTitleInPage = false;
Model.Title = Model.Translate(ProfileStrings.Title, Model.ProfileUser!.Username);
Model.Description = Model.ProfileUser!.Biography;
}
@if (Model.ProfileUser.Banned)
{
<div class="ui inverted red segment">
<h2>User is currently banned!</h2>
@if (Model.User != null && Model.User.IsAdmin)
{
<b>Reason:</b>
<span>"@Model.ProfileUser.BannedReason"</span>
<p>
<i>Note: Only you and other admins may view the ban reason.</i>
</p>
<a class="ui inverted button" href="/admin/user/@Model.ProfileUser.UserId/unban">
<i class="ban icon"></i>
<span>Unban User</span>
</a>
}
else
{
<p>For shame...</p>
}
</div>
}
<div class="ui grid">
<div class="eight wide column">
@await Html.PartialAsync("Partials/UserCardPartial", Model.ProfileUser, new ViewDataDictionary(ViewData)
{
{
"ShowLink", false
},
{
"IsMobile", Model.Request.IsMobile()
},
{
"Language", Model.GetLanguage()
}
})
</div>
<div class="eight wide right aligned column">
<br>
@if (Model.ProfileUser != Model.User && Model.User != null)
{
if (!Model.IsProfileUserHearted)
{
<a class="ui pink button" href="/user/@Model.ProfileUser.UserId/heart">
<i class="heart icon"></i>
<span>Heart</span>
</a>
}
else
{
<a class="ui pink button" href="/user/@Model.ProfileUser.UserId/unheart">
<i class="heart broken icon"></i>
<span>Unheart</span>
</a>
}
}
@if (Model.ProfileUser == Model.User)
{
<a class="ui blue button" href="/passwordReset">
<i class="key icon"></i>
<span>@Model.Translate(GeneralStrings.ResetPassword)</span>
</a>
}
</div>
<div class="eight wide column">
<div class="ui blue segment">
<h2>@Model.Translate(ProfileStrings.Biography)</h2>
@if (string.IsNullOrWhiteSpace(Model.ProfileUser.Biography))
{
<p>@Model.Translate(ProfileStrings.NoBiography, Model.ProfileUser.Username)</p>
}
else
{
<p>@HttpUtility.HtmlDecode(Model.ProfileUser.Biography)</p>
}
</div>
</div>
<div class="eight wide column">
<div class="ui red segment">
<h2>@Model.Translate(GeneralStrings.RecentActivity)</h2>
<p>@Model.Translate(GeneralStrings.Soon)</p>
</div>
</div>
</div>
@if (Model.Photos != null && Model.Photos.Count != 0)
{
<div class="ui purple segment">
<h2>@Model.Translate(GeneralStrings.RecentPhotos)</h2>
<div class="ui center aligned grid">
@foreach (Photo photo in Model.Photos)
{
<div class="eight wide column">
@await Html.PartialAsync("Partials/PhotoPartial", photo)
</div>
}
</div>
</div>
}
@await Html.PartialAsync("Partials/CommentsPartial")
@if (Model.User != null && Model.User.IsAdmin)
{
<div class="ui yellow segment">
<h2>Admin Options</h2>
@if (!Model.ProfileUser.Banned)
{
<div>
<a class="ui red button" href="/admin/user/@Model.ProfileUser.UserId/ban">
<i class="ban icon"></i>
<span>Ban User</span>
</a>
</div>
<div class="ui fitted hidden divider"></div>
}
<div>
<a class="ui red button" href="/admin/user/@Model.ProfileUser.UserId/wipePlanets">
<i class="trash alternate icon"></i>
<span>Wipe user's earth decorations</span>
</a>
</div>
<div class="ui fitted hidden divider"></div>
@await Html.PartialAsync("Partials/AdminSetGrantedSlotsFormPartial", Model.ProfileUser)
</div>
}