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

92 lines
3.5 KiB
Plaintext
Raw Permalink Normal View History

@using SharedLibraryCore.Configuration
@using System.Text.RegularExpressions
@model WebfrontCore.ViewModels.CommunityInfo
@{
2022-04-19 19:43:58 -04:00
IEnumerable<KeyValuePair<(string, long), string[]>> allRules = new[] { new KeyValuePair<(string, long), string[]>((ViewBag.Localization["WEBFRONT_ABOUT_GLOBAL_RULES"], 0), Model.GlobalRules) };
var serverRules = Model.ServerRules?.Where(server => server.Value != null && server.Value.Any()).ToList();
if (serverRules?.Any() ?? false)
{
allRules = allRules.Union(serverRules);
}
}
2022-04-19 19:43:58 -04:00
<div class="content text-wrap mt-20">
@if (Model.CommunityInformation.EnableBanner)
{
2022-04-19 19:43:58 -04:00
<img class="img-fluid mb-20" style="max-height: 250px" src="images/community/banner.png" alt="@Model.CommunityInformation.Name"/>
}
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Name))
{
2022-04-19 19:43:58 -04:00
<h2 class="content-title">
2022-01-22 13:49:12 -05:00
<color-code value="@Model.CommunityInformation.Name"></color-code>
</h2>
}
2022-04-19 19:43:58 -04:00
<div class="card m-0 rounded">
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Description))
{
<h5 class="text-primary mt-0">@ViewBag.Localization["WEBFRONT_ABOUT_TITLE"]</h5>
<div class="text-md-justify">
<color-code value="@Model.CommunityInformation.Description"></color-code>
</div>
<div class="mt-10">
@foreach (var social in Model.CommunityInformation.SocialAccounts ?? Array.Empty<SocialAccountConfiguration>())
{
<div>
2022-07-10 22:06:58 -04:00
<a href="@social.Url" target="_blank" title="@social.Title" class="d-flex no-decoration">
@if (!string.IsNullOrWhiteSpace(social.IconId))
{
2022-07-10 22:06:58 -04:00
<i class="oi @social.IconId mr-5" style="width: 1.6rem;"></i>
}
else if (!string.IsNullOrWhiteSpace(social.IconUrl))
{
2022-04-19 19:43:58 -04:00
var url = Uri.TryCreate(social.IconUrl, UriKind.Absolute, out var parsedUrl)
? parsedUrl.AbsoluteUri
2021-10-16 14:30:26 -04:00
: $"images/community/{social.IconUrl}";
2022-07-10 22:06:58 -04:00
<img class="img-fluid mr-5" style="width: 1.6rem; fill: white" src="@url" alt="@social.Title"/>
}
2022-07-10 22:06:58 -04:00
<div class="ml-1">@social.Title</div>
</a>
</div>
}
</div>
2022-04-19 19:43:58 -04:00
}
</div>
@if (allRules.Any(rule => rule.Value.Any()))
{
2022-04-19 19:43:58 -04:00
<h2 class="content-title mt-20">@ViewBag.Localization["WEBFRONT_ABOUT_COMMUNITY_GUIDELINES"]</h2>
}
2022-04-19 19:43:58 -04:00
<div class="card m-0 rounded">
@foreach (var ((serverName, id), rules) in allRules)
{
2022-04-19 19:43:58 -04:00
if (!rules.Any())
{
continue;
}
2022-04-19 19:43:58 -04:00
var start = 1;
<h5 class="text-primary mt-0">
2022-01-22 13:49:12 -05:00
<color-code value="@serverName"></color-code>
2022-04-19 19:43:58 -04:00
</h5>
@foreach (var rule in rules)
{
2022-04-19 19:43:58 -04:00
<div class="rule">
@if (!rule.StartsWith("#") && !Regex.IsMatch(rule.StripColors(), @"^(Rule ?#?)?\d+(.|\))"))
{
2022-04-19 19:43:58 -04:00
<span>@start.</span>
}
2022-04-19 19:43:58 -04:00
<span class="text-muted">
<color-code value="@rule"></color-code>
</span>
</div>
start++;
}
2022-04-19 19:43:58 -04:00
}
</div>
2022-01-22 13:49:12 -05:00
</div>