From 1939bbe70abe2abdc3832c1843af327619cd0ecb Mon Sep 17 00:00:00 2001 From: Jonathan McCaffrey Date: Mon, 11 Apr 2022 23:31:23 -0400 Subject: [PATCH] feat(Docs) Added FrontMatter and Git edit links --- Components/Inputs/EditLinkComponent.razor | 28 ++++++ IGP/Database.db | Bin 278528 -> 278528 bytes IGP/IGP.csproj | 10 ++ .../BuildCalculator/BuildCalculatorPage.razor | 6 +- .../Parts/ChartComponent.razor | 4 +- IGP/Pages/Comparision/ComparisionPage.razor | 4 +- .../Parts/DocumentComponent.razor | 40 ++++++-- .../Parts/DocumentNavComponent.razor | 3 +- IGP/Pages/Notes/Parts/NoteComponent.razor | 36 +++++-- IGP/Pages/Notes/Parts/NoteNavComponent.razor | 5 +- .../Utils/Interval.cs | 2 +- IGP/Utils/Markdown.cs | 51 ++++++++++ IGP/Utils/Project.cs | 6 ++ IGP/_Imports.razor | 2 +- IGP/wwwroot/content/docs/cheat-sheet.md | 7 ++ IGP/wwwroot/content/docs/project-data.md | 17 ++-- IGP/wwwroot/content/docs/setup.md | 8 ++ IGP/wwwroot/content/notes/coop/holdout.md | 83 +++++----------- .../notes/coop-holdout/CoopBaseLarge.png | Bin 0 -> 321527 bytes .../image/notes/coop-holdout/DefendPoints.png | Bin 0 -> 391597 bytes .../image/notes/coop-holdout/EnemySpawns.png | Bin 0 -> 384775 bytes .../image/notes/coop-holdout/Multipliers.png | Bin 0 -> 383627 bytes .../image/notes/coop-holdout/OpenBases.png | Bin 0 -> 391181 bytes .../coop/image/notes/coop-holdout/Pyre.png | Bin 0 -> 385639 bytes IGP/wwwroot/generated/GitChangeModels.json | 2 +- IGP/wwwroot/generated/GitPatchModels.json | 2 +- IGP/wwwroot/markdown/documentation/setup.md | 90 ------------------ IGP/wwwroot/markdown/notes/coop.md | 54 ----------- Model/Doc/DocFrontMatterModel.cs | 12 +++ Model/Notes/NoteFrontMatterModel.cs | 12 +++ Services/Development/DocumentationService.cs | 41 +------- 31 files changed, 240 insertions(+), 285 deletions(-) create mode 100644 Components/Inputs/EditLinkComponent.razor rename Components/Utils/ProductionService.cs => IGP/Utils/Interval.cs (82%) create mode 100644 IGP/Utils/Markdown.cs create mode 100644 IGP/Utils/Project.cs create mode 100644 IGP/wwwroot/content/notes/coop/image/notes/coop-holdout/CoopBaseLarge.png create mode 100644 IGP/wwwroot/content/notes/coop/image/notes/coop-holdout/DefendPoints.png create mode 100644 IGP/wwwroot/content/notes/coop/image/notes/coop-holdout/EnemySpawns.png create mode 100644 IGP/wwwroot/content/notes/coop/image/notes/coop-holdout/Multipliers.png create mode 100644 IGP/wwwroot/content/notes/coop/image/notes/coop-holdout/OpenBases.png create mode 100644 IGP/wwwroot/content/notes/coop/image/notes/coop-holdout/Pyre.png delete mode 100644 IGP/wwwroot/markdown/documentation/setup.md delete mode 100644 IGP/wwwroot/markdown/notes/coop.md create mode 100644 Model/Doc/DocFrontMatterModel.cs create mode 100644 Model/Notes/NoteFrontMatterModel.cs diff --git a/Components/Inputs/EditLinkComponent.razor b/Components/Inputs/EditLinkComponent.razor new file mode 100644 index 0000000..16e5ddf --- /dev/null +++ b/Components/Inputs/EditLinkComponent.razor @@ -0,0 +1,28 @@ + + Edit on GitHub + + + + +@code { + + [Parameter] + public string Href { get; set; } = ""; +} \ No newline at end of file diff --git a/IGP/Database.db b/IGP/Database.db index 39f1680753965a2dd9b97a6a373ebe5cb0e3ea44..d68625473529da1107a5fab3f5c4774cac3db2b0 100644 GIT binary patch delta 318 zcmXX>O-lkn7ng?a%(W8*>eY2S{Gjn|EBP&yyUWYXwr^s20bd%4|wu8=Pj zN=*6~eh%|n#EEk=_F%`k>3l5B_8jM~HN9_5tx0QY55LK#U4D*^NYS>-CiG+7_7|On zh_&8tucc{)d2OzG?vc9mfw>&2N~2*Of~$If%op+okPFS~5~1@ShlY^oXQ9fvqRF&S vF7$+y;OjrEBbeV@B8RSEaC&kK4dr#1)<)q;rdhUxOkaCAyE6HDBioO^KB{SG delta 127 zcmZo@5Nv1=+~DLdCM~SMtj*}2S>l|Ln3taFo1c=JQ|z)i!hekbvowFgWcCE}&4L0- z{F6VdXW5*Rzd(Umn(NAB_6Z=-X#dTzlR*#_f6M bn5I2sR%E(1oqYqdGf=vRY5TQJ%v!ww#tJSH diff --git a/IGP/IGP.csproj b/IGP/IGP.csproj index fd3e42b..3717b1c 100644 --- a/IGP/IGP.csproj +++ b/IGP/IGP.csproj @@ -61,4 +61,14 @@ + + <_ContentIncludedByDefault Remove="wwwroot\content\notes\coop\image\notes\map-lostprovince\Map_LostProvince.png" /> + <_ContentIncludedByDefault Remove="wwwroot\image\notes\coop-holdout\CoopBaseLarge.png" /> + <_ContentIncludedByDefault Remove="wwwroot\image\notes\coop-holdout\DefendPoints.png" /> + <_ContentIncludedByDefault Remove="wwwroot\image\notes\coop-holdout\EnemySpawns.png" /> + <_ContentIncludedByDefault Remove="wwwroot\image\notes\coop-holdout\Multipliers.png" /> + <_ContentIncludedByDefault Remove="wwwroot\image\notes\coop-holdout\OpenBases.png" /> + <_ContentIncludedByDefault Remove="wwwroot\image\notes\coop-holdout\Pyre.png" /> + + diff --git a/IGP/Pages/BuildCalculator/BuildCalculatorPage.razor b/IGP/Pages/BuildCalculator/BuildCalculatorPage.razor index 11feb6f..36a13fa 100644 --- a/IGP/Pages/BuildCalculator/BuildCalculatorPage.razor +++ b/IGP/Pages/BuildCalculator/BuildCalculatorPage.razor @@ -207,8 +207,7 @@ padding-left: 2px; padding-right: 2px; } - - + .gridItem { padding: 0px; border: 0px; @@ -264,12 +263,13 @@ var faction = filterService.GetFactionType(); var immortal = filterService.GetImmortalType(); - var entity = EntityModel.GetFrom(hotkey, hotkeyGroup, isHoldSpace, faction, immortal); + EntityModel? entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal); if (entity == null) { return; } + if (buildOrderService.Add(entity, economyService, toastService)) { economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); diff --git a/IGP/Pages/BuildCalculator/Parts/ChartComponent.razor b/IGP/Pages/BuildCalculator/Parts/ChartComponent.razor index 305ea18..b0068e4 100644 --- a/IGP/Pages/BuildCalculator/Parts/ChartComponent.razor +++ b/IGP/Pages/BuildCalculator/Parts/ChartComponent.razor @@ -58,9 +58,7 @@ [Inject] IBuildOrderService BuildOrderService { get; set; } = default!; - - int height = 100; - readonly int width = 250; + private readonly int width = 250; List valueList = new(); diff --git a/IGP/Pages/Comparision/ComparisionPage.razor b/IGP/Pages/Comparision/ComparisionPage.razor index 5ad0c11..ada7939 100644 --- a/IGP/Pages/Comparision/ComparisionPage.razor +++ b/IGP/Pages/Comparision/ComparisionPage.razor @@ -21,7 +21,7 @@ grid-template-areas: 'loader sand compare compare' ;">
Comparision Charts - +
@@ -90,7 +90,7 @@ grid-template-areas: 'loader sand compare compare' ;"> return; } - var entity = EntityModel.GetFrom(hotkey, hotkeyGroup, isHoldSpace, faction, immortal); + var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal); if (entity == null) { return; diff --git a/IGP/Pages/Documentation/Parts/DocumentComponent.razor b/IGP/Pages/Documentation/Parts/DocumentComponent.razor index 3229a66..95267a8 100644 --- a/IGP/Pages/Documentation/Parts/DocumentComponent.razor +++ b/IGP/Pages/Documentation/Parts/DocumentComponent.razor @@ -1,4 +1,7 @@ @using System.Net.Http.Json +@using Markdig.Extensions.Yaml +@using Markdig.Syntax +@using YamlDotNet.Serialization @inject HttpClient httpClient @if (content == null) @@ -9,15 +12,17 @@ else {
-
@DocContentModel.Name
- +
@docFrontMatter.Title
-
Updated: @DocContentModel.UpdatedDate.ToString("MM/dd/yyyy")
-
Created: @DocContentModel.CreatedDate.ToString("MM/dd/yyyy")
+
Updated: @docFrontMatter.UpdatedDate.ToString("MM/dd/yyyy")
+
Created: @docFrontMatter.CreatedDate.ToString("MM/dd/yyyy")
-
@((MarkupString)Markdown.ToHtml(content, pipeline))
+
@((MarkupString)Markdown.ToHtml(content, Pipeline))
+
+ + } @code { - [Parameter] - public DocContentModel DocContentModel { get; set; } = default!; + [Parameter] public DocContentModel DocContentModel { get; set; } = default!; + + DocFrontMatterModel docFrontMatter = null!; + private string? content = null; - MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); - string? content = null; - private async Task LoadContent() => content = await httpClient.GetStringAsync($"content/docs/{DocContentModel.Content}.md"); + private string Filepath => $"content/docs/{DocContentModel.Content}.md"; + private string GitUrl => $"{Project.GitResourcesUrl}/{Filepath}"; + private MarkdownPipeline Pipeline => MarkdownFiles.Pipeline; + + private async Task LoadContent() { + content = await MarkdownFiles.LoadMarkdown(httpClient, Filepath); + + return docFrontMatter = + await MarkdownFiles.LoadFrontMatter(httpClient, Filepath); + } + protected override async Task OnParametersSetAsync() => await LoadContent(); protected override async Task OnInitializedAsync() => await LoadContent(); } \ No newline at end of file diff --git a/IGP/Pages/Documentation/Parts/DocumentNavComponent.razor b/IGP/Pages/Documentation/Parts/DocumentNavComponent.razor index 3a69645..6db302a 100644 --- a/IGP/Pages/Documentation/Parts/DocumentNavComponent.razor +++ b/IGP/Pages/Documentation/Parts/DocumentNavComponent.razor @@ -13,7 +13,8 @@ .docNavContainer { display: flex; flex-direction: column; - } + gap: 8px; + } .docNavButton a { color: white; diff --git a/IGP/Pages/Notes/Parts/NoteComponent.razor b/IGP/Pages/Notes/Parts/NoteComponent.razor index ae27af8..1e89b62 100644 --- a/IGP/Pages/Notes/Parts/NoteComponent.razor +++ b/IGP/Pages/Notes/Parts/NoteComponent.razor @@ -8,14 +8,14 @@ else {
-
@NoteContentModel.Name
- +
@noteFrontMatter.Title
-
Updated: @NoteContentModel.UpdatedDate.ToString("MM/dd/yyyy")
-
Created: @NoteContentModel.CreatedDate.ToString("MM/dd/yyyy")
+
Updated: @noteFrontMatter.UpdatedDate.ToString("MM/dd/yyyy")
+
Created: @noteFrontMatter.CreatedDate.ToString("MM/dd/yyyy")
-
@((MarkupString)Markdown.ToHtml(content, pipeline))
+
@((MarkupString)Markdown.ToHtml(content, Pipeline))
+
} @@ -34,15 +34,31 @@ else flex-direction: column; } + + .noteFooter { + display: flex; + justify-content: flex-end; + } + @code { - [Parameter] - public NoteContentModel NoteContentModel { get; set; } = default!; + [Parameter] public NoteContentModel NoteContentModel { get; set; } = default!; + + NoteFrontMatterModel noteFrontMatter = null!; + private string? content = null; - string? content = null; - MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); - private async Task LoadContent() => content = await httpClient.GetStringAsync($"content/notes/{NoteContentModel.Content}.md"); + private string Filepath => $"content/notes/{NoteContentModel.Content}.md"; + private string GitUrl => $"{Project.GitResourcesUrl}/{Filepath}"; + private MarkdownPipeline Pipeline => MarkdownFiles.Pipeline; + + private async Task LoadContent() { + content = await MarkdownFiles.LoadMarkdown(httpClient, Filepath); + + return noteFrontMatter = + await MarkdownFiles.LoadFrontMatter(httpClient, Filepath); + } + protected override async Task OnParametersSetAsync() => await LoadContent(); protected override async Task OnInitializedAsync() => await LoadContent(); diff --git a/IGP/Pages/Notes/Parts/NoteNavComponent.razor b/IGP/Pages/Notes/Parts/NoteNavComponent.razor index 7244f57..1ffce15 100644 --- a/IGP/Pages/Notes/Parts/NoteNavComponent.razor +++ b/IGP/Pages/Notes/Parts/NoteNavComponent.razor @@ -11,8 +11,9 @@