feat(DataCollection) Added opt-in data collection
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
|
||||
@page "/about"
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
@implements IDisposable;
|
||||
@inject IAgileService agileService;
|
||||
@inject IAgileService AgileService;
|
||||
|
||||
@layout PageLayout
|
||||
@inherits BasePage
|
||||
|
||||
@page "/agile"
|
||||
|
||||
@if (!agileService.IsLoaded())
|
||||
@if (!AgileService.IsLoaded())
|
||||
{
|
||||
<LoadingComponent/>
|
||||
}
|
||||
@@ -14,7 +15,7 @@ else
|
||||
<LayoutMediumContentComponent>
|
||||
<WebsiteTitleComponent>Agile</WebsiteTitleComponent>
|
||||
<div class="agileViewContainer">
|
||||
@foreach (var sprint in agileService.AgileSprintModels!
|
||||
@foreach (var sprint in AgileService.AgileSprintModels!
|
||||
.OrderBy(e => e.EndDate).Reverse())
|
||||
{
|
||||
<details class="sprintDisplayContainer @sprint.GetSprintType().ToLower()"
|
||||
@@ -80,22 +81,24 @@ else
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
agileService.Subscribe(HasChanged);
|
||||
base.OnInitialized();
|
||||
|
||||
AgileService.Subscribe(HasChanged);
|
||||
HasChanged();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
agileService.Unsubscribe(HasChanged);
|
||||
AgileService.Unsubscribe(HasChanged);
|
||||
}
|
||||
|
||||
void HasChanged()
|
||||
{
|
||||
if (!agileService.IsLoaded()) return;
|
||||
if (!AgileService.IsLoaded()) return;
|
||||
|
||||
backlog.Clear();
|
||||
|
||||
foreach (var task in agileService.AgileTaskModels!)
|
||||
foreach (var task in AgileService.AgileTaskModels!)
|
||||
{
|
||||
if (task.AgileSprintModelId == null)
|
||||
{
|
||||
@@ -108,7 +111,7 @@ else
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await agileService.Load();
|
||||
await AgileService.Load();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
@using Services.Website
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
CollectLoadedPage();
|
||||
}
|
||||
|
||||
private void CollectLoadedPage()
|
||||
{
|
||||
var skipBaseUri = NavigationManager.Uri.Substring(NavigationManager.BaseUri.Length,
|
||||
NavigationManager.Uri.Length - NavigationManager.BaseUri.Length);
|
||||
|
||||
var splitData = skipBaseUri.Split("/");
|
||||
|
||||
var rootUrl = splitData.First();
|
||||
if (rootUrl.Trim().Equals(""))
|
||||
{
|
||||
rootUrl = "home";
|
||||
}
|
||||
|
||||
var eventData = new Dictionary<string, string> { { "page", rootUrl }};
|
||||
if (splitData.Length > 1)
|
||||
{
|
||||
eventData["inner-page"] = splitData.Last();
|
||||
}
|
||||
|
||||
DataCollectionService.SendEvent(DataCollectionKeys.PageInitialized, eventData);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,20 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inject IStringLocalizer<Localizations> locale
|
||||
@inherits BasePage
|
||||
|
||||
@inject IKeyService keyService
|
||||
@inject IImmortalSelectionService filterService
|
||||
@inject IBuildOrderService buildOrderService
|
||||
@inject IEconomyService economyService
|
||||
@inject IToastService toastService
|
||||
@inject ITimingService timingService
|
||||
@inject IStringLocalizer<Localizations> Locale
|
||||
|
||||
@inject IKeyService KeyService
|
||||
@inject IImmortalSelectionService FilterService
|
||||
@inject IBuildOrderService BuildOrderService
|
||||
@inject IEconomyService EconomyService
|
||||
@inject IToastService ToastService
|
||||
@inject ITimingService TimingService
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
@page "/build-calculator"
|
||||
|
||||
@using Services.Website
|
||||
@implements IDisposable
|
||||
|
||||
<LayoutLargeContentComponent>
|
||||
@@ -29,18 +33,18 @@
|
||||
<div class="gridItem" style="grid-area: timing;">
|
||||
<ButtonComponent ButtonType="ButtonType.Secondary" OnClick="OnResetClicked">Clear Build Order</ButtonComponent>
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Timing Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Timing Info"]">
|
||||
<TimingComponent></TimingComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Filter Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Filter Info"]">
|
||||
<FilterComponent></FilterComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Options Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Options Info"]">
|
||||
<OptionsComponent></OptionsComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
@@ -49,7 +53,7 @@
|
||||
|
||||
<div class="gridItem" style="grid-area: chart;">
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Chart Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Chart Info"]">
|
||||
<BuildChartComponent></BuildChartComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
@@ -57,7 +61,7 @@
|
||||
|
||||
<div class="gridItem" style="grid-area: view;">
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Entity Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Entity Info"]">
|
||||
<EntityClickViewComponent/>
|
||||
</InfoTooltipComponent>
|
||||
|
||||
@@ -66,7 +70,7 @@
|
||||
|
||||
<div class="gridItem" style="grid-area: bank;">
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Bank Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Bank Info"]">
|
||||
<BankComponent></BankComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
@@ -74,7 +78,7 @@
|
||||
|
||||
<div class="gridItem" style="grid-area: army;">
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Army Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Army Info"]">
|
||||
<ArmyComponent></ArmyComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
@@ -82,7 +86,7 @@
|
||||
|
||||
<div class="gridItem gridKeys">
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Hotkey Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Hotkey Info"]">
|
||||
<HotkeyViewerComponent Size="80"></HotkeyViewerComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
@@ -90,7 +94,7 @@
|
||||
|
||||
<div class="gridItem" style="grid-area: highlights;">
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip Highlights Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip Highlights Info"]">
|
||||
<HighlightsComponent></HighlightsComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
@@ -98,7 +102,7 @@
|
||||
|
||||
<div class="gridItem" style="grid-area: buildorder;">
|
||||
<PanelComponent>
|
||||
<InfoTooltipComponent InfoText="@locale["Tooltip BuildOrder Info"]">
|
||||
<InfoTooltipComponent InfoText="@Locale["Tooltip BuildOrder Info"]">
|
||||
<BuildOrderComponent></BuildOrderComponent>
|
||||
</InfoTooltipComponent>
|
||||
</PanelComponent>
|
||||
@@ -216,32 +220,39 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
economyService.Calculate(buildOrderService, timingService, 0);
|
||||
base.OnInitialized();
|
||||
|
||||
EconomyService.Calculate(BuildOrderService, TimingService, 0);
|
||||
|
||||
keyService.Subscribe(HandleClick);
|
||||
KeyService.Subscribe(HandleClick);
|
||||
|
||||
DataCollectionService.SendEvent(
|
||||
DataCollectionKeys.PageInitialized,
|
||||
new Dictionary<string, string> {{"page", "build-calculator"}}
|
||||
);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
keyService.Unsubscribe(HandleClick);
|
||||
KeyService.Unsubscribe(HandleClick);
|
||||
}
|
||||
|
||||
private void OnResetClicked()
|
||||
{
|
||||
toastService.AddToast(new ToastModel
|
||||
ToastService.AddToast(new ToastModel
|
||||
{
|
||||
SeverityType = SeverityType.Success,
|
||||
Message = "Build order has been cleared.",
|
||||
Title = "Reset"
|
||||
});
|
||||
|
||||
buildOrderService.Reset();
|
||||
BuildOrderService.Reset();
|
||||
}
|
||||
|
||||
|
||||
private void HandleClick()
|
||||
{
|
||||
var hotkey = keyService.GetHotkey();
|
||||
var hotkey = KeyService.GetHotkey();
|
||||
|
||||
if (hotkey == "")
|
||||
{
|
||||
@@ -250,15 +261,15 @@
|
||||
|
||||
if (hotkey == "`")
|
||||
{
|
||||
buildOrderService.RemoveLast();
|
||||
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
|
||||
BuildOrderService.RemoveLast();
|
||||
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
|
||||
return;
|
||||
}
|
||||
|
||||
var hotkeyGroup = keyService.GetHotkeyGroup();
|
||||
var isHoldSpace = keyService.IsHoldingSpace();
|
||||
var faction = filterService.GetFaction();
|
||||
var immortal = filterService.GetImmortal();
|
||||
var hotkeyGroup = KeyService.GetHotkeyGroup();
|
||||
var isHoldSpace = KeyService.IsHoldingSpace();
|
||||
var faction = FilterService.GetFaction();
|
||||
var immortal = FilterService.GetImmortal();
|
||||
|
||||
var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal);
|
||||
|
||||
@@ -267,9 +278,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (buildOrderService.Add(entity, economyService))
|
||||
if (BuildOrderService.Add(entity, EconomyService))
|
||||
{
|
||||
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
|
||||
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
buildOrder.Subscribe(OnBuildOrderChanged);
|
||||
timingService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
BuildOrderService.Subscribe(OnBuildOrderChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ else
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
buildOrderService.Subscribe(OnBuilderOrderChanged);
|
||||
timingService.Subscribe(OnBuilderOrderChanged);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
buildOrderService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
KeyService.Subscribe(HandleClick);
|
||||
StorageService.Subscribe(RefreshDefaults);
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
economyService.Subscribe(StateHasChanged);
|
||||
buildOrderService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
@inject IJSRuntime jsRuntime;
|
||||
@inject IJSRuntime JsRuntime;
|
||||
@using Services.Website
|
||||
@implements IDisposable
|
||||
@inject IKeyService keyService
|
||||
@inject IBuildOrderService buildOrderService
|
||||
@inject IImmortalSelectionService filterService
|
||||
@inject IKeyService KeyService
|
||||
@inject IBuildOrderService BuildOrderService
|
||||
@inject IImmortalSelectionService FilterService
|
||||
|
||||
@inject IEconomyService economyService
|
||||
@inject ITimingService timingService
|
||||
@inject IToastService toastService
|
||||
@inject IEconomyService EconomyService
|
||||
@inject ITimingService TimingService
|
||||
@inject IToastService ToastService
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
|
||||
<InputPanelComponent>
|
||||
@@ -18,7 +20,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
var color = hotkey.KeyText.Equals("SPACE") && keyService.IsHoldingSpace() || keyService.GetAllPressedKeys().Contains(hotkey.KeyText)
|
||||
var color = hotkey.KeyText.Equals("SPACE") && KeyService.IsHoldingSpace() || KeyService.GetAllPressedKeys().Contains(hotkey.KeyText)
|
||||
? "#0a0f12" : hotkey.GetColor();
|
||||
|
||||
var x = hotkey.PositionX * Size;
|
||||
@@ -34,7 +36,7 @@
|
||||
border = "5px solid green";
|
||||
}
|
||||
|
||||
if (hotkey.KeyText.Equals("SPACE") && keyService.IsHoldingSpace())
|
||||
if (hotkey.KeyText.Equals("SPACE") && KeyService.IsHoldingSpace())
|
||||
{
|
||||
border = "5px solid green";
|
||||
}
|
||||
@@ -46,7 +48,7 @@
|
||||
width: 0px;
|
||||
height: 0px;">
|
||||
|
||||
<div @onclick="x => { if (hotkey.KeyText.Equals(HotKeyType.SPACE.ToString())) { if (keyService.IsHoldingSpace()) { keyService.RemovePressedKey(hotkey.KeyText); } else { keyService.AddPressedKey(hotkey.KeyText); } } else { keyService.AddPressedKey(hotkey.KeyText); keyService.RemovePressedKey(hotkey.KeyText); }}" style="background-color:@color;
|
||||
<div @onclick="((e)=> ButtonClicked(e, hotkey))" style="background-color:@color;
|
||||
border: @border;
|
||||
width: @Size.ToString()px;
|
||||
height: @Size.ToString()px;
|
||||
@@ -73,7 +75,7 @@
|
||||
var isVanguard = entity.VanguardAdded() != null;
|
||||
var style = isVanguard ? "font-weight: bold;" : "";
|
||||
|
||||
if (buildOrderService.WillMeetRequirements(entity) == null)
|
||||
if (BuildOrderService.WillMeetRequirements(entity) == null)
|
||||
{
|
||||
style += "color:gray; font-style: italic;";
|
||||
}
|
||||
@@ -122,25 +124,25 @@
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
keyService.Subscribe(OnKeyPressed);
|
||||
filterService.Subscribe(StateHasChanged);
|
||||
buildOrderService.Subscribe(OnBuilderOrderChanged);
|
||||
KeyService.Subscribe(OnKeyPressed);
|
||||
FilterService.Subscribe(StateHasChanged);
|
||||
BuildOrderService.Subscribe(OnBuilderOrderChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
keyService.Unsubscribe(OnKeyPressed);
|
||||
filterService.Unsubscribe(StateHasChanged);
|
||||
buildOrderService.Unsubscribe(OnBuilderOrderChanged);
|
||||
KeyService.Unsubscribe(OnKeyPressed);
|
||||
FilterService.Unsubscribe(StateHasChanged);
|
||||
BuildOrderService.Unsubscribe(OnBuilderOrderChanged);
|
||||
}
|
||||
|
||||
int completedTimeCount = 0;
|
||||
|
||||
void OnBuilderOrderChanged()
|
||||
{
|
||||
if (buildOrderService.UniqueCompletedTimes.Count != completedTimeCount)
|
||||
if (BuildOrderService.UniqueCompletedTimes.Count != completedTimeCount)
|
||||
{
|
||||
completedTimeCount = buildOrderService.UniqueCompletedTimes.Count;
|
||||
completedTimeCount = BuildOrderService.UniqueCompletedTimes.Count;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
@@ -148,7 +150,7 @@
|
||||
protected override bool ShouldRender()
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.time", "HotKeyViewerComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.time", "HotKeyViewerComponent");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@@ -157,14 +159,14 @@
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.timeEnd", "HotKeyViewerComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.timeEnd", "HotKeyViewerComponent");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Move to Filter Service
|
||||
bool InvalidFaction(EntityModel entity)
|
||||
{
|
||||
if (entity.Faction() != null && entity.Faction()?.Faction != filterService.GetFaction() && filterService.GetFaction() != DataType.Any)
|
||||
if (entity.Faction() != null && entity.Faction()?.Faction != FilterService.GetFaction() && FilterService.GetFaction() != DataType.Any)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -176,8 +178,8 @@
|
||||
bool InvalidVanguard(EntityModel entity)
|
||||
{
|
||||
if (entity.VanguardAdded() != null
|
||||
&& entity.VanguardAdded()?.ImmortalId != filterService.GetImmortal()
|
||||
&& filterService.GetImmortal() != DataType.Any)
|
||||
&& entity.VanguardAdded()?.ImmortalId != FilterService.GetImmortal()
|
||||
&& FilterService.GetImmortal() != DataType.Any)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -192,7 +194,7 @@
|
||||
{
|
||||
foreach (var replaced in entity.Replaceds())
|
||||
{
|
||||
if (filterService.GetImmortal() == replaced.ImmortalId)
|
||||
if (FilterService.GetImmortal() == replaced.ImmortalId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -241,7 +243,7 @@
|
||||
|
||||
bool InvalidHoldSpace(EntityModel entity)
|
||||
{
|
||||
if (entity.Hotkey()?.HoldSpace == keyService.IsHoldingSpace())
|
||||
if (entity.Hotkey()?.HoldSpace == KeyService.IsHoldingSpace())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -254,44 +256,44 @@
|
||||
var keyWas = key;
|
||||
|
||||
|
||||
if (keyService.GetAllPressedKeys().Contains("Z"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("Z"))
|
||||
{
|
||||
controlGroup = "Z";
|
||||
}
|
||||
if (keyService.GetAllPressedKeys().Contains("TAB"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("TAB"))
|
||||
{
|
||||
controlGroup = "TAB";
|
||||
}
|
||||
if (keyService.GetAllPressedKeys().Contains("C"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("C"))
|
||||
{
|
||||
controlGroup = "C";
|
||||
}
|
||||
if (keyService.GetAllPressedKeys().Contains("D"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("D"))
|
||||
{
|
||||
controlGroup = "D";
|
||||
}
|
||||
if (keyService.GetAllPressedKeys().Contains("1"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("1"))
|
||||
{
|
||||
controlGroup = "1";
|
||||
}
|
||||
//TODO This could be better. Duplicated code
|
||||
if (keyService.GetAllPressedKeys().Contains("2"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("2"))
|
||||
{
|
||||
controlGroup = "2";
|
||||
}
|
||||
if (keyService.GetAllPressedKeys().Contains("SHIFT"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("SHIFT"))
|
||||
{
|
||||
controlGroup = "SHIFT";
|
||||
}
|
||||
|
||||
if (keyService.GetAllPressedKeys().Contains("CONTROL"))
|
||||
if (KeyService.GetAllPressedKeys().Contains("CONTROL"))
|
||||
{
|
||||
controlGroup = "CONTROL";
|
||||
}
|
||||
|
||||
if (keyService.GetAllPressedKeys().Count > 0)
|
||||
if (KeyService.GetAllPressedKeys().Count > 0)
|
||||
{
|
||||
key = keyService.GetAllPressedKeys().First();
|
||||
key = KeyService.GetAllPressedKeys().First();
|
||||
}
|
||||
|
||||
if (controlGroupWas != controlGroup || keyWas != key)
|
||||
@@ -303,7 +305,7 @@
|
||||
|
||||
private void HandleClick()
|
||||
{
|
||||
var hotkey = keyService.GetHotkey();
|
||||
var hotkey = KeyService.GetHotkey();
|
||||
|
||||
if (hotkey == "")
|
||||
{
|
||||
@@ -312,15 +314,15 @@
|
||||
|
||||
if (hotkey == "`")
|
||||
{
|
||||
buildOrderService.RemoveLast();
|
||||
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
|
||||
BuildOrderService.RemoveLast();
|
||||
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
|
||||
return;
|
||||
}
|
||||
|
||||
var hotkeyGroup = keyService.GetHotkeyGroup();
|
||||
var isHoldSpace = keyService.IsHoldingSpace();
|
||||
var faction = filterService.GetFaction();
|
||||
var immortal = filterService.GetImmortal();
|
||||
var hotkeyGroup = KeyService.GetHotkeyGroup();
|
||||
var isHoldSpace = KeyService.IsHoldingSpace();
|
||||
var faction = FilterService.GetFaction();
|
||||
var immortal = FilterService.GetImmortal();
|
||||
|
||||
var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal);
|
||||
|
||||
@@ -329,9 +331,35 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (buildOrderService.Add(entity, economyService))
|
||||
if (BuildOrderService.Add(entity, EconomyService))
|
||||
{
|
||||
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
|
||||
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonClicked(MouseEventArgs mouseEventArgs, HotkeyModel hotkey)
|
||||
{
|
||||
DataCollectionService.SendEvent(
|
||||
DataCollectionKeys.BuildCalcInput,
|
||||
new Dictionary<string, string> {{"key", hotkey.KeyText.ToLower()}, {"input-source", "mouse"}}
|
||||
);
|
||||
|
||||
|
||||
if (hotkey.KeyText.Equals(HotKeyType.SPACE.ToString()))
|
||||
{
|
||||
if (KeyService.IsHoldingSpace())
|
||||
{
|
||||
KeyService.RemovePressedKey(hotkey.KeyText);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyService.AddPressedKey(hotkey.KeyText);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyService.AddPressedKey(hotkey.KeyText);
|
||||
KeyService.RemovePressedKey(hotkey.KeyText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@inject IKeyService keyService
|
||||
@using Services.Website
|
||||
@inject IKeyService KeyService
|
||||
|
||||
@inject IJSRuntime jsRuntime;
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
|
||||
<div tabindex="0"
|
||||
@@ -19,18 +21,23 @@
|
||||
|
||||
private void HandleKeyDown(KeyboardEventArgs e)
|
||||
{
|
||||
keyService.AddPressedKey(e.Key);
|
||||
DataCollectionService.SendEvent(
|
||||
DataCollectionKeys.BuildCalcInput,
|
||||
new Dictionary<string, string> {{"key", e.Key.ToLower()}, {"input-source", "keyboard"}}
|
||||
);
|
||||
|
||||
KeyService.AddPressedKey(e.Key);
|
||||
}
|
||||
|
||||
private void HandleKeyUp(KeyboardEventArgs e)
|
||||
{
|
||||
keyService.RemovePressedKey(e.Key);
|
||||
KeyService.RemovePressedKey(e.Key);
|
||||
}
|
||||
|
||||
protected override bool ShouldRender()
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.time", "InputPanelComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.time", "InputPanelComponent");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@@ -39,7 +46,7 @@
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.timeEnd", "InputPanelComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.timeEnd", "InputPanelComponent");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
TimingService.Subscribe(RefreshDefaults);
|
||||
|
||||
RefreshDefaults();
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
economyService.Subscribe(StateHasChanged);
|
||||
buildOrderService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
timingService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
@page "/changelog"
|
||||
@implements IDisposable;
|
||||
@inject IGitService gitService;
|
||||
@inject IGitService GitService;
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
|
||||
@layout PageLayout
|
||||
|
||||
|
||||
@if (gitService.IsLoaded())
|
||||
@if (GitService.IsLoaded())
|
||||
{
|
||||
<LayoutMediumContentComponent>
|
||||
<WebsiteTitleComponent>Change Log</WebsiteTitleComponent>
|
||||
@@ -90,21 +95,22 @@ else
|
||||
|
||||
@code {
|
||||
|
||||
private IEnumerable<GitPatchModel> Patches => gitService.GitPatchModels;
|
||||
private IEnumerable<GitPatchModel> Patches => GitService.GitPatchModels;
|
||||
|
||||
private List<GitChangeModel> Changes => gitService.GitChangeModels;
|
||||
private List<GitChangeModel> Changes => GitService.GitChangeModels;
|
||||
|
||||
private bool isViewImportant = true;
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
gitService.Subscribe(HasChanged);
|
||||
base.OnInitialized();
|
||||
GitService.Subscribe(HasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
gitService.Unsubscribe(HasChanged);
|
||||
GitService.Unsubscribe(HasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +127,7 @@ else
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await gitService.Load();
|
||||
await GitService.Load();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
@layout PageLayout
|
||||
@inherits BasePage
|
||||
@implements IDisposable
|
||||
|
||||
@inject IToastService toastService
|
||||
@inject IToastService ToastService
|
||||
|
||||
<div style="display:grid; gap: 8px;padding: 16px; height: 94vh; width: 90vw; margin: auto; margin-top: 32px;
|
||||
grid-template-columns: 27% 25% 25% 23%; grid-template-rows: auto;
|
||||
@@ -53,6 +54,7 @@ grid-template-areas: 'loader sand compare compare' ;">
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
KeyService.Subscribe(HandleClick);
|
||||
FilterService.Subscribe(StateHasChanged);
|
||||
EconomyService.Subscribe(StateHasChanged);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
BuildComparisionService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
BuildComparisonService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
@inherits BasePage
|
||||
|
||||
@page "/contact"
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@page "/data-collection"
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
@inherits BasePage
|
||||
|
||||
@layout PageLayout
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inherits BasePage
|
||||
@page "/database"
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
@inject IEntityDisplayService entityDisplayService
|
||||
@inject IVariableService variableService
|
||||
@inject IEntityDisplayService EntityDisplayService
|
||||
@inject IVariableService VariableService
|
||||
|
||||
|
||||
<LayoutLargeContentComponent>
|
||||
<WebsiteTitleComponent>Database</WebsiteTitleComponent>
|
||||
@@ -13,13 +14,13 @@
|
||||
<PaperComponent>
|
||||
<FormDisplayComponent Label="Patch">
|
||||
<Display>
|
||||
Game Patch: @variableService.Variables["GamePatch"]
|
||||
Game Patch: @VariableService.Variables["GamePatch"]
|
||||
</Display>
|
||||
</FormDisplayComponent>
|
||||
</PaperComponent>
|
||||
|
||||
<div style="margin-left: 8px">
|
||||
<ButtonGroupComponent OnClick="choice => { entityDisplayService.SetDisplayType(choice); }" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent>
|
||||
<ButtonGroupComponent OnClick="choice => { EntityDisplayService.SetDisplayType(choice); }" Choice="@EntityDisplayService.GetDisplayType()" Choices="@EntityDisplayService.DefaultChoices()"></ButtonGroupComponent>
|
||||
</div>
|
||||
|
||||
<PaperComponent>
|
||||
@@ -31,7 +32,7 @@
|
||||
@foreach (var entity in searches)
|
||||
{
|
||||
<CascadingValue Value="entity">
|
||||
<CascadingValue Value="@entityDisplayService.GetDisplayType()">
|
||||
<CascadingValue Value="@EntityDisplayService.GetDisplayType()">
|
||||
<EntityViewComponent></EntityViewComponent>
|
||||
</CascadingValue>
|
||||
</CascadingValue>
|
||||
@@ -67,7 +68,7 @@
|
||||
Is this database updated to the latest version?
|
||||
</InfoQuestionComponent>
|
||||
<InfoAnswerComponent>
|
||||
Maybe. Check this <b>@variableService.Variables["GamePatch"]</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is.
|
||||
Maybe. Check this <b>@VariableService.Variables["GamePatch"]</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is.
|
||||
</InfoAnswerComponent>
|
||||
</InfoBodyComponent>
|
||||
|
||||
@@ -134,16 +135,17 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
RefreshFactionSearch();
|
||||
|
||||
EntityFilterService.Subscribe(OnChange);
|
||||
entityDisplayService.Subscribe(StateHasChanged);
|
||||
EntityDisplayService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
EntityFilterService.Unsubscribe(OnChange);
|
||||
entityDisplayService.Unsubscribe(StateHasChanged);
|
||||
EntityDisplayService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void OnChange(EntityFilterEvent filterEntityEvent)
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@page "/database/{text}"
|
||||
|
||||
@inject IEntityDisplayService entityDisplayService
|
||||
@inject IEntityDisplayService EntityDisplayService
|
||||
@inject IVariableService VariableService
|
||||
|
||||
@inject IVariableService variableService
|
||||
@implements IDisposable
|
||||
|
||||
|
||||
<LayoutLargeContentComponent>
|
||||
|
||||
<PaperComponent>
|
||||
<FormDisplayComponent Label="Patch">
|
||||
<Display>
|
||||
Game Patch: @variableService.Variables["GamePatch"]
|
||||
Game Patch: @VariableService.Variables["GamePatch"]
|
||||
</Display>
|
||||
</FormDisplayComponent>
|
||||
</PaperComponent>
|
||||
|
||||
<div style="margin-left: 8px">
|
||||
<ButtonGroupComponent OnClick="choice => { entityDisplayService.SetDisplayType(choice); }" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent>
|
||||
<ButtonGroupComponent OnClick="choice => { EntityDisplayService.SetDisplayType(choice); }" Choice="@EntityDisplayService.GetDisplayType()" Choices="@EntityDisplayService.DefaultChoices()"></ButtonGroupComponent>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -33,7 +36,7 @@
|
||||
</CodeComponent>
|
||||
</PaperComponent>
|
||||
}
|
||||
else if (entity == null)
|
||||
else if (_entity == null)
|
||||
{
|
||||
<PaperComponent>
|
||||
<div>Invalid entity name entered: @Text</div>
|
||||
@@ -44,8 +47,8 @@
|
||||
else
|
||||
{
|
||||
<PaperComponent>
|
||||
<CascadingValue Value="entity">
|
||||
<CascadingValue Value="@entityDisplayService.GetDisplayType()">
|
||||
<CascadingValue Value="_entity">
|
||||
<CascadingValue Value="@EntityDisplayService.GetDisplayType()">
|
||||
|
||||
<EntityViewComponent></EntityViewComponent>
|
||||
</CascadingValue>
|
||||
@@ -62,17 +65,28 @@
|
||||
[Parameter]
|
||||
public string? Text { get; set; }
|
||||
|
||||
private EntityModel? entity;
|
||||
private EntityModel? _entity;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
entityDisplayService.Subscribe(StateHasChanged);
|
||||
EntityDisplayService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
base.OnInitialized();
|
||||
|
||||
FocusEntity();
|
||||
}
|
||||
|
||||
private void FocusEntity()
|
||||
{
|
||||
foreach (var e in DATA.Get().Values)
|
||||
{
|
||||
if (e.Info().Name.ToLower().Equals(Text!.ToLower()))
|
||||
{
|
||||
entity = e;
|
||||
_entity = e;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +94,7 @@
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
entityDisplayService.Unsubscribe(StateHasChanged);
|
||||
EntityDisplayService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -244,6 +244,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
StorageService.Subscribe(RefreshDefaults);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
void OnChangeFaction(string clickedFaction)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
@layout PageLayout
|
||||
@inherits BasePage
|
||||
|
||||
@inject IDocumentationService documentationService
|
||||
@inject IDocumentationService DocumentationService
|
||||
@implements IDisposable
|
||||
|
||||
@page "/docs"
|
||||
|
||||
@if (!documentationService.IsLoaded())
|
||||
@if (!DocumentationService.IsLoaded())
|
||||
{
|
||||
<LoadingComponent/>
|
||||
}
|
||||
@@ -13,7 +14,7 @@ else
|
||||
{
|
||||
<LayoutMediumContentComponent>
|
||||
<PaperComponent>
|
||||
@foreach (var docSection in documentationService.DocSectionModels)
|
||||
@foreach (var docSection in DocumentationService.DocSectionModels)
|
||||
{
|
||||
<div class="docSectionContainer">
|
||||
<div class="docSectionTitle">@docSection.Name</div>
|
||||
@@ -102,14 +103,15 @@ else
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
documentationService.Subscribe(StateHasChanged);
|
||||
base.OnInitialized();
|
||||
DocumentationService.Subscribe(StateHasChanged);
|
||||
|
||||
documentationService.Load();
|
||||
DocumentationService.Load();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
documentationService.Unsubscribe(StateHasChanged);
|
||||
DocumentationService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
@layout PageLayout
|
||||
@inherits BasePage
|
||||
|
||||
@inject IDocumentationService documentationService
|
||||
@inject IDocumentationService DocumentationService
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
@page "/docs/{href1}/{href2?}/{href3?}/{href4?}/{href5?}"
|
||||
|
||||
@if (!documentationService.IsLoaded())
|
||||
@if (!DocumentationService.IsLoaded())
|
||||
{
|
||||
<LoadingComponent/>
|
||||
}
|
||||
@@ -15,12 +16,12 @@ else
|
||||
<LayoutWithSidebarComponent>
|
||||
<Sidebar>
|
||||
<DocumentNavComponent
|
||||
Connections="documentationService.DocConnectionModels"
|
||||
Documents="documentationService.DocContentModels"/>
|
||||
Connections="DocumentationService.DocConnectionModels"
|
||||
Documents="DocumentationService.DocContentModels"/>
|
||||
</Sidebar>
|
||||
<Content>
|
||||
<PaperComponent>
|
||||
@foreach (var doc in documentationService.DocContentModels)
|
||||
@foreach (var doc in DocumentationService.DocContentModels)
|
||||
{
|
||||
if (!doc.Href.Equals(Href))
|
||||
{
|
||||
@@ -108,14 +109,15 @@ else
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
documentationService.Subscribe(StateHasChanged);
|
||||
base.OnInitialized();
|
||||
DocumentationService.Subscribe(StateHasChanged);
|
||||
|
||||
documentationService.Load();
|
||||
DocumentationService.Load();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
documentationService.Unsubscribe(StateHasChanged);
|
||||
DocumentationService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/economy-comparison"
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@implements IDisposable
|
||||
@inject IEconomyComparisonService EconomyComparisonService
|
||||
@layout PageLayout
|
||||
@@ -40,6 +42,7 @@
|
||||
@code {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
EconomyComparisonService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
economyComparisonService.Subscribe(OnBuilderOrderChanged);
|
||||
|
||||
OnBuilderOrderChanged();
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
economyComparisonService.Subscribe(CalculateDifferences);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
economyComparisonService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
@inherits BasePage
|
||||
|
||||
@page "/harass-calculator"
|
||||
@using Model
|
||||
|
||||
@@ -261,6 +264,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
Calculate();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@layout PageLayout;
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@page "/immortal-home"
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@page "/makingof"
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
@layout PageLayout
|
||||
|
||||
<LayoutLargeContentComponent>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@page "/memory-tester"
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
MemoryTesterService.Subscribe(OnMemoryEvent);
|
||||
|
||||
OnRefresh();
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
MemoryTesterService.Subscribe(OnMemoryEvent);
|
||||
|
||||
MemoryTesterService.GenerateQuiz();
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inject INoteService noteService
|
||||
@inherits BasePage
|
||||
|
||||
@inject INoteService NoteService
|
||||
@implements IDisposable
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
@page "/notes"
|
||||
|
||||
|
||||
@if (!noteService.IsLoaded())
|
||||
@if (!NoteService.IsLoaded())
|
||||
{
|
||||
<LoadingComponent/>
|
||||
}
|
||||
@@ -15,7 +19,7 @@ else
|
||||
<LayoutMediumContentComponent>
|
||||
|
||||
<PaperComponent>
|
||||
@foreach (var noteSection in noteService.NoteSectionModels)
|
||||
@foreach (var noteSection in NoteService.NoteSectionModels)
|
||||
{
|
||||
<div class="noteSectionContainer">
|
||||
<div class="noteSectionTitle">@noteSection.Name</div>
|
||||
@@ -119,15 +123,16 @@ else
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
noteService.Subscribe(StateHasChanged);
|
||||
base.OnInitialized();
|
||||
NoteService.Subscribe(StateHasChanged);
|
||||
|
||||
noteService.Load();
|
||||
NoteService.Load();
|
||||
}
|
||||
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
noteService.Unsubscribe(StateHasChanged);
|
||||
NoteService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inject INoteService noteService
|
||||
@inherits BasePage
|
||||
|
||||
@inject INoteService NoteService
|
||||
@implements IDisposable
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
@page "/notes/{href1}/{href2?}/{href3?}/{href4?}/{href5?}"
|
||||
|
||||
|
||||
@if (!noteService.IsLoaded())
|
||||
@if (!NoteService.IsLoaded())
|
||||
{
|
||||
<LoadingComponent/>
|
||||
}
|
||||
@@ -15,12 +19,12 @@ else
|
||||
<LayoutWithSidebarComponent>
|
||||
<Sidebar>
|
||||
<NoteNavComponent
|
||||
Connections="noteService.NoteConnectionModels"
|
||||
Notes="noteService.NoteContentModels"/>
|
||||
Connections="NoteService.NoteConnectionModels"
|
||||
Notes="NoteService.NoteContentModels"/>
|
||||
</Sidebar>
|
||||
<Content>
|
||||
<PaperComponent>
|
||||
@foreach (var note in noteService.NoteContentModels)
|
||||
@foreach (var note in NoteService.NoteContentModels)
|
||||
{
|
||||
if (!note.Href.Equals(Href))
|
||||
{
|
||||
@@ -107,14 +111,15 @@ else
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
noteService.Subscribe(StateHasChanged);
|
||||
base.OnInitialized();
|
||||
NoteService.Subscribe(StateHasChanged);
|
||||
|
||||
noteService.Load();
|
||||
NoteService.Load();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
noteService.Unsubscribe(StateHasChanged);
|
||||
NoteService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,24 +2,27 @@
|
||||
|
||||
@inject IPermissionService PermissionService
|
||||
@layout PageLayout
|
||||
@using Services.Website
|
||||
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage
|
||||
|
||||
@inject IDialogService DialogService
|
||||
|
||||
@inherits BasePage
|
||||
@using Services.Website
|
||||
@implements IDisposable
|
||||
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
<PaperComponent>
|
||||
<FormLayoutComponent>
|
||||
<FormToggleComponent
|
||||
Label="Storage Enabled"
|
||||
Info="Is storage enabled?"
|
||||
Value="@_storageEnabled"
|
||||
<FormToggleComponent
|
||||
Label="Storage Enabled"
|
||||
Info="Is storage enabled?"
|
||||
Value="_storageEnabled"
|
||||
OnChange="StoragePermissionChanged"/>
|
||||
<FormToggleComponent
|
||||
Label="Data Collection Enabled"
|
||||
Info="Is data collection enabled?"
|
||||
Value="@_dataCollectionEnabled"
|
||||
|
||||
<FormToggleComponent
|
||||
Label="Data Collection Enabled"
|
||||
Info="Is data collection enabled?"
|
||||
Value="_dataCollectionEnabled"
|
||||
OnChange="DataCollectionPermissionChanged"/>
|
||||
</FormLayoutComponent>
|
||||
</PaperComponent>
|
||||
@@ -44,7 +47,10 @@
|
||||
|
||||
<InfoBodyComponent>
|
||||
<InfoQuestionComponent>What data does this website collect?</InfoQuestionComponent>
|
||||
<InfoAnswerComponent>This website usages Google Analytics to collect data enabled on the Analytics page.</InfoAnswerComponent>
|
||||
<InfoAnswerComponent>This website usages Google Analytics to collect data on usage of this website.
|
||||
<br/><br/>
|
||||
Items include: if people use keyboard or mouse in build calculator, what pages people visit, and other usages.
|
||||
</InfoAnswerComponent>
|
||||
</InfoBodyComponent>
|
||||
|
||||
<InfoBodyComponent>
|
||||
@@ -58,38 +64,60 @@
|
||||
@code {
|
||||
private bool _storageEnabled = false;
|
||||
private bool _dataCollectionEnabled = false;
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
PermissionService.Subscribe(Update);
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
_storageEnabled = PermissionService.GetIsStorageEnabled();
|
||||
_dataCollectionEnabled = PermissionService.GetIsDataCollectionEnabled();
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
PermissionService.Unsubscribe(Update);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void StoragePermissionChanged(ChangeEventArgs obj)
|
||||
{
|
||||
PermissionService.SetIsStorageEnabled((bool)obj.Value!);
|
||||
PermissionService.SetIsStorageEnabled(!PermissionService.GetIsStorageEnabled());
|
||||
}
|
||||
|
||||
|
||||
private void DataCollectionPermissionChanged(ChangeEventArgs obj)
|
||||
{
|
||||
PermissionService.SetIsDataCollectionEnabled((bool)obj.Value!);
|
||||
void OnDataCollectionConfirmClicked(MouseEventArgs mouseEventArgs)
|
||||
{
|
||||
PermissionService.SetIsDataCollectionEnabled(!PermissionService.GetIsDataCollectionEnabled());
|
||||
DialogService.Hide();
|
||||
}
|
||||
|
||||
void OnDataCollectionCancelClicked(MouseEventArgs mouseEventArgs)
|
||||
{
|
||||
DialogService.Hide();
|
||||
}
|
||||
|
||||
if (_storageEnabled && !PermissionService.GetIsDataCollectionEnabled())
|
||||
{
|
||||
DialogService.Show(new DialogContents
|
||||
{
|
||||
Title = "Permission Request",
|
||||
Message = "Are you sure you want to enable data collection? This feature is implemented with Google Analytics, and your data will be used to gauge interests, find bugs, and optimize updates in IGP Fan Reference.",
|
||||
OnConfirm = new EventCallback<EventArgs>(this, OnDataCollectionConfirmClicked),
|
||||
OnCancel = new EventCallback<EventArgs>(this, OnDataCollectionCancelClicked),
|
||||
ConfirmButtonLabel = "Enable Data Collection"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
PermissionService.SetIsDataCollectionEnabled(!PermissionService.GetIsDataCollectionEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
@page "/raw-database"
|
||||
@inherits BasePage
|
||||
|
||||
@page "/raw-database"
|
||||
|
||||
<div class="page">
|
||||
<AlertComponent>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@layout PageLayout
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@inject IDataCollectionService DataCollectionService
|
||||
|
||||
@page "/roadmap"
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/storage"
|
||||
|
||||
|
||||
@inherits BasePage
|
||||
@inject IStorageService StorageService
|
||||
@using Services.Website
|
||||
@implements IDisposable
|
||||
@@ -145,6 +147,8 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
_enabledPermissions = StorageService.GetValue<bool>(StorageKeys.EnabledStorage);
|
||||
|
||||
RefreshDefaults();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/streams"
|
||||
|
||||
@inherits BasePage
|
||||
|
||||
@layout PageLayout
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
|
||||
Reference in New Issue
Block a user