17 changed files with 273 additions and 37 deletions
Binary file not shown.
@ -0,0 +1,141 @@
|
||||
@layout PageLayout |
||||
|
||||
@inject IDocumentationService DocumentationService |
||||
@using Markdig |
||||
@implements IDisposable |
||||
|
||||
@page "/docs" |
||||
|
||||
@if (!DocumentationService.IsLoaded()) |
||||
{ |
||||
<LoadingComponent></LoadingComponent> |
||||
} |
||||
else |
||||
{ |
||||
<LayoutMediumContentComponent> |
||||
<WebsiteTitleComponent>Documentation</WebsiteTitleComponent> |
||||
|
||||
<div class="section"> |
||||
<div for="docSection">Section: </div> |
||||
<div style="flex: 1"></div> |
||||
<select @oninput="OnSectionChanged" style="background-color: #36393F; width: 250px; margin-right: 16px;" name="docSection"> |
||||
<option value="All">All</option> |
||||
|
||||
</select> |
||||
</div> |
||||
|
||||
<div class="docsContainer"> |
||||
@foreach (var doc in DocumentationService.DocumentationModels) { |
||||
if (selectedSection != "All" && doc.Section != selectedSection) { |
||||
continue; |
||||
} |
||||
<PaperComponent> |
||||
<div style="display: flex; flex-direction: row;"> |
||||
<span style="font-weight: bold; font-style:italic;">@doc.Section</span> |
||||
<div style="flex: 1"></div> |
||||
<span style="font-weight: bold; font-style:italic;">Last Updated on @doc.UpdatedDate.ToString("MM/dd/yyyy")</span> |
||||
</div> |
||||
<div> |
||||
<div id="@doc.Id" style="font-weight: bold; font-size: 1.4rem;">@doc.Name</div> |
||||
<div>@((MarkupString)Markdown.ToHtml(doc.Description))</div> |
||||
</div> |
||||
</PaperComponent> |
||||
} |
||||
</div> |
||||
</LayoutMediumContentComponent> |
||||
|
||||
} |
||||
<style> |
||||
.section { |
||||
display: flex; |
||||
width: 500px; |
||||
flex-direction: row; |
||||
background-color: var(--paper); |
||||
justify-content: center; |
||||
padding: 24px; |
||||
border: 4px solid var(--paper-border); |
||||
box-shadow: 0px 6px var(--paper-border); |
||||
} |
||||
|
||||
.docsContainer { |
||||
display: flex; |
||||
flex-direction: column; |
||||
gap: 16px; |
||||
} |
||||
|
||||
|
||||
pre code { |
||||
color: white; |
||||
|
||||
} |
||||
|
||||
h1 { |
||||
display: block; |
||||
font-size: 2em; |
||||
margin-top: 0.67em; |
||||
margin-bottom: 0.67em; |
||||
margin-left: 0; |
||||
margin-right: 0; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
h2 { |
||||
display: block; |
||||
font-size: 1.5em; |
||||
margin-top: 0.83em; |
||||
margin-bottom: 0.83em; |
||||
margin-left: 0; |
||||
margin-right: 0; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
li { |
||||
display: list-item; |
||||
} |
||||
|
||||
p { |
||||
display: block; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
margin-left: 0; |
||||
margin-right: 0; |
||||
} |
||||
|
||||
ul { |
||||
display: block; |
||||
list-style-type: disc; |
||||
margin-top: 1em; |
||||
margin-bottom: 1em; |
||||
margin-left: 0; |
||||
margin-right: 0; |
||||
padding-left: 40px; |
||||
} |
||||
|
||||
pre { |
||||
background: black; |
||||
padding: 2px; |
||||
} |
||||
</style> |
||||
|
||||
@code { |
||||
|
||||
string selectedSection = "All"; |
||||
|
||||
protected override void OnInitialized() |
||||
{ |
||||
DocumentationService.Subscribe(StateHasChanged); |
||||
|
||||
DocumentationService.Load(); |
||||
} |
||||
|
||||
|
||||
public void Dispose() |
||||
{ |
||||
DocumentationService.Unsubscribe(StateHasChanged); |
||||
} |
||||
|
||||
void OnSectionChanged(ChangeEventArgs e) { |
||||
selectedSection = e.Value.ToString(); |
||||
StateHasChanged(); |
||||
} |
||||
} |
||||
@ -1 +1 @@
|
||||
[{"Id":1,"CreatedDate":"2022-03-30T00:00:00","UpdatedDate":"2022-03-30T00:00:00","Name":"Setup","Section":"Getting Started","Description":"# Setup\n\nThis document will contain general setup notes for the project.\n\n## Prerequisite\n\nTo understand content in this document, it is recommended to have some software development experience. Particularly using GitHub and Visual Studio.\n\n- [GitHub Documentation](https://docs.github.com/en/get-started)\n\n- [Visual Studio Documentation](https://visualstudio.microsoft.com/vs/getting-started/)\n\nTo make updates to this website, it is recommended to understand HTML/CSS and C#.\n\n- [C# Documentation](https://docs.microsoft.com/en-us/dotnet/csharp/)\n- [Mozilla\u0027s HTML Documentation](https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started)\n- [W3SCHOOLS\u0027 HTML Documentation](https://www.w3schools.com/html/)\n\nFurther, you should understand the product and clients this website is for. So it is recommended to play \u0022Immortal: Gates of Pyre\u0022.\n- [IGP Website](https://gatesofpyre.com/) \n - **Please Note:** This product currently has restricted access with it is in a pre-alpha state. If you are not aware or interested in IGP, I recommend to wait for product release. Otherwise, check out their discord for steps of getting access.\n\n\n## Installation\n\nDownload and install Visual Studio preview.\n\nhttps://visualstudio.microsoft.com/vs/preview/\n\nWhen installing, ensure you have selected \u0022Workloads | **ASP.NET and web development**\u0022 and \u0022Individual components | **.NET WebAssembly build tools**\u0022.\n\n## Download Project\n\nGet this project from GitHub. \n\n\u0060\u0060\u0060bash\ngit clone https://github.com/JonathanMcCaffrey/IGP-Fan-Reference.git\n\u0060\u0060\u0060\n\n## Project Tree\n\u0060\u0060\u0060\nC:.\n\u251C\u2500\u2500\u2500.github\n\u2502 \u2514\u2500\u2500\u2500workflows # Workflows to deploy website\n\u251C\u2500\u2500\u2500Components # Components used be website\n\u251C\u2500\u2500\u2500Contexts\n\u251C\u2500\u2500\u2500IGP\n\u2502 \u251C\u2500\u2500\u2500Pages # Website pages\n\u2502 \u2514\u2500\u2500\u2500wwwroot \n\u2502 \u251C\u2500\u2500\u2500css\n\u2502 \u251C\u2500\u2500\u2500generated # Files generated by IGP_Convert. Do not edit\n\u2502 \u251C\u2500\u2500\u2500image\n\u2502 \u251C\u2500\u2500\u2500javascript\n\u2502 \u2514\u2500\u2500\u2500markdown\n\u2502 \u2514\u2500\u2500\u2500documentation # Documentation files\n\u251C\u2500\u2500\u2500IGP_Convert # Converts SQL into JSON for Blazor Wasm\n\u251C\u2500\u2500\u2500Model # Data models\n\u2514\u2500\u2500\u2500Services # Web services\n\u0060\u0060\u0060\n\n## Running\n\n- Open \u0060IGP/IGP.sln\u0060. \n- Click the green RUN button in Visual Studio.\n- A local copy of the IGP Website should have launched on your machine.\n\n\n## Publishing\n\n**Important:** publishing new version of the website will not occur until issue [39528](https://github.com/dotnet/aspnetcore/issues/39528) in dotnet/aspnetcore is resolved.\n\n\nCode committed to the \u0060main\u0060 branch will automatically be deployed to [production](https://www.igpfanreference.com/).\n\nCode committed to the \u0060develop\u0060 branch will automatically be deployed to [development](https://calm-mud-04916b210.1.azurestaticapps.net/).\n\n*This is handle via the files in \u0060.github/workflow\u0060. Look into these [GitHub Actions Documents](https://docs.github.com/en/actions) if curious about how this CI system works.*\n\n\n## Troubleshooting\n\nNothing that some good internet searches cannot resolved. But you can also contact the project maintainer on [IGP Fan Reference](https://discord.gg/uMq8bMGeeN) Discord.\n\n"}] |
||||
[{"Id":1,"CreatedDate":"2022-03-30T00:00:00","UpdatedDate":"2022-03-30T00:00:00","Name":"Setup","Section":"Getting Started","Description":"# Setup\n\nThis document will contain general setup notes for the project.\n\n## Prerequisite\n\nTo understand content in this document, it is recommended to have some software development experience. Particularly using GitHub and Visual Studio.\n\n- [GitHub Documentation](https://docs.github.com/en/get-started)\n\n- [Visual Studio Documentation](https://visualstudio.microsoft.com/vs/getting-started/)\n\nTo make updates to this website, it is recommended to understand HTML/CSS and C#.\n\n- [C# Documentation](https://docs.microsoft.com/en-us/dotnet/csharp/)\n- [Mozilla\u0027s HTML Documentation](https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started)\n- [W3SCHOOLS\u0027 HTML Documentation](https://www.w3schools.com/html/)\n\nFurther, you should understand the product and clients this website is for. So it is recommended to play \u0022Immortal: Gates of Pyre\u0022.\n- [IGP Website](https://gatesofpyre.com/) \n - **Please Note:** This product currently has restricted access with it is in a pre-alpha state. If you are not aware or interested in IGP, I recommend to wait for product release. Otherwise, check out their discord for steps of getting access.\n\n\n## Installation\n\nDownload and install Visual Studio preview.\n\nhttps://visualstudio.microsoft.com/vs/preview/\n\nWhen installing, ensure you have selected \u0022Workloads | **ASP.NET and web development**\u0022 and \u0022Individual components | **.NET WebAssembly build tools**\u0022.\n\n## Download Project\n\nGet this project from GitHub. \n\n\u0060\u0060\u0060bash\ngit clone https://github.com/JonathanMcCaffrey/IGP-Fan-Reference.git\n\u0060\u0060\u0060\n\n## Project Tree\n\u0060\u0060\u0060\nC:.\n\u251C\u2500\u2500\u2500.github\n\u2502 \u2514\u2500\u2500\u2500workflows # Workflows to deploy website\n\u251C\u2500\u2500\u2500Components # Components used be website\n\u251C\u2500\u2500\u2500Contexts\n\u251C\u2500\u2500\u2500IGP\n\u2502 \u251C\u2500\u2500\u2500Pages # Website pages\n\u2502 \u2514\u2500\u2500\u2500wwwroot \n\u2502 \u251C\u2500\u2500\u2500css\n\u2502 \u251C\u2500\u2500\u2500generated # Files generated by IGP_Convert. Do not edit\n\u2502 \u251C\u2500\u2500\u2500image\n\u2502 \u251C\u2500\u2500\u2500javascript\n\u2502 \u2514\u2500\u2500\u2500markdown\n\u2502 \u2514\u2500\u2500\u2500documentation # Documentation files\n\u251C\u2500\u2500\u2500IGP_Convert # Converts SQL into JSON for Blazor Wasm\n\u251C\u2500\u2500\u2500Model # Data models\n\u2514\u2500\u2500\u2500Services # Web services\n\u0060\u0060\u0060\n\n## Running\n\n- Open \u0060IGP/IGP.sln\u0060. \n- Click the green RUN button in Visual Studio.\n- A local copy of the IGP Website should have launched on your machine.\n\n\n## Publishing\n\nCode committed to the \u0060main\u0060 branch will automatically be deployed to [production](https://www.igpfanreference.com/).\n\nCode committed to the \u0060develop\u0060 branch will automatically be deployed to [development](https://calm-mud-04916b210.1.azurestaticapps.net/).\n\n*This is handle via the files in \u0060.github/workflow\u0060. Look into these [GitHub Actions Documents](https://docs.github.com/en/actions) if curious about how this CI system works.*\n\n\n## Troubleshooting\n\nNothing that some good internet searches cannot resolved. But you can also contact the project maintainer on [IGP Fan Reference](https://discord.gg/uMq8bMGeeN) Discord.\n\n"}] |
||||
@ -1 +1 @@
|
||||
[{"Id":1,"WebSectionModelId":2,"Name":"Database","Description":"Database of game information","Href":"database","IsPrivate":"False"},{"Id":2,"WebSectionModelId":1,"Name":"Build Calculator","Description":"Build order calculator for determining army timings","Href":"build-calculator","IsPrivate":"False"},{"Id":3,"WebSectionModelId":1,"Name":"Harass Calculator","Description":"Alloy harassment calculator","Href":"harass-calculator","IsPrivate":"False"},{"Id":4,"WebSectionModelId":1,"Name":"Memory Tester","Description":"Testing memory","Href":"memory-tester","IsPrivate":"False"},{"Id":5,"WebSectionModelId":1,"Name":"Comparion Charts","Description":"Ecnomy charts to compare build orders","Href":"comparison-charts","IsPrivate":"True"},{"Id":6,"WebSectionModelId":2,"Name":"Notes","Description":"General player notes","Href":"notes","IsPrivate":"False"},{"Id":7,"WebSectionModelId":2,"Name":"Key Mapping","Description":"General key mapping info","Href":"keymapping","IsPrivate":"True"},{"Id":8,"WebSectionModelId":4,"Name":"Road Map","Description":"Plans for this website","Href":"roadmap","IsPrivate":"False"},{"Id":9,"WebSectionModelId":4,"Name":"Change Log","Description":"Past updates to the website","Href":"changelog","IsPrivate":"False"},{"Id":10,"WebSectionModelId":4,"Name":"Agile","Description":"Showing agile view of this website","Href":"agile","IsPrivate":"False"},{"Id":11,"WebSectionModelId":4,"Name":"Making Of","Description":"Explaining development details of this website","Href":"makingof","IsPrivate":"False"},{"Id":12,"WebSectionModelId":2,"Name":"Documentation","Description":"Explaining how to use this website","Href":"documentation","IsPrivate":"True"},{"Id":13,"WebSectionModelId":3,"Name":"About","Description":"Answering general questions on the website","Href":"about","IsPrivate":"False"},{"Id":14,"WebSectionModelId":3,"Name":"Contact","Description":"My contact info","Href":"contact","IsPrivate":"False"},{"Id":15,"WebSectionModelId":3,"Name":"Streams","Description":"Stream info","Href":"streams","IsPrivate":"False"}] |
||||
[{"Id":1,"WebSectionModelId":2,"Name":"Database","Description":"Database of game information","Href":"database","IsPrivate":"False"},{"Id":2,"WebSectionModelId":1,"Name":"Build Calculator","Description":"Build order calculator for determining army timings","Href":"build-calculator","IsPrivate":"False"},{"Id":3,"WebSectionModelId":1,"Name":"Harass Calculator","Description":"Alloy harassment calculator","Href":"harass-calculator","IsPrivate":"False"},{"Id":4,"WebSectionModelId":1,"Name":"Memory Tester","Description":"Testing memory","Href":"memory-tester","IsPrivate":"False"},{"Id":5,"WebSectionModelId":1,"Name":"Comparion Charts","Description":"Ecnomy charts to compare build orders","Href":"comparison-charts","IsPrivate":"True"},{"Id":6,"WebSectionModelId":2,"Name":"Notes","Description":"General player notes","Href":"notes","IsPrivate":"False"},{"Id":7,"WebSectionModelId":2,"Name":"Key Mapping","Description":"General key mapping info","Href":"keymapping","IsPrivate":"True"},{"Id":8,"WebSectionModelId":4,"Name":"Road Map","Description":"Plans for this website","Href":"roadmap","IsPrivate":"False"},{"Id":9,"WebSectionModelId":4,"Name":"Change Log","Description":"Past updates to the website","Href":"changelog","IsPrivate":"False"},{"Id":10,"WebSectionModelId":4,"Name":"Agile","Description":"Showing agile view of this website","Href":"agile","IsPrivate":"False"},{"Id":11,"WebSectionModelId":4,"Name":"Making Of","Description":"Explaining development details of this website","Href":"makingof","IsPrivate":"False"},{"Id":12,"WebSectionModelId":2,"Name":"Documentation","Description":"Explaining how to use this website","Href":"documentation","IsPrivate":"True"},{"Id":13,"WebSectionModelId":3,"Name":"About","Description":"Answering general questions on the website","Href":"about","IsPrivate":"False"},{"Id":14,"WebSectionModelId":3,"Name":"Contact","Description":"My contact info","Href":"contact","IsPrivate":"False"},{"Id":15,"WebSectionModelId":3,"Name":"Streams","Description":"Stream info","Href":"streams","IsPrivate":"False"},{"Id":16,"WebSectionModelId":4,"Name":"Documentation","Description":"Development information","Href":"docs","IsPrivate":"False"}] |
||||
@ -0,0 +1,71 @@
|
||||
using System.Net.Http.Json; |
||||
using Model.Documentation; |
||||
|
||||
#if NO_SQL |
||||
|
||||
#else |
||||
using Contexts; |
||||
using Microsoft.EntityFrameworkCore; |
||||
#endif |
||||
|
||||
namespace Services.Development; |
||||
|
||||
public class DocumentationService : IDocumentationService |
||||
{ |
||||
private readonly HttpClient httpClient; |
||||
|
||||
private bool isLoaded; |
||||
|
||||
|
||||
private event Action _onChange; |
||||
|
||||
|
||||
public DocumentationService(HttpClient httpClient) |
||||
{ |
||||
this.httpClient = httpClient; |
||||
} |
||||
|
||||
public List<DocumentationModel> DocumentationModels { get; set; } |
||||
|
||||
|
||||
public void Subscribe(Action action) |
||||
{ |
||||
_onChange += action; |
||||
} |
||||
|
||||
public void Unsubscribe(Action action) |
||||
{ |
||||
_onChange -= action; |
||||
} |
||||
|
||||
public bool IsLoaded() |
||||
{ |
||||
return isLoaded; |
||||
} |
||||
|
||||
|
||||
public async Task Load() |
||||
{ |
||||
if (isLoaded) return; |
||||
|
||||
DocumentationModels = |
||||
(await httpClient.GetFromJsonAsync<DocumentationModel[]>("generated/DocumentationModels.json") ?? Array.Empty<DocumentationModel>()).ToList(); |
||||
|
||||
|
||||
isLoaded = true; |
||||
|
||||
NotifyDataChanged(); |
||||
} |
||||
|
||||
|
||||
public void Update() |
||||
{ |
||||
NotifyDataChanged(); |
||||
} |
||||
|
||||
|
||||
private void NotifyDataChanged() |
||||
{ |
||||
_onChange?.Invoke(); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue