Agent Catalog and Maui Test

This commit is contained in:
2026-06-08 20:23:23 -04:00
parent 7310e4ed71
commit e9d60e3983
50 changed files with 2637 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
@inherits LayoutComponentBase
<div class="page">
<div class="sidebar">
<NavMenu/>
</div>
<main>
<div class="top-row px-4">
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
</div>
<article class="content px-4">
@Body
</article>
</main>
</div>
@@ -0,0 +1,83 @@
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
padding-bottom: env(safe-area-inset-bottom, 0px);
padding-right: env(safe-area-inset-right, 0px);
}
.top-row {
padding-right: env(safe-area-inset-right, 0px);
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row {
justify-content: space-between;
}
.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
+32
View File
@@ -0,0 +1,32 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">Hybrid</a>
</div>
</div>
<input type="checkbox" title="Navigation menu" class="navbar-toggler"/>
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
<nav class="nav flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="database">
<span class="bi bi-database-fill-nav-menu" aria-hidden="true"></span> Database
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="weather">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
</NavLink>
</div>
</nav>
</div>
+106
View File
@@ -0,0 +1,106 @@
.navbar-toggler {
appearance: none;
cursor: pointer;
width: 3.5rem;
height: 2.5rem;
color: white;
position: absolute;
top: 0.5rem;
right: 1rem;
border: 1px solid rgba(255, 255, 255, 0.1);
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
}
.navbar-toggler:checked {
background-color: rgba(255, 255, 255, 0.5);
}
.top-row {
min-height: 3.5rem;
background-color: rgba(0,0,0,0.4);
}
.navbar-brand {
font-size: 1.1rem;
padding-left: env(safe-area-inset-left, 0px);
}
.bi {
display: inline-block;
position: relative;
width: 1.25rem;
height: 1.25rem;
margin-right: 0.75rem;
top: -1px;
background-size: cover;
}
.bi-house-door-fill-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
}
.bi-plus-square-fill-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
}
.bi-list-nested-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep .nav-link {
color: #d7d7d7;
background: none;
border: none;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
width: 100%;
}
.nav-item ::deep a.active {
background-color: rgba(255,255,255,0.37);
color: white;
}
.nav-item ::deep .nav-link:hover {
background-color: rgba(255,255,255,0.1);
color: white;
}
.nav-scrollable {
display: none;
}
.navbar-toggler:checked ~ .nav-scrollable {
display: block;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;
}
.nav-scrollable {
/* Never collapse the sidebar for wide screens */
display: block;
/* Allow sidebar to scroll for tall menus */
height: calc(100vh - 3.5rem);
overflow-y: auto;
}
}
+17
View File
@@ -0,0 +1,17 @@
@page "/counter"
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}
+191
View File
@@ -0,0 +1,191 @@
@page "/database"
@using Model.Entity
@using Model.Entity.Data
@using Model.Entity.Parts
<PageTitle>Database</PageTitle>
<div class="container-fluid py-3">
<h1 class="mb-3">Database</h1>
<div class="card mb-4 shadow-sm filters-card">
<div class="card-body">
<div class="row g-3 align-items-end">
<div class="col-12 col-md-6 col-lg-4">
<label for="factionSelect" class="form-label fw-semibold">Faction</label>
<select id="factionSelect" class="form-select" @bind="selectedFaction" @bind:after="OnFactionChanged">
<option value="@DataType.Any">Any</option>
<option value="@DataType.FACTION_QRath">Q'Rath</option>
<option value="@DataType.FACTION_Aru">Aru</option>
</select>
</div>
<div class="col-12 col-md-6 col-lg-4">
<label for="immortalSelect" class="form-label fw-semibold">Immortal</label>
<select id="immortalSelect" class="form-select" @bind="selectedImmortal" @bind:after="OnImmortalChanged">
<option value="@DataType.Any">Any</option>
@foreach (var choice in immortalChoices)
{
<option value="@choice.Key">@choice.Name</option>
}
</select>
</div>
</div>
<div class="mt-2 text-muted small">
Showing @filteredEntities.Count @(filteredEntities.Count == 1 ? "entity" : "entities")
</div>
</div>
</div>
<div class="row g-3">
@foreach (var entity in filteredEntities)
{
<div class="col-12 col-sm-6 col-lg-4 col-xl-3">
<div class="card h-100 shadow-sm entity-card">
<div class="card-body d-flex flex-column">
<div class="d-flex justify-content-between align-items-start mb-2 gap-2">
<h5 class="card-title mb-0 text-break">@entity.Info().Name</h5>
@{
var vanguard = entity.VanguardAdded();
if (vanguard != null)
{
<span class="immortal-badge">@(EntityData.Get().TryGetValue(vanguard!.ImmortalId, out var imm) ? imm.Info().Name : "")</span>
}
}
</div>
<h6 class="card-subtitle mb-2">
<span class="badge bg-secondary me-1">@entity.EntityType.Replace("_", " ")</span>
@if (entity.Faction() != null)
{
<span class="badge bg-dark-subtle text-dark-emphasis">@(EntityData.Get().TryGetValue(entity.Faction().Faction, out var fac) ? fac.Info().Name : "")</span>
}
</h6>
@if (!string.IsNullOrEmpty(entity.Info().Description))
{
<p class="card-text flex-grow-1 small">
@(entity.Info().Description.Length > 120
? entity.Info().Description[..117] + "..."
: entity.Info().Description)
</p>
}
</div>
</div>
</div>
}
</div>
@if (filteredEntities.Count == 0)
{
<div class="alert alert-info mt-3" role="alert">No entities match the selected filters.</div>
}
</div>
<style>
.filters-card {
border: 1px solid rgba(0, 0, 0, 0.125);
}
.entity-card {
border: 1px solid rgba(0, 0, 0, 0.125);
transition: box-shadow 0.15s ease-in-out;
}
.entity-card:hover {
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}
.immortal-badge {
display: inline-block;
padding: 0.25em 0.65em;
font-size: 0.75em;
font-weight: 700;
line-height: 1;
color: #000;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.375rem;
background-color: #cff4fc;
flex-shrink: 0;
}
</style>
@code {
private string selectedFaction = DataType.Any;
private string selectedImmortal = DataType.Any;
private List<ImmortalChoice> immortalChoices = new();
private List<EntityModel> allEntities = new();
private List<EntityModel> filteredEntities = new();
protected override void OnInitialized()
{
allEntities = EntityModel.GetList()
.Where(e => !e.IsSpeculative)
.ToList();
RefreshImmortalChoices();
ApplyFilters();
}
private void OnFactionChanged()
{
if (selectedFaction != DataType.FACTION_QRath && selectedFaction != DataType.FACTION_Aru)
{
selectedFaction = DataType.Any;
}
selectedImmortal = DataType.Any;
RefreshImmortalChoices();
ApplyFilters();
}
private void OnImmortalChanged()
{
ApplyFilters();
}
private void RefreshImmortalChoices()
{
immortalChoices.Clear();
if (selectedFaction == DataType.FACTION_QRath || selectedFaction == DataType.Any)
{
AddImmortalChoice(DataType.IMMORTAL_Orzum);
AddImmortalChoice(DataType.IMMORTAL_Ajari);
}
if (selectedFaction == DataType.FACTION_Aru || selectedFaction == DataType.Any)
{
AddImmortalChoice(DataType.IMMORTAL_Atzlan);
AddImmortalChoice(DataType.IMMORTAL_Mala);
AddImmortalChoice(DataType.IMMORTAL_Xol);
}
}
private void AddImmortalChoice(string id)
{
var name = EntityData.Get().TryGetValue(id, out var model)
? model.Info().Name
: id.Replace("IMMORTAL_", "");
immortalChoices.Add(new ImmortalChoice(id, name));
}
private void ApplyFilters()
{
var query = allEntities.AsEnumerable();
if (selectedFaction != DataType.Any)
{
query = query.Where(e =>
e.Faction() != null && e.Faction().Faction == selectedFaction);
}
if (selectedImmortal != DataType.Any)
{
query = query.Where(e =>
e.VanguardAdded() != null && e.VanguardAdded().ImmortalId == selectedImmortal);
}
filteredEntities = query.OrderBy(e => e.Info().Name).ToList();
}
private record ImmortalChoice(string Key, string Name);
}
+7
View File
@@ -0,0 +1,7 @@
@page "/"
<h1>Hello, world!</h1>
Welcome to your new app.
<ButtonComponent>Test</ButtonComponent>
+5
View File
@@ -0,0 +1,5 @@
@page "/not-found"
@layout MainLayout
<h3>Not Found</h3>
<p>Sorry, the content you are looking for does not exist.</p>
+64
View File
@@ -0,0 +1,64 @@
@page "/weather"
<h1>Weather</h1>
<p>This component demonstrates showing data.</p>
@if (forecasts == null)
{
<p>
<em>Loading...</em>
</p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th aria-label="Temperature in Celsius">Temp. (C)</th>
<th aria-label="Temperature in Fahrenheit">Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
// Simulate asynchronous loading to demonstrate a loading indicator
await Task.Delay(500);
var startDate = DateOnly.FromDateTime(DateTime.Now);
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = summaries[Random.Shared.Next(summaries.Length)]
}).ToArray();
}
private class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}
+6
View File
@@ -0,0 +1,6 @@
<Router AppAssembly="typeof(MauiProgram).Assembly" NotFoundPage="typeof(Pages.NotFound)">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)"/>
<FocusOnNavigate RouteData="routeData" Selector="h1"/>
</Found>
</Router>
+11
View File
@@ -0,0 +1,11 @@
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using Hybrid
@using Hybrid.Components
@using Hybrid.Components.Layout
@using global::Components.Inputs