< Summary

Information
Class: Chronicis.Client.Components.Admin.TutorialPageTypes
Assembly: Chronicis.Client
File(s): /home/runner/work/chronicis/chronicis/src/Chronicis.Client/Components/Admin/TutorialPageTypes.cs
Line coverage
100%
Covered lines: 50
Uncovered lines: 0
Coverable lines: 50
Total lines: 84
Line coverage: 100%
Branch coverage
100%
Covered branches: 14
Total branches: 14
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
get_All()100%11100%
Find(...)100%22100%
BuildAll()100%11100%
GetArticleTypeDisplayName(...)100%1212100%

File(s)

/home/runner/work/chronicis/chronicis/src/Chronicis.Client/Components/Admin/TutorialPageTypes.cs

#LineLine coverage
 1using Chronicis.Shared.Enums;
 2
 3namespace Chronicis.Client.Components.Admin;
 4
 5/// <summary>
 6/// Curated tutorial page-type options for the SysAdmin tutorial mapping UI.
 7/// Page entries are derived from the current Pages/*.razor routes and aligned to TutorialPageTypeResolver output.
 8/// </summary>
 9public static class TutorialPageTypes
 10{
 111    private static readonly IReadOnlyList<TutorialPageTypeOption> _all = BuildAll();
 12
 713    public static IReadOnlyList<TutorialPageTypeOption> All => _all;
 14
 15    public static TutorialPageTypeOption? Find(string? pageType)
 16    {
 617        if (string.IsNullOrWhiteSpace(pageType))
 18        {
 219            return null;
 20        }
 21
 422        return _all.FirstOrDefault(option =>
 423            string.Equals(option.PageType, pageType.Trim(), StringComparison.OrdinalIgnoreCase));
 24    }
 25
 26    private static IReadOnlyList<TutorialPageTypeOption> BuildAll()
 27    {
 128        var pageOptions = new List<TutorialPageTypeOption>
 129        {
 130            new("Page:Default", "Default Tutorial"),
 131            new("Page:Dashboard", "Dashboard"),
 132            new("Page:Settings", "Settings"),
 133            new("Page:WorldDetail", "World Detail"),
 134            new("Page:MapListing", "World Map Listing"),
 135            new("Page:MapDetail", "Map Detail"),
 136            new("Page:CampaignDetail", "Campaign Detail"),
 137            new("Page:ArcDetail", "Arc Detail"),
 138            new("Page:SessionDetail", "Session Detail"),
 139            new("Page:Search", "Search"),
 140            new("Page:AdminUtilities", "Admin Utilities"),
 141            new("Page:AdminStatus", "Admin Status"),
 142            new("Page:Cosmos", "Cosmos"),
 143            new("Page:About", "About"),
 144            new("Page:GettingStarted", "Getting Started"),
 145            new("Page:ChangeLog", "Change Log"),
 146            new("Page:Privacy", "Privacy"),
 147            new("Page:TermsOfService", "Terms of Service"),
 148            new("Page:Licenses", "Licenses")
 149        };
 50
 151        var articleOptions = new List<TutorialPageTypeOption>
 152        {
 153            new("ArticleType:Any", "Any Article")
 154        };
 55
 156        articleOptions.AddRange(
 157            Enum.GetValues<ArticleType>()
 158                .Where(articleType => articleType != ArticleType.Tutorial)
 159                .Select(articleType => new TutorialPageTypeOption(
 160                    $"ArticleType:{articleType}",
 161                    GetArticleTypeDisplayName(articleType)))
 162                .OrderBy(option => option.PageType, StringComparer.Ordinal));
 63
 164        return pageOptions.Concat(articleOptions).ToList();
 65    }
 66
 767    private static string GetArticleTypeDisplayName(ArticleType articleType) => articleType switch
 768    {
 169        ArticleType.WikiArticle => "Wiki Articles",
 170        ArticleType.Character => "Character Articles",
 171        ArticleType.CharacterNote => "Character Notes",
 172        ArticleType.Session => "Session Articles",
 173        ArticleType.SessionNote => "Session Notes",
 174        ArticleType.Legacy => "Legacy Articles",
 175        _ => articleType.ToString()
 776    };
 77}
 78
 79public sealed record TutorialPageTypeOption(string PageType, string DefaultName)
 80{
 81    public string DisplayLabel => $"{PageType} ({DefaultName})";
 82}
 83
 84