79 changed files with 802 additions and 287 deletions
Binary file not shown.
@ -0,0 +1,114 @@ |
|||||||
|
@implements IDisposable; |
||||||
|
@inject IDialogService DialogService |
||||||
|
@inject IJSRuntime JsRuntime |
||||||
|
|
||||||
|
|
||||||
|
@inject NavigationManager NavigationManager |
||||||
|
|
||||||
|
@if (DialogService.IsVisible) |
||||||
|
{ |
||||||
|
<div class="confirmDialogBackground" onclick="@CloseDialog"> |
||||||
|
<div class="confirmDialogContainer" |
||||||
|
@onclick:preventDefault="true" |
||||||
|
@onclick:stopPropagation="true"> |
||||||
|
|
||||||
|
<div class="confirmDialogHeader"> |
||||||
|
@DialogService.GetDialogContents().Title |
||||||
|
</div> |
||||||
|
<div class="confirmDialogBody"> |
||||||
|
@DialogService.GetDialogContents().Message |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="confirmDialogFooter"> |
||||||
|
<ButtonComponent ButtonType="ButtonType.Secondary" OnClick="DialogService.GetDialogContents().OnCancel"> |
||||||
|
Cancel |
||||||
|
</ButtonComponent> |
||||||
|
<ButtonComponent ButtonType="ButtonType.Primary" OnClick="DialogService.GetDialogContents().OnConfirm"> |
||||||
|
@DialogService.GetDialogContents().ConfirmButtonLabel |
||||||
|
</ButtonComponent> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<style> |
||||||
|
.pageContents * { |
||||||
|
filter: blur(2px); |
||||||
|
} |
||||||
|
|
||||||
|
.confirmDialogBackground { |
||||||
|
position: fixed; |
||||||
|
top: 0; |
||||||
|
left: 0; |
||||||
|
width: 100vw; |
||||||
|
height: 100vh; |
||||||
|
background-color: rgba(0, 0, 0, 0.5); |
||||||
|
display: flex; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
.confirmDialogContainer { |
||||||
|
margin-left: auto; |
||||||
|
margin-right: auto; |
||||||
|
margin-top: 64px; |
||||||
|
width: 800px; |
||||||
|
height: 600px; |
||||||
|
|
||||||
|
background-color: var(--background); |
||||||
|
border-width: var(--dialog-border-width); |
||||||
|
border-style: solid; |
||||||
|
border-color: var(--dialog-border-color); |
||||||
|
border-radius: var(--dialog-radius); |
||||||
|
|
||||||
|
padding: 8px; |
||||||
|
|
||||||
|
|
||||||
|
box-shadow: 1px 2px 2px black; |
||||||
|
|
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
.confirmDialogHeader { |
||||||
|
font-size: 1.4em; |
||||||
|
padding: 12px; |
||||||
|
} |
||||||
|
|
||||||
|
.confirmDialogBody { |
||||||
|
padding: 12px; |
||||||
|
flex-grow: 1; |
||||||
|
} |
||||||
|
|
||||||
|
.confirmDialogFooter { |
||||||
|
display: flex; |
||||||
|
gap: 12px; |
||||||
|
justify-content: flex-end; |
||||||
|
padding: 12px; |
||||||
|
} |
||||||
|
|
||||||
|
</style> |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@code { |
||||||
|
|
||||||
|
protected override void OnInitialized() |
||||||
|
{ |
||||||
|
base.OnInitialized(); |
||||||
|
|
||||||
|
DialogService.Subscribe(StateHasChanged); |
||||||
|
} |
||||||
|
|
||||||
|
void IDisposable.Dispose() |
||||||
|
{ |
||||||
|
DialogService.Unsubscribe(StateHasChanged); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void CloseDialog() |
||||||
|
{ |
||||||
|
DialogService.Hide(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -1,9 +1,12 @@ |
|||||||
@page "/" |
@page "/" |
||||||
|
|
||||||
|
@inject ITrackingNavigationState TrackingNavigationState |
||||||
|
@inject IAnalytics GlobalTracking |
||||||
|
|
||||||
@layout PageLayout |
@layout PageLayout |
||||||
|
|
||||||
<DevOnlyComponent> |
<DevOnlyComponent> |
||||||
<StoragePage/> |
<PermissionsPage/> |
||||||
</DevOnlyComponent> |
</DevOnlyComponent> |
||||||
|
|
||||||
<HomePage/> |
<HomePage/> |
||||||
@ -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); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
@implements IDisposable; |
||||||
|
|
||||||
|
@inject IDialogService DialogService |
||||||
|
|
||||||
|
<ConfirmationDialogComponent></ConfirmationDialogComponent> |
||||||
|
|
||||||
|
@code { |
||||||
|
|
||||||
|
protected override void OnInitialized() |
||||||
|
{ |
||||||
|
base.OnInitialized(); |
||||||
|
DialogService.Subscribe(OnUpdate); |
||||||
|
} |
||||||
|
|
||||||
|
void IDisposable.Dispose() |
||||||
|
{ |
||||||
|
DialogService.Unsubscribe(OnUpdate); |
||||||
|
} |
||||||
|
|
||||||
|
void OnUpdate() |
||||||
|
{ |
||||||
|
StateHasChanged(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
File diff suppressed because one or more lines are too long
@ -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":16,"WebSectionModelId":4,"Name":"Documentation","Description":"Development information","Href":"docs","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":"False"},{"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"}] |
[{"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"},{"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"}] |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
using Blazor.Analytics; |
||||||
|
using Blazored.LocalStorage; |
||||||
|
using Model.Feedback; |
||||||
|
|
||||||
|
namespace Services.Website; |
||||||
|
|
||||||
|
public class DataCollectionKeys |
||||||
|
{ |
||||||
|
// Inputs people are using in the build calculator |
||||||
|
public static string BuildCalcInput = "buildcalc-input"; |
||||||
|
public static string PageInitialized = "page-initialized"; |
||||||
|
public static string FirstPage = "first-page"; |
||||||
|
} |
||||||
|
|
||||||
|
public class DataCollectionService : IDataCollectionService, IDisposable |
||||||
|
{ |
||||||
|
private readonly IStorageService _storageService; |
||||||
|
|
||||||
|
private bool _isEnabled = false; |
||||||
|
private readonly IAnalytics _globalTracking; |
||||||
|
|
||||||
|
public DataCollectionService(IAnalytics globalTracking, |
||||||
|
IStorageService storageService) |
||||||
|
{ |
||||||
|
_globalTracking = globalTracking; |
||||||
|
_storageService = storageService; |
||||||
|
|
||||||
|
_storageService.Subscribe(Refresh); |
||||||
|
|
||||||
|
Refresh(); |
||||||
|
} |
||||||
|
|
||||||
|
void IDisposable.Dispose() |
||||||
|
{ |
||||||
|
_storageService.Unsubscribe(Refresh); |
||||||
|
} |
||||||
|
|
||||||
|
private void Refresh() |
||||||
|
{ |
||||||
|
_isEnabled = _storageService.GetValue<bool>(StorageKeys.EnabledDataCollection); |
||||||
|
} |
||||||
|
|
||||||
|
public void SendEvent<T>(string eventName, T eventData) |
||||||
|
{ |
||||||
|
if (_isEnabled) |
||||||
|
{ |
||||||
|
_globalTracking.TrackEvent(eventName, eventData); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,63 @@ |
|||||||
|
using Microsoft.AspNetCore.Components; |
||||||
|
using Microsoft.AspNetCore.Components.Web; |
||||||
|
using Model.Entity.Data; |
||||||
|
using Model.Website; |
||||||
|
|
||||||
|
namespace Services.Website; |
||||||
|
|
||||||
|
public class DialogContents |
||||||
|
{ |
||||||
|
public string Title { get; set; } |
||||||
|
public string Message { get; set; } |
||||||
|
public string ConfirmButtonLabel { get; set; } |
||||||
|
public EventCallback<EventArgs> OnConfirm { get; set; } |
||||||
|
public EventCallback<EventArgs> OnCancel { get; set; } |
||||||
|
} |
||||||
|
|
||||||
|
public class DialogService : IDialogService |
||||||
|
{ |
||||||
|
private DialogContents _dialogContents; |
||||||
|
|
||||||
|
public DialogService() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsVisible { get; set; } |
||||||
|
|
||||||
|
public void Subscribe(Action action) |
||||||
|
{ |
||||||
|
OnChange += action; |
||||||
|
} |
||||||
|
|
||||||
|
public void Unsubscribe(Action action) |
||||||
|
{ |
||||||
|
OnChange += action; |
||||||
|
} |
||||||
|
|
||||||
|
public void Show(DialogContents dialogContents) |
||||||
|
{ |
||||||
|
_dialogContents = dialogContents; |
||||||
|
IsVisible = true; |
||||||
|
|
||||||
|
NotifyDataChanged(); |
||||||
|
} |
||||||
|
|
||||||
|
public DialogContents GetDialogContents() |
||||||
|
{ |
||||||
|
return _dialogContents; |
||||||
|
} |
||||||
|
|
||||||
|
public void Hide() |
||||||
|
{ |
||||||
|
IsVisible = false; |
||||||
|
|
||||||
|
NotifyDataChanged(); |
||||||
|
} |
||||||
|
|
||||||
|
private event Action OnChange = null!; |
||||||
|
|
||||||
|
private void NotifyDataChanged() |
||||||
|
{ |
||||||
|
OnChange(); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue