< Summary

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

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_DisplayLabel()100%11100%

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{
 11    private static readonly IReadOnlyList<TutorialPageTypeOption> _all = BuildAll();
 12
 13    public static IReadOnlyList<TutorialPageTypeOption> All => _all;
 14
 15    public static TutorialPageTypeOption? Find(string? pageType)
 16    {
 17        if (string.IsNullOrWhiteSpace(pageType))
 18        {
 19            return null;
 20        }
 21
 22        return _all.FirstOrDefault(option =>
 23            string.Equals(option.PageType, pageType.Trim(), StringComparison.OrdinalIgnoreCase));
 24    }
 25
 26    private static IReadOnlyList<TutorialPageTypeOption> BuildAll()
 27    {
 28        var pageOptions = new List<TutorialPageTypeOption>
 29        {
 30            new("Page:Default", "Default Tutorial"),
 31            new("Page:Dashboard", "Dashboard"),
 32            new("Page:Settings", "Settings"),
 33            new("Page:WorldDetail", "World Detail"),
 34            new("Page:MapListing", "World Map Listing"),
 35            new("Page:MapDetail", "Map Detail"),
 36            new("Page:CampaignDetail", "Campaign Detail"),
 37            new("Page:ArcDetail", "Arc Detail"),
 38            new("Page:SessionDetail", "Session Detail"),
 39            new("Page:Search", "Search"),
 40            new("Page:AdminUtilities", "Admin Utilities"),
 41            new("Page:AdminStatus", "Admin Status"),
 42            new("Page:Cosmos", "Cosmos"),
 43            new("Page:About", "About"),
 44            new("Page:GettingStarted", "Getting Started"),
 45            new("Page:ChangeLog", "Change Log"),
 46            new("Page:Privacy", "Privacy"),
 47            new("Page:TermsOfService", "Terms of Service"),
 48            new("Page:Licenses", "Licenses")
 49        };
 50
 51        var articleOptions = new List<TutorialPageTypeOption>
 52        {
 53            new("ArticleType:Any", "Any Article")
 54        };
 55
 56        articleOptions.AddRange(
 57            Enum.GetValues<ArticleType>()
 58                .Where(articleType => articleType != ArticleType.Tutorial)
 59                .Select(articleType => new TutorialPageTypeOption(
 60                    $"ArticleType:{articleType}",
 61                    GetArticleTypeDisplayName(articleType)))
 62                .OrderBy(option => option.PageType, StringComparer.Ordinal));
 63
 64        return pageOptions.Concat(articleOptions).ToList();
 65    }
 66
 67    private static string GetArticleTypeDisplayName(ArticleType articleType) => articleType switch
 68    {
 69        ArticleType.WikiArticle => "Wiki Articles",
 70        ArticleType.Character => "Character Articles",
 71        ArticleType.CharacterNote => "Character Notes",
 72        ArticleType.Session => "Session Articles",
 73        ArticleType.SessionNote => "Session Notes",
 74        ArticleType.Legacy => "Legacy Articles",
 75        _ => articleType.ToString()
 76    };
 77}
 78
 79public sealed record TutorialPageTypeOption(string PageType, string DefaultName)
 80{
 181    public string DisplayLabel => $"{PageType} ({DefaultName})";
 82}
 83
 84

Methods/Properties

get_DisplayLabel()