Agent Tests for API, MAUI, and Slop Features
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
@if (StyleType.Equals("Plain"))
|
||||
@inject IGlossaryService glossaryService
|
||||
|
||||
@if (StyleType.Equals("Plain"))
|
||||
{
|
||||
@if (Entity!.Info().Description != "")
|
||||
{
|
||||
<div>
|
||||
<b>Description:</b> @((MarkupString)Entity.Info().Description)
|
||||
<b>Description:</b> @((MarkupString)glossaryService.LinkifyText(Entity.Info().Description))
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Entity.Info().Notes != "")
|
||||
{
|
||||
<div>
|
||||
<b>Notes:</b> @((MarkupString)Entity.Info().Notes)
|
||||
<b>Notes:</b> @((MarkupString)glossaryService.LinkifyText(Entity.Info().Notes))
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Entity.Info().FlavorText != "")
|
||||
{
|
||||
<div>
|
||||
<i>@((MarkupString)Entity.Info().FlavorText)</i>
|
||||
<i>@((MarkupString)glossaryService.LinkifyText(Entity.Info().FlavorText))</i>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -59,14 +61,14 @@ else
|
||||
@if (Entity!.Info().Description != "")
|
||||
{
|
||||
<div>
|
||||
<b>Description:</b> @((MarkupString)Entity.Info().Description)
|
||||
<b>Description:</b> @((MarkupString)glossaryService.LinkifyText(Entity.Info().Description))
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Entity.Info().Notes != "")
|
||||
{
|
||||
<div>
|
||||
<b>Notes:</b> @((MarkupString)Entity.Info().Notes)
|
||||
<b>Notes:</b> @((MarkupString)glossaryService.LinkifyText(Entity.Info().Notes))
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
@layout PageLayout
|
||||
@inject IGlossaryService glossaryService
|
||||
@inject IGlossaryDialogService glossaryDialogService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@page "/glossary/{TermId}"
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
@if (term != null)
|
||||
{
|
||||
<WebsiteTitleComponent>@term.Term</WebsiteTitleComponent>
|
||||
|
||||
<PaperComponent>
|
||||
<div class="detailCategory">@term.Category</div>
|
||||
<div class="detailDefinition">@((MarkupString)RenderMarkdown(term.LongDefinition))</div>
|
||||
</PaperComponent>
|
||||
|
||||
@if (term.RelatedEntityIds.Count > 0)
|
||||
{
|
||||
<PaperComponent>
|
||||
<div class="detailSectionTitle">Related Entities</div>
|
||||
<div class="detailRelatedList">
|
||||
@foreach (var entityId in term.RelatedEntityIds)
|
||||
{
|
||||
<EntityLabelComponent EntityId="@entityId"/>
|
||||
}
|
||||
</div>
|
||||
</PaperComponent>
|
||||
}
|
||||
|
||||
@if (term.RelatedTermIds.Count > 0)
|
||||
{
|
||||
<PaperComponent>
|
||||
<div class="detailSectionTitle">Related Terms</div>
|
||||
<div class="detailRelatedList">
|
||||
@foreach (var relatedId in term.RelatedTermIds)
|
||||
{
|
||||
<GlossaryLabelComponent TermId="@relatedId"/>
|
||||
}
|
||||
</div>
|
||||
</PaperComponent>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<WebsiteTitleComponent>Term not found</WebsiteTitleComponent>
|
||||
<PaperComponent>
|
||||
<p>The glossary term you're looking for doesn't exist.</p>
|
||||
</PaperComponent>
|
||||
}
|
||||
</LayoutMediumContentComponent>
|
||||
|
||||
<style>
|
||||
.detailCategory {
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.7;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.detailDefinition {
|
||||
line-height: 1.6;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.detailDefinition p {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.detailSectionTitle {
|
||||
font-weight: 800;
|
||||
font-size: 1.1rem;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.detailRelatedList {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter] public string TermId { get; set; } = "";
|
||||
|
||||
private GlossaryTermModel? term;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
term = glossaryService.GetTerm(TermId);
|
||||
}
|
||||
|
||||
string RenderMarkdown(string text)
|
||||
{
|
||||
return Markdown.ToHtml(text);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
@layout PageLayout
|
||||
@inherits BasePage
|
||||
@inject IGlossaryService glossaryService
|
||||
@inject IGlossaryDialogService glossaryDialogService
|
||||
|
||||
@page "/glossary"
|
||||
|
||||
<LayoutLargeContentComponent>
|
||||
<WebsiteTitleComponent>Glossary</WebsiteTitleComponent>
|
||||
|
||||
<div class="glossaryControls">
|
||||
<input class="glossarySearch" @bind="searchText" @bind:after="OnSearchChanged" placeholder="Search terms..."/>
|
||||
<div class="glossaryCategories">
|
||||
<button class="glossaryCategory @(selectedCategory == null ? "active" : "")"
|
||||
@onclick="() => SelectCategory(null)">All
|
||||
</button>
|
||||
@foreach (var cat in categories)
|
||||
{
|
||||
<button class="glossaryCategory @(selectedCategory == cat ? "active" : "")"
|
||||
@onclick="() => SelectCategory(cat)">@cat</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="glossaryGrid">
|
||||
@foreach (var term in filteredTerms)
|
||||
{
|
||||
<PaperComponent>
|
||||
<div class="glossaryCard" @onclick="() => glossaryDialogService.AddDialog(term.Id)">
|
||||
<div class="glossaryCardHeader">
|
||||
<span class="glossaryCardTerm">@term.Term</span>
|
||||
<span class="glossaryCardCategory">@term.Category</span>
|
||||
</div>
|
||||
<div class="glossaryCardBody">@term.ShortDefinition</div>
|
||||
</div>
|
||||
</PaperComponent>
|
||||
}
|
||||
</div>
|
||||
</LayoutLargeContentComponent>
|
||||
|
||||
<style>
|
||||
.glossaryControls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.glossarySearch {
|
||||
padding: 10px 16px;
|
||||
border-radius: 8px;
|
||||
border: 2px solid var(--primary-border);
|
||||
background-color: var(--primary);
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.glossarySearch::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.glossaryCategories {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.glossaryCategory {
|
||||
padding: 6px 14px;
|
||||
border-radius: 16px;
|
||||
border: 2px solid var(--primary-border);
|
||||
background-color: var(--primary);
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.glossaryCategory.active {
|
||||
background-color: var(--primary-hover);
|
||||
border-color: var(--primary-border-hover);
|
||||
}
|
||||
|
||||
.glossaryCategory:hover {
|
||||
background-color: var(--primary-hover);
|
||||
}
|
||||
|
||||
.glossaryGrid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.glossaryCard {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.glossaryCardHeader {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.glossaryCardTerm {
|
||||
font-weight: 800;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.glossaryCardCategory {
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.glossaryCardBody {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.4;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
@@media only screen and (max-width: 1025px) {
|
||||
.glossaryGrid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
private string searchText = "";
|
||||
private string? selectedCategory;
|
||||
private List<string> categories = new();
|
||||
private List<GlossaryTermModel> allTerms = new();
|
||||
private List<GlossaryTermModel> filteredTerms = new();
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
allTerms = glossaryService.GetAllTerms();
|
||||
categories = glossaryService.GetCategories();
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
void OnSearchChanged()
|
||||
{
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
void SelectCategory(string? category)
|
||||
{
|
||||
selectedCategory = category;
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
void ApplyFilter()
|
||||
{
|
||||
var query = allTerms.AsEnumerable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
query = query.Where(t =>
|
||||
t.Term.Contains(searchText, StringComparison.OrdinalIgnoreCase) ||
|
||||
t.ShortDefinition.Contains(searchText, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
if (selectedCategory != null)
|
||||
{
|
||||
query = query.Where(t =>
|
||||
t.Category.Equals(selectedCategory, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
filteredTerms = query.ToList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
@layout PageLayout
|
||||
@inherits BasePage
|
||||
@inject TechTreeService techTreeService
|
||||
@inject IEntityDialogService entityDialogService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@page "/tech-tree"
|
||||
|
||||
<LayoutLargeContentComponent>
|
||||
<WebsiteTitleComponent>Tech Tree</WebsiteTitleComponent>
|
||||
|
||||
<div class="techTreeControls">
|
||||
<div class="techTreeFilters">
|
||||
<span class="techTreeLabel">Faction:</span>
|
||||
<button class="techTreeFilter @(selectedFaction == null ? "active" : "")"
|
||||
@onclick="() => SelectFaction(null)">All
|
||||
</button>
|
||||
@foreach (var faction in factions)
|
||||
{
|
||||
var factionName = GetFactionName(faction);
|
||||
<button class="techTreeFilter @(selectedFaction == faction ? "active" : "")"
|
||||
@onclick="() => SelectFaction(faction)">@factionName</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="techTreeSearchRow">
|
||||
<input class="techTreeSearch" @bind="searchText" @bind:after="OnSearchChanged"
|
||||
placeholder="Search for an entity..."/>
|
||||
@if (!string.IsNullOrEmpty(highlightEntityId))
|
||||
{
|
||||
<button class="techTreeClearBtn" @onclick="ClearHighlight">Clear Highlight</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="techTreeLegend">
|
||||
<span class="legendItem"><span class="legendLine" style="background: #2ed573;"></span> Produces</span>
|
||||
<span class="legendItem"><span class="legendLine"
|
||||
style="background: #ffa502; border-top: 3px dashed #ffa502; height: 0;"></span> Requires Building</span>
|
||||
<span class="legendItem"><span class="legendLine"
|
||||
style="background: #a55eea; border-top: 3px dashed #a55eea; height: 0;"></span> Requires Research</span>
|
||||
<span class="legendItem"><span class="legendLine"
|
||||
style="background: #ff6b6b; border-top: 2px dotted #ff6b6b; height: 0;"></span> Morph</span>
|
||||
<span class="legendItem"><span class="legendLine" style="background: #1e90ff;"></span> Upgrade</span>
|
||||
</div>
|
||||
|
||||
@if (currentGraph != null && currentGraph.Nodes.Count > 0)
|
||||
{
|
||||
<TechTreeGraphComponent Graph="@currentGraph" HighlightEntityId="@highlightEntityId"
|
||||
OnEntitySelected="OnEntitySelected"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<PaperComponent>
|
||||
<p>No data available for the selected faction.</p>
|
||||
</PaperComponent>
|
||||
}
|
||||
</LayoutLargeContentComponent>
|
||||
|
||||
<style>
|
||||
.techTreeControls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.techTreeFilters {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.techTreeLabel {
|
||||
font-weight: 700;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.techTreeFilter {
|
||||
padding: 6px 14px;
|
||||
border-radius: 16px;
|
||||
border: 2px solid var(--primary-border);
|
||||
background-color: var(--primary);
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.techTreeFilter.active {
|
||||
background-color: var(--primary-hover);
|
||||
border-color: var(--primary-border-hover);
|
||||
}
|
||||
|
||||
.techTreeFilter:hover {
|
||||
background-color: var(--primary-hover);
|
||||
}
|
||||
|
||||
.techTreeSearchRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.techTreeSearch {
|
||||
padding: 10px 16px;
|
||||
border-radius: 8px;
|
||||
border: 2px solid var(--primary-border);
|
||||
background-color: var(--primary);
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
flex: 1;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.techTreeSearch::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.techTreeClearBtn {
|
||||
padding: 6px 14px;
|
||||
border-radius: 8px;
|
||||
border: 2px solid var(--primary-border);
|
||||
background-color: transparent;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.techTreeClearBtn:hover {
|
||||
background-color: var(--primary-hover);
|
||||
}
|
||||
|
||||
.techTreeLegend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
padding: 12px;
|
||||
background-color: var(--paper);
|
||||
border: 2px solid var(--paper-border);
|
||||
border-radius: 8px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.legendItem {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.legendLine {
|
||||
display: inline-block;
|
||||
width: 24px;
|
||||
height: 3px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
private TechTreeGraphModel? currentGraph;
|
||||
private List<string> factions = new();
|
||||
private string? selectedFaction;
|
||||
private string searchText = "";
|
||||
private string? highlightEntityId;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
LoadGraph();
|
||||
}
|
||||
|
||||
void LoadGraph()
|
||||
{
|
||||
currentGraph = techTreeService.BuildGraph(selectedFaction);
|
||||
factions = techTreeService.GetFactions();
|
||||
}
|
||||
|
||||
void SelectFaction(string? faction)
|
||||
{
|
||||
selectedFaction = faction;
|
||||
highlightEntityId = null;
|
||||
LoadGraph();
|
||||
}
|
||||
|
||||
void OnSearchChanged()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
highlightEntityId = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var found = currentGraph?.Nodes
|
||||
.FirstOrDefault(n => n.Name.Contains(searchText, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
highlightEntityId = found?.Id;
|
||||
}
|
||||
|
||||
void ClearHighlight()
|
||||
{
|
||||
highlightEntityId = null;
|
||||
searchText = "";
|
||||
}
|
||||
|
||||
void OnEntitySelected(string entityId)
|
||||
{
|
||||
highlightEntityId = entityId;
|
||||
}
|
||||
|
||||
string GetFactionName(string factionId)
|
||||
{
|
||||
var entities = EntityData.Get();
|
||||
return entities.TryGetValue(factionId, out var entity)
|
||||
? entity.Info()?.Name ?? factionId
|
||||
: factionId;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user