IW4M-Admin/WebfrontCore/Views/Home/Index.cshtml

62 lines
2.9 KiB
Plaintext
Raw Normal View History

2022-04-19 19:43:58 -04:00
@using WebfrontCore.ViewModels
@using Humanizer
@model SharedLibraryCore.Dtos.IW4MAdminInfo
@{
var loc = Utilities.CurrentLocalization.LocalizationIndex;
string FormatTranslation(string translationKey, params object[] values)
{
var split = loc[translationKey].Split("::");
2022-04-19 19:43:58 -04:00
return split.Length == 2 ? $"<span class='font-weight-bold text-primary'>{split[0].FormatExt(values)}</span><span>{split[1]}</span>" : translationKey;
}
}
2022-04-19 19:43:58 -04:00
<div class="content mt-20 row">
<div class="col-12 col-lg-9">
2022-07-05 13:02:43 -04:00
<h2 class="content-title mb-0">@ViewBag.Localization["WEBFRONT_SERVERS_TITLE"]</h2>
2022-04-19 19:43:58 -04:00
@if (Model.Game.HasValue)
{
<span class="text-muted">@loc[$"GAME_{Model.Game.Value}"]</span>
}
else
{
<span class="text-muted">@ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"]</span>
}
<div class="card p-0 m-0">
<div class="d-flex flex-column flex-md-row justify-content-md-between bg-dark-dm bg-light-lm p-10 mt-15 mb-15 rounded">
<div class="align-self-center align-content-md-start">@Html.Raw(FormatTranslation("WEBFRONT_HOME_CLIENTS_ONLINE", Model.TotalOccupiedClientSlots, Model.TotalAvailableClientSlots))</div>
<div class="align-self-center align-content-md-start" data-toggle="tooltip" data-title="@Model.MaxConcurrentClientsTime.HumanizeForCurrentCulture().Titleize()">@Html.Raw(FormatTranslation("WEBFRONT_HOME_MAX_CONCURRENT_CLIENTS", Model.MaxConcurrentClients.ToString("#,##0")))</div>
<div class="align-self-center align-content-md-start">@Html.Raw(FormatTranslation("WEBFRONT_HOME_RECENT_CLIENTS", Model.RecentClientCount.ToString("#,##0")))</div>
<div class="align-self-center align-content-md-start">@Html.Raw(FormatTranslation("WEBFRONT_HOME_TOTAL_CLIENTS", Model.TotalClientCount.ToString("#,##0")))</div>
</div>
</div>
2022-04-19 19:43:58 -04:00
@await Component.InvokeAsync("ServerList", Model.Game)
</div>
2022-07-05 13:02:43 -04:00
2022-04-19 19:43:58 -04:00
@{
var menuItems = new SideContextMenuItems
{
2022-07-05 13:02:43 -04:00
MenuTitle = ViewBag.Localization["WEBFRONT_CONTEXT_MENU_GLOBAL_GAME"],
Items = Model.ActiveServerGames.Select(game => new SideContextMenuItem
2022-04-19 19:43:58 -04:00
{
IsLink = true,
Reference = Url.Action("Index", "Home", new { game }),
Title = loc[$"GAME_{game}"],
IsActive = game == Model.Game
}).Prepend(new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("Index", "Home"),
Title = loc["GAME_ALL"],
IsActive = !Model.Game.HasValue
}).ToList()
};
}
<partial name="_SideContextMenu" for="@menuItems"></partial>
</div>
2018-02-21 20:29:23 -05:00
@section scripts {
<environment include="Development">
<script type="text/javascript" src="~/js/server.js" defer="defer"></script>
</environment>
}