IW4M-Admin/WebfrontCore/Views/Server/_ClientActivity.cshtml

83 lines
3.4 KiB
Plaintext
Raw Normal View History

2018-04-08 02:44:42 -04:00
@model SharedLibraryCore.Dtos.ServerInfo
2018-02-21 20:29:23 -05:00
@{
Layout = null;
2022-04-19 19:43:58 -04:00
var half = Model.ClientCount == 0 || Model.Players.Count == 0 ? 0 : (int)Math.Ceiling(Model.ClientCount / 2.0);
var groupedClients = Model.Players.Select((client, i) => new { index = i, client })
.OrderBy(client => client.client.Name)
.GroupBy(client => client.index >= half).Select((group, index) => new
2018-02-21 20:29:23 -05:00
{
2022-04-19 19:43:58 -04:00
group,
index
}).ToList();
2022-04-19 19:43:58 -04:00
string GetIconForState(string messageState)
{
return messageState switch
{
"CONNECTED" => "oi-account-login text-success mr-5",
"DISCONNECTED" => "oi-account-logout text-danger mr-5",
_ => ""
};
2018-02-21 20:29:23 -05:00
}
2022-04-19 19:43:58 -04:00
}
2022-04-19 19:43:58 -04:00
<div class="pt-15 pl-15 pr-15 d-flex flex-wrap flex-column flex-md-row justify-content-between w-full w-auto-lg">
@if (groupedClients.Count > 0)
{
2022-04-20 15:16:34 -04:00
<div class="flex-fill flex-lg-grow-0 w-full w-md-half pr-md-10 pb-md-10">
2022-04-19 19:43:58 -04:00
@foreach (var chat in Model.ChatHistory)
{
var message = chat.IsHidden && !ViewBag.Authorized ? chat.HiddenMessage : chat.Message;
var stateIcon = GetIconForState(chat.Message);
2022-04-20 15:16:34 -04:00
<div class="text-truncate">
2022-04-19 19:43:58 -04:00
<i class="oi @stateIcon"></i>
2022-04-19 19:43:58 -04:00
<span>
<color-code value="@chat.Name"></color-code>
</span>
@if (stateIcon == "")
2021-01-24 14:30:22 -05:00
{
2022-04-19 19:43:58 -04:00
<span class="text-truncate">
&mdash;
<span class="text-white-dm text-black-lm">
<color-code value="@message?.CapClientName(48)"></color-code>
</span>
</span>
2021-01-24 14:30:22 -05:00
}
2022-04-19 19:43:58 -04:00
</div>
}
<hr class="d-block d-md-none"/>
</div>
}
2022-04-20 15:16:34 -04:00
<div class="d-flex flex-row w-full w-md-half w-xl-auto pl-md-10 pb-md-10">
2022-04-19 19:43:58 -04:00
@foreach (var clientIndex in groupedClients)
{
2022-04-20 15:16:34 -04:00
<div class="@(clientIndex.index == 1 ? "pl-md-10" : "pr-md-10") w-half w-xl-full">
2022-04-19 19:43:58 -04:00
@foreach (var client in clientIndex.group)
{
var levelColorClass = !ViewBag.Authorized || client.client.LevelInt == 0 ? "text-light-dm text-dark-lm" : $"level-color-{client.client.LevelInt}";
2022-04-20 15:16:34 -04:00
<div class="d-flex @(clientIndex.index == 1 ? "justify-content-end ml-auto" : "ml-auto") w-full w-xl-200">
2022-04-19 19:43:58 -04:00
<has-permission entity="AdminMenu" required-permission="Update">
<a href="#actionModal" class="profile-action" data-action="kick" data-action-id="@client.client.ClientId" aria-hidden="true">
<i class="oi oi-circle-x font-size-12 @levelColorClass"></i>
</a>
</has-permission>
2022-04-20 15:16:34 -04:00
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.client.ClientId" class="@levelColorClass no-decoration text-truncate">
2022-04-19 19:43:58 -04:00
<color-code value="@client.client.Name"></color-code>
2021-01-24 14:30:22 -05:00
</a>
</div>
2018-02-21 20:29:23 -05:00
}
2022-04-19 19:43:58 -04:00
</div>
}
2022-04-19 19:43:58 -04:00
@if (groupedClients.Count > 0)
{
<br/>
}
</div>
2022-01-22 13:49:12 -05:00
</div>