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