2021-10-10 11:44:18 -04:00
|
|
|
@using SharedLibraryCore.Configuration
|
2022-04-09 11:16:34 -04:00
|
|
|
@using System.Text.RegularExpressions
|
2021-10-10 11:44:18 -04:00
|
|
|
@model WebfrontCore.ViewModels.CommunityInfo
|
2021-10-09 22:11:47 -04:00
|
|
|
@{
|
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) };
|
2021-10-10 11:44:18 -04:00
|
|
|
var serverRules = Model.ServerRules?.Where(server => server.Value != null && server.Value.Any()).ToList();
|
|
|
|
if (serverRules?.Any() ?? false)
|
|
|
|
{
|
|
|
|
allRules = allRules.Union(serverRules);
|
|
|
|
}
|
2021-10-09 22:11:47 -04:00
|
|
|
}
|
|
|
|
|
2022-04-19 19:43:58 -04:00
|
|
|
<div class="content text-wrap mt-20">
|
2021-10-09 22:11:47 -04:00
|
|
|
@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"/>
|
2021-10-09 22:11:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@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>
|
2021-10-09 22:11:47 -04:00
|
|
|
</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>())
|
2021-10-09 22:11:47 -04:00
|
|
|
{
|
|
|
|
<div>
|
|
|
|
<a href="@social.Url" target="_blank" title="@social.Title">
|
|
|
|
@if (!string.IsNullOrWhiteSpace(social.IconId))
|
|
|
|
{
|
|
|
|
<span class="oi @social.IconId"></span>
|
|
|
|
}
|
|
|
|
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}";
|
2021-10-09 22:11:47 -04:00
|
|
|
<img class="img-fluid" style="max-width: 1rem; fill: white" src="@url" alt="@social.Title"/>
|
|
|
|
}
|
2021-10-16 14:30:26 -04:00
|
|
|
<span class="ml-1">@social.Title</span>
|
2021-10-09 22:11:47 -04:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
2022-04-19 19:43:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
2021-10-09 22:11:47 -04:00
|
|
|
|
2021-10-10 11:44:18 -04:00
|
|
|
@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>
|
2021-10-10 11:44:18 -04:00
|
|
|
}
|
2021-10-09 22:11:47 -04:00
|
|
|
|
2022-04-19 19:43:58 -04:00
|
|
|
<div class="card m-0 rounded">
|
|
|
|
@foreach (var ((serverName, id), rules) in allRules)
|
2021-10-09 22:11:47 -04:00
|
|
|
{
|
2022-04-19 19:43:58 -04:00
|
|
|
if (!rules.Any())
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2021-10-09 22:11:47 -04:00
|
|
|
|
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>
|
2021-10-09 22:11:47 -04:00
|
|
|
@foreach (var rule in rules)
|
|
|
|
{
|
2022-04-19 19:43:58 -04:00
|
|
|
<div class="rule">
|
2022-04-09 11:16:34 -04:00
|
|
|
@if (!rule.StartsWith("#") && !Regex.IsMatch(rule, @"^\d+(.|\))"))
|
|
|
|
{
|
2022-04-19 19:43:58 -04:00
|
|
|
<span>@start.</span>
|
2022-04-09 11:16:34 -04:00
|
|
|
}
|
2022-04-19 19:43:58 -04:00
|
|
|
<span class="text-muted">
|
|
|
|
<color-code value="@rule"></color-code>
|
|
|
|
</span>
|
2021-10-09 22:11:47 -04:00
|
|
|
</div>
|
|
|
|
start++;
|
|
|
|
}
|
2022-04-19 19:43:58 -04:00
|
|
|
}
|
|
|
|
</div>
|
2022-01-22 13:49:12 -05:00
|
|
|
</div>
|