This commit is contained in:
2026-06-04 11:29:24 -04:00
parent 377a041afa
commit 2625992014
16 changed files with 125 additions and 26 deletions
@@ -1,116 +0,0 @@
@implements IDisposable;
@inject IMyDialogService MyDialogService
@inject IJSRuntime JsRuntime
@inject NavigationManager NavigationManager
@if (MyDialogService.IsVisible)
{
<div class="confirmDialogBackground" onclick="@CloseDialog">
<div class="confirmDialogContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
<div class="confirmDialogHeader">
@MyDialogService.GetDialogContents().Title
</div>
<div class="confirmDialogBody">
@MyDialogService.GetDialogContents().Message
</div>
<div class="confirmDialogFooter">
<ButtonComponent MyButtonType="MyButtonType.Secondary"
OnClick="MyDialogService.GetDialogContents().OnCancel">
Cancel
</ButtonComponent>
<ButtonComponent MyButtonType="MyButtonType.Primary"
OnClick="MyDialogService.GetDialogContents().OnConfirm">
@MyDialogService.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();
MyDialogService.Subscribe(StateHasChanged);
}
void IDisposable.Dispose()
{
MyDialogService.Unsubscribe(StateHasChanged);
}
public void CloseDialog()
{
MyDialogService.Hide();
}
}
-171
View File
@@ -1,171 +0,0 @@
@implements IDisposable;
@inject IEntityDialogService entityDialogService
<div class="dialogBackground" onclick="@CloseDialog">
<div class="dialogContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
@if (entity == null)
{
<div>Entity is null</div>
}
else
{
<div class="dialogHeader">
@if (entityDialogService.HasHistory())
{
<button class="backButton" @onclick="entityDialogService.BackDialog">
<div class="backButtonIcon"></div>
</button>
}
<div class="dialogTitle">
@entity.Info().Name
</div>
</div>
<div class="dialogContent">
<CascadingValue Value="@entity">
<EntityVanguardAddedComponent/>
<EntityInfoComponent/>
<EntityVanguardsComponent/>
<EntityProductionComponent/>
<EntityStatsComponent/>
<EntityMechanicsComponent/>
<EntityPassivesComponent/>
<EntityPyreSpellsComponent/>
<EntityUpgradesComponent/>
<EntityWeaponsComponent/>
<EntityAbilitiesComponent/>
</CascadingValue>
</div>
<div class="dialogFooter"></div>
}
</div>
</div>
<style>
.pageContents * {
filter: blur(2px);
}
.dialogBackground {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
}
.dialogContainer {
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);
box-shadow: 1px 2px 2px black;
}
.dialogHeader {
width: 100%;
background-color: var(--accent);
border-top-left-radius: var(--dialog-radius);
border-top-right-radius: var(--dialog-radius);
border-bottom: 4px solid black;
display: flex;
align-items: center;
justify-content: flex-start;
}
.backButton {
margin-left: 16px;
padding: 12px;
border: 1px solid var(--accent);
}
.backButton:hover {
background-color: var(--primary-hover);
border: 1px solid var(--primary-border-hover);
}
.backButtonIcon {
height: 32px;
width: 32px;
border: solid white;
border-width: 0 9px 9px 0;
transform: rotate(135deg);
}
.dialogTitle {
padding: 16px;
font-size: 2rem;
font-weight: bold;
}
.dialogContent {
flex-grow: 1;
padding: 6px;
overflow-y: auto;
overflow-x: hidden;
height: 800px;
}
.dialogFooter {
width: 100%;
height: 6px;
background-color: var(--paper);
}
</style>
@code {
EntityModel entity = default!;
private int refresh;
protected override void OnInitialized()
{
base.OnInitialized();
entity = EntityData.Get()[entityDialogService.GetEntityId() ?? string.Empty];
entityDialogService.Subscribe(OnUpdate);
}
void IDisposable.Dispose()
{
entityDialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
entity = EntityData.Get()[entityDialogService.GetEntityId()];
refresh++;
StateHasChanged();
}
public void CloseDialog()
{
entityDialogService.CloseDialog();
}
}
-226
View File
@@ -1,226 +0,0 @@
@implements IDisposable;
@inject IGlossaryService glossaryService
@inject IGlossaryDialogService glossaryDialogService
<div class="dialogBackground" onclick="@CloseDialog">
<div class="dialogContainer glossaryDialog"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
@if (term == null)
{
<div>Term is null</div>
}
else
{
<div class="dialogHeader">
@if (glossaryDialogService.HasHistory())
{
<button class="backButton" @onclick="glossaryDialogService.BackDialog">
<div class="backButtonIcon"></div>
</button>
}
<div class="dialogTitle">
@term.Term
</div>
<div class="glossaryDialogCategory">@term.Category</div>
</div>
<div class="dialogContent">
<div class="glossaryDefinition">@((MarkupString)RenderMarkdown(term.LongDefinition))</div>
@if (term.RelatedEntityIds.Count > 0)
{
<div class="glossaryRelatedSection">
<div class="glossaryRelatedTitle">Related Entities</div>
<div class="glossaryRelatedList">
@foreach (var entityId in term.RelatedEntityIds)
{
<EntityLabelComponent EntityId="@entityId"/>
}
</div>
</div>
}
@if (term.RelatedTermIds.Count > 0)
{
<div class="glossaryRelatedSection">
<div class="glossaryRelatedTitle">Related Terms</div>
<div class="glossaryRelatedList">
@foreach (var relatedId in term.RelatedTermIds)
{
<GlossaryLabelComponent TermId="@relatedId"/>
}
</div>
</div>
}
</div>
<div class="dialogFooter"></div>
}
</div>
</div>
<style>
.pageContents * {
filter: blur(2px);
}
.dialogBackground {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
}
.dialogContainer {
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);
box-shadow: 1px 2px 2px black;
}
.dialogHeader {
width: 100%;
background-color: var(--accent);
border-top-left-radius: var(--dialog-radius);
border-top-right-radius: var(--dialog-radius);
border-bottom: 4px solid black;
display: flex;
align-items: center;
justify-content: flex-start;
}
.backButton {
margin-left: 16px;
padding: 12px;
border: 1px solid var(--accent);
}
.backButton:hover {
background-color: var(--primary-hover);
border: 1px solid var(--primary-border-hover);
}
.backButtonIcon {
height: 32px;
width: 32px;
border: solid white;
border-width: 0 9px 9px 0;
transform: rotate(135deg);
}
.dialogTitle {
padding: 16px;
font-size: 2rem;
font-weight: bold;
}
.dialogContent {
flex-grow: 1;
padding: 6px;
overflow-y: auto;
overflow-x: hidden;
height: 800px;
}
.dialogFooter {
width: 100%;
height: 6px;
background-color: var(--paper);
}
.glossaryDialog {
max-width: 600px;
}
.glossaryDialogCategory {
font-size: 0.8rem;
opacity: 0.7;
margin-left: 12px;
}
.glossaryDefinition {
line-height: 1.6;
}
.glossaryDefinition p {
margin-bottom: 12px;
}
.glossaryRelatedSection {
margin-top: 20px;
padding-top: 16px;
border-top: 1px solid var(--info-secondary-border);
}
.glossaryRelatedTitle {
font-weight: 800;
font-size: 1rem;
margin-bottom: 8px;
}
.glossaryRelatedList {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
</style>
@code {
private GlossaryTermModel? term;
protected override void OnInitialized()
{
base.OnInitialized();
glossaryDialogService.Subscribe(OnUpdate);
LoadTerm();
}
void IDisposable.Dispose()
{
glossaryDialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
LoadTerm();
StateHasChanged();
}
void LoadTerm()
{
var id = glossaryDialogService.GetTermId();
term = id != null ? glossaryService.GetTerm(id) : null;
}
void CloseDialog()
{
glossaryDialogService.CloseDialog();
}
string RenderMarkdown(string text)
{
return Markdown.ToHtml(text);
}
}
-211
View File
@@ -1,211 +0,0 @@
@implements IDisposable;
@inject ISearchService searchService
@inject IJSRuntime jsRuntime
@inject NavigationManager navigationManager
@if (searchService.IsLoaded() && searchService.IsVisible)
{
<div id="searchBackground" class="searchBackground" onclick="@CloseDialog">
<div class="searchContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
<FormLayoutComponent>
<FormTextComponent OnFocus="OnFocus" Id="searchInput" Placeholder="Search..."
OnInput="SearchChanged"></FormTextComponent>
</FormLayoutComponent>
<div class="searchBox">
@if (SearchText.Length > 0)
{
foreach (var searchSection in searchService.Searches)
{
var searchPoints = searchSection.Value.FindAll(x => x.Title.ToLower().Contains(SearchText.ToLower()));
@if (searchPoints.Count > 0)
{
<div>
<div class="searchSectionTitle">
@searchSection.Key
</div>
<div class="searchContents">
@foreach (var searchPoint in searchPoints)
{
<div>
<button class="searchLink @searchPoint.PointType.ToLower()"
label="@searchPoint.Title"
@onclick="() => OnSearch(searchPoint)">
@searchPoint.Title
</button>
@if (!searchPoint.Summary.Trim().Equals(""))
{
<i> - @searchPoint.Summary</i>
}
</div>
}
</div>
</div>
}
}
}
</div>
</div>
</div>
<style>
.pageContents * {
filter: blur(2px);
}
.searchBackground {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
}
.searchBox {
padding: 12px;
overflow-y: scroll;
overflow-x: hidden;
height: 530px;
border: 1px solid black;
border-radius: 2px;
}
.searchContents {
display: flex;
flex-direction: column;
gap: 6px;
align-items: flex-start;
padding: 12px;
}
.searchSectionTitle {
font-weight: bolder;
}
.searchContainer {
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;
}
.searchLink {
text-decoration: underline;
}
@@media only screen and (max-width: 1025px) {
.searchContainer {
height: 300px;
}
.searchBox {
height: 230px;
}
}
</style>
}
@code {
private ElementReference searchBox;
private string SearchText { get; set; } = "";
protected override void OnInitialized()
{
searchService.Subscribe(OnSearchChanged);
timer = new Timer(200);
timer.Elapsed += FocusTimer;
timer.Enabled = false;
}
private void FocusTimer(object? sender, ElapsedEventArgs e)
{
jsRuntime.InvokeVoidAsync("SetFocusToElement", "searchInput");
StateHasChanged();
}
private Timer timer = null!;
private void OnSearchChanged()
{
if (timer.Enabled != searchService.IsVisible)
{
timer.Enabled = searchService.IsVisible;
}
StateHasChanged();
}
public void Dispose()
{
searchService.Unsubscribe(OnSearchChanged);
timer.Elapsed -= FocusTimer;
}
public void CloseDialog()
{
searchService.Hide();
}
public void NavigateTo(string url)
{
if (url.Contains("#"))
{
navigationManager.NavigateTo(url,
navigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
}
else
{
navigationManager.NavigateTo(url);
}
}
private void SearchChanged(ChangeEventArgs obj)
{
SearchText = obj.Value!.ToString()!;
}
private void OnSearch(SearchPointModel searchPoint)
{
NavigateTo(searchPoint.Href);
searchService.Hide();
}
private void OnFocus(object obj)
{
timer.Enabled = false;
}
}
-5
View File
@@ -1,5 +0,0 @@
@page "/"
@layout PageLayout
<HomePage/>
@@ -1,25 +0,0 @@
@implements IDisposable;
@inject IMyDialogService MyDialogService
<ConfirmationDialogComponent></ConfirmationDialogComponent>
@code {
protected override void OnInitialized()
{
base.OnInitialized();
MyDialogService.Subscribe(OnUpdate);
}
void IDisposable.Dispose()
{
MyDialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
}
-29
View File
@@ -1,29 +0,0 @@
@implements IDisposable;
@inject IEntityDialogService entityDialogService
@if (entityDialogService.HasDialog())
{
<EntityDialogComponent></EntityDialogComponent>
}
@code {
protected override void OnInitialized()
{
base.OnInitialized();
entityDialogService.Subscribe(OnUpdate);
}
void IDisposable.Dispose()
{
entityDialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
}
-28
View File
@@ -1,28 +0,0 @@
@implements IDisposable;
@inject IGlossaryDialogService glossaryDialogService
@if (glossaryDialogService.HasDialog())
{
<GlossaryDialogComponent></GlossaryDialogComponent>
}
@code {
protected override void OnInitialized()
{
base.OnInitialized();
glossaryDialogService.Subscribe(OnUpdate);
}
void IDisposable.Dispose()
{
glossaryDialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
}
-49
View File
@@ -1,49 +0,0 @@
@implements IDisposable;
@inject ISearchService searchService
@inject IJSRuntime jsRuntime
<SearchDialogComponent></SearchDialogComponent>
@code {
private string test = "Q";
protected override void OnInitialized()
{
searchService.Subscribe(OnUpdate);
}
protected override async Task OnInitializedAsync()
{
await searchService.Load();
await jsRuntime.InvokeVoidAsync("SetDotnetReference", DotNetObjectReference.Create(this));
}
public void Dispose()
{
searchService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
[JSInvokable("OnKeyPress")]
public async Task OnKeyPress(string code, bool ctrlKey, bool shiftKey, bool altKey, bool metaKey)
{
if (code.ToLower().Equals("k") && (ctrlKey || shiftKey || altKey || metaKey))
{
if (searchService.IsVisible)
{
searchService.Hide();
}
else
{
searchService.Show();
}
}
}
}
-60
View File
@@ -1,60 +0,0 @@
@implements IDisposable;
@inject IToastService toastService
@if (toastService.HasToasts())
{
<div class="toastsContainer">
@foreach (var toast in Toasts)
{
<ToastComponent Toast="toast"/>
}
</div>
}
<style>
.toastsContainer {
position: fixed;
top: 64px;
right: 64px;
display: flex;
flex-direction: column;
gap: 5px;
}
</style>
@code {
private List<ToastModel> Toasts => toastService.GetToasts();
private Timer ageTimer = null!;
protected override void OnInitialized()
{
base.OnInitialized();
toastService.Subscribe(OnUpdate);
ageTimer = new Timer(10);
ageTimer.Elapsed += OnAge!;
ageTimer.Enabled = true;
}
void IDisposable.Dispose()
{
toastService.Unsubscribe(OnUpdate);
}
void OnAge(object? sender, ElapsedEventArgs elapsedEventArgs)
{
toastService.AgeToasts();
ageTimer.Enabled = true;
}
void OnUpdate()
{
StateHasChanged();
}
}