92 lines
3.5 KiB
Plaintext
92 lines
3.5 KiB
Plaintext
@using SharedLibraryCore.Configuration
|
|
@using System.Text.RegularExpressions
|
|
@model WebfrontCore.ViewModels.CommunityInfo
|
|
@{
|
|
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);
|
|
}
|
|
}
|
|
|
|
<div class="content text-wrap mt-20">
|
|
@if (Model.CommunityInformation.EnableBanner)
|
|
{
|
|
<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))
|
|
{
|
|
<h2 class="content-title">
|
|
<color-code value="@Model.CommunityInformation.Name"></color-code>
|
|
</h2>
|
|
}
|
|
|
|
|
|
<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>
|
|
<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))
|
|
{
|
|
var url = Uri.TryCreate(social.IconUrl, UriKind.Absolute, out var parsedUrl)
|
|
? parsedUrl.AbsoluteUri
|
|
: $"images/community/{social.IconUrl}";
|
|
<img class="img-fluid" style="max-width: 1rem; fill: white" src="@url" alt="@social.Title"/>
|
|
}
|
|
<span class="ml-1">@social.Title</span>
|
|
</a>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
</div>
|
|
|
|
@if (allRules.Any(rule => rule.Value.Any()))
|
|
{
|
|
<h2 class="content-title mt-20">@ViewBag.Localization["WEBFRONT_ABOUT_COMMUNITY_GUIDELINES"]</h2>
|
|
}
|
|
|
|
<div class="card m-0 rounded">
|
|
@foreach (var ((serverName, id), rules) in allRules)
|
|
{
|
|
if (!rules.Any())
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var start = 1;
|
|
<h5 class="text-primary mt-0">
|
|
<color-code value="@serverName"></color-code>
|
|
</h5>
|
|
@foreach (var rule in rules)
|
|
{
|
|
<div class="rule">
|
|
@if (!rule.StartsWith("#") && !Regex.IsMatch(rule, @"^\d+(.|\))"))
|
|
{
|
|
<span>@start.</span>
|
|
}
|
|
<span class="text-muted">
|
|
<color-code value="@rule"></color-code>
|
|
</span>
|
|
</div>
|
|
start++;
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|