Browse Source

Removing variable service

main
Jonathan 6 months ago
parent
commit
7680fae30b
  1. 7
      Components/Shared/FooterComponent.razor
  2. 5
      IGP/App.razor
  3. 1
      IGP/Program.cs
  4. 162
      IGP/wwwroot/generated/WebPageModels.json
  5. 52
      IGP/wwwroot/generated/WebSectionModels.json
  6. 7
      Services/IServices.cs
  7. 36
      Services/Website/VariableService.cs

7
Components/Shared/FooterComponent.razor

@ -1,5 +1,4 @@
@inject IVariableService VariableService
@using Model
<div class="footerContainer" xmlns="http://www.w3.org/1999/html">
<div class="footerSocials">
@ -24,10 +23,6 @@
<div class="footerDivider"></div>
<div class="footerLastUpdated">Website updated <a
href="https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/commits/main"><b>@VariableService.Variables["LastUpdated"]</b></a>
</div>
<div class="footerDisclaimer">
This website is fan-made and not affiliated with <b>SunSpear Games</b> in any way.
</div>

5
IGP/App.razor

@ -1,5 +1,4 @@
@inject IVariableService VariableService
@inject IStorageService StorageService
@inject IStorageService StorageService
@inject IPermissionService PermissionService
<Router AppAssembly="@typeof(App).Assembly">
@ -30,7 +29,6 @@
}
<style>
a {
color: white;
@ -85,7 +83,6 @@
protected override async Task OnInitializedAsync()
{
await VariableService.Load();
await StorageService.Load();
isLoaded = true;
StateHasChanged();

1
IGP/Program.cs

@ -59,7 +59,6 @@ builder.Services.AddScoped<IEntityDialogService, EntityDialogService>();
builder.Services.AddScoped<IToastService, ToastService>();
builder.Services.AddScoped<INoteService, NoteService>();
builder.Services.AddScoped<ISearchService, SearchService>();
builder.Services.AddScoped<IVariableService, VariableService>();
builder.Services.AddScoped<IStorageService, StorageService>();
builder.Services.AddScoped<IPermissionService, PermissionService>();
builder.Services.AddScoped<IEconomyComparisonService, EconomyComparisionService>();

162
IGP/wwwroot/generated/WebPageModels.json

@ -1,162 +0,0 @@
[
{
"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": "Milestones",
"Description": "Link to Milestones on GitHub",
"Href": "https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/milestones",
"IsPrivate": "False"
},
{
"Id": 9,
"WebSectionModelId": 4,
"Name": "Commits",
"Description": "Link to Commits on GitHub",
"Href": "https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/commits/main",
"IsPrivate": "False"
},
{
"Id": 10,
"WebSectionModelId": 4,
"Name": "Tasks",
"Description": "Link to Tasks on GitHub",
"Href": "https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/projects/3",
"IsPrivate": "False"
},
{
"Id": 11,
"WebSectionModelId": 4,
"Name": "Code",
"Description": "Link to Code on GitHub",
"Href": "https://github.com/JonathanMcCaffrey/IGP-Fan-Reference",
"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": "Wiki",
"Description": "Link to Wiki on GitHub",
"Href": "https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/wiki",
"IsPrivate": "False"
},
{
"Id": 17,
"WebSectionModelId": 5,
"Name": "Permissions",
"Description": "Permission Settings",
"Href": "permissions",
"IsPrivate": "False"
},
{
"Id": 18,
"WebSectionModelId": 5,
"Name": "Data Collection",
"Description": "Data Collection Settings",
"Href": "data-collection",
"IsPrivate": "True"
},
{
"Id": 19,
"WebSectionModelId": 5,
"Name": "Storage",
"Description": "Storage Settings",
"Href": "storage",
"IsPrivate": "False"
},
{
"Id": 20,
"WebSectionModelId": 1,
"Name": "Economy Comparison",
"Description": "Compare economies",
"Href": "economy-comparison",
"IsPrivate": "False"
}
]

52
IGP/wwwroot/generated/WebSectionModels.json

@ -1,52 +0,0 @@
[
{
"Id": 1,
"Name": "Tools",
"Description": "Tools Stuff",
"Order": 1,
"IsPrivate": "False",
"Icon": "fa-screwdriver-wrench",
"OnlyIcon": false,
"WebPageModels": []
},
{
"Id": 2,
"Name": "Resources",
"Description": "Resources Stuff",
"Order": 2,
"IsPrivate": "False",
"Icon": "fa-toolbox",
"OnlyIcon": false,
"WebPageModels": []
},
{
"Id": 3,
"Name": "General",
"Description": "About Stuff",
"Order": 3,
"IsPrivate": "False",
"Icon": "fa-circle-info",
"OnlyIcon": false,
"WebPageModels": []
},
{
"Id": 4,
"Name": "Development",
"Description": "Development Stuff",
"Order": 4,
"IsPrivate": "False",
"Icon": "fa-code",
"OnlyIcon": false,
"WebPageModels": []
},
{
"Id": 5,
"Name": "Settings",
"Description": "Settings Stuff",
"Order": 5,
"IsPrivate": "False",
"Icon": "fa-gear",
"OnlyIcon": false,
"WebPageModels": []
}
]

7
Services/IServices.cs

@ -80,13 +80,6 @@ public interface IMyDialogService
public void Hide();
}
public interface IVariableService
{
public Dictionary<string, string> Variables { get; set; }
public Task Load();
public bool IsLoaded();
}
public interface IEconomyComparisonService
{
public List<BuildToCompareModel> BuildsToCompare { get; set; }

36
Services/Website/VariableService.cs

@ -1,36 +0,0 @@
using System.Net.Http.Json;
using Model;
namespace Services.Website;
public class VariableService : IVariableService
{
private readonly HttpClient httpClient;
private bool isLoaded;
public VariableService(HttpClient httpClient)
{
this.httpClient = httpClient;
}
public Dictionary<string, string> Variables { get; set; } = new();
public bool IsLoaded()
{
return isLoaded;
}
public async Task Load()
{
if (isLoaded) return;
var variables = (await httpClient.GetFromJsonAsync<Variable[]>("generated/Variables.json"))!
.ToList();
foreach (var variable in variables) Variables.Add(variable.Key, variable.Value);
isLoaded = true;
}
}
Loading…
Cancel
Save