83 lines
3.3 KiB
Plaintext
83 lines
3.3 KiB
Plaintext
@model SharedLibraryCore.Dtos.ServerInfo
|
|
|
|
@{
|
|
Layout = null;
|
|
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
|
|
{
|
|
group,
|
|
index
|
|
}).ToList();
|
|
|
|
string GetIconForState(string messageState)
|
|
{
|
|
return messageState switch
|
|
{
|
|
"CONNECTED" => "oi-account-login text-success mr-5",
|
|
"DISCONNECTED" => "oi-account-logout text-danger mr-5",
|
|
_ => ""
|
|
};
|
|
}
|
|
}
|
|
|
|
<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)
|
|
{
|
|
<div class="flex-fill flex-lg-grow-0 w-half-md mr-md-10 mb-md-10">
|
|
@foreach (var chat in Model.ChatHistory)
|
|
{
|
|
var message = chat.IsHidden && !ViewBag.Authorized ? chat.HiddenMessage : chat.Message;
|
|
var stateIcon = GetIconForState(chat.Message);
|
|
|
|
<div>
|
|
<i class="oi @stateIcon"></i>
|
|
|
|
<span>
|
|
<color-code value="@chat.Name"></color-code>
|
|
</span>
|
|
@if (stateIcon == "")
|
|
{
|
|
<span class="text-truncate">
|
|
—
|
|
<span class="text-white-dm text-black-lm">
|
|
<color-code value="@message?.CapClientName(48)"></color-code>
|
|
</span>
|
|
</span>
|
|
}
|
|
</div>
|
|
|
|
}
|
|
<hr class="d-block d-md-none"/>
|
|
</div>
|
|
}
|
|
|
|
<div class="d-flex flex-row flex-fill flex-lg-grow-0 w-half-md">
|
|
|
|
@foreach (var clientIndex in groupedClients)
|
|
{
|
|
<div class="@(clientIndex.index == 1 ? "pl-md-10 text-right" : "pr-md-10") flex-fill">
|
|
@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}";
|
|
<div class="d-flex @(clientIndex.index == 1 ? "flex-row-reverse" : "") w-xl-150">
|
|
<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>
|
|
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.client.ClientId" class="@(clientIndex.index == 1 ? "mr-5" : "ml-5") @levelColorClass no-decoration">
|
|
<color-code value="@client.client.Name"></color-code>
|
|
</a>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
@if (groupedClients.Count > 0)
|
|
{
|
|
<br/>
|
|
}
|
|
</div>
|
|
</div>
|