@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", _ => "" }; } }
@if (groupedClients.Count > 0) {
@foreach (var chat in Model.ChatHistory) { var message = chat.IsHidden && !ViewBag.Authorized ? chat.HiddenMessage : chat.Message; var stateIcon = GetIconForState(chat.Message);
@if (stateIcon == "") { }
}
}
@foreach (var clientIndex in groupedClients) {
@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}"; }
} @if (groupedClients.Count > 0) {
}