Admin portal: dark mode, account management, chat fixes, ability builder

• Light/dark mode toggle: Bootstrap 5.3 data-bs-theme, theme persisted to
  localStorage via admin.js, Moon/Sun icon button in sidebar, flash-free
  inline <script> in App.razor applies saved theme before first render.

• Account management: Add "Create Account" button + new /accounts/new page
  (email, display name, password, role checkboxes). AccountDetail now has
  interactive role assignment (Add/Remove Admin/SuperAdmin — SuperAdmin
  actions gated with <AuthorizeView Roles="SuperAdmin">) and a force-reset
  password section (RemovePasswordAsync + AddPasswordAsync, no current
  password required).

• Chat fixes: stat card labels changed from text-muted → text-white-50 for
  readability on bg-dark; card-headers now have border-bottom border-secondary
  to visually separate from card bodies; "View" button relabeled "View & Post"
  to surface the hidden compose feature.

• Ability builder (AbilityBuilder.razor): structured UI replacing the raw
  textarea in CardEditor. Supports all 4 ability types (Active/Passive/Aura/
  Triggered) with type-specific fields (range, uses/turn, aura range, trigger
  dropdown). Each ability holds structured actions (scope/type/ownership/count
  dropdowns) and effects (59 types in 11 grouped optgroups; each auto-populates
  a JSON fields template on type selection). Description field stores plain-
  English text in the JSON. Raw JSON toggle + Apply for power users. Live
  compiled JSON preview.

• AbilitySystem: added JsonStringEnumConverter so JSONB enums serialize as
  human-readable strings ("Active" vs 0, "Battlefield" vs 3, etc.).
• AbilityDefinition: added optional Description property (admin-only metadata).

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-02-27 10:36:02 -05:00
co-authored by Claude Happy
parent b749905333
commit c493b1b50b
14 changed files with 1072 additions and 36 deletions
@@ -1,3 +1,5 @@
@inject IJSRuntime Js
<nav class="sor-admin-sidebar d-flex flex-column bg-dark text-white p-3">
<a class="navbar-brand text-white fw-bold fs-5 mb-4 text-decoration-none" href="/">
<i class="bi bi-lightning-charge-fill text-warning me-2"></i>SOR Admin
@@ -108,6 +110,18 @@
</ul>
<div class="mt-auto pt-3 border-top border-secondary">
<!-- Theme toggle -->
<button class="btn btn-sm btn-outline-secondary w-100 mb-2" @onclick="ToggleThemeAsync">
@if (_theme == "dark")
{
<i class="bi bi-sun me-1"></i><span>Light Mode</span>
}
else
{
<i class="bi bi-moon me-1"></i><span>Dark Mode</span>
}
</button>
<AuthorizeView>
<Authorized>
<div class="text-muted small mb-2">
@@ -122,3 +136,22 @@
</AuthorizeView>
</div>
</nav>
@code {
private string _theme = "light";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
_theme = await Js.InvokeAsync<string>("sorAdmin.getTheme");
StateHasChanged();
}
}
private async Task ToggleThemeAsync()
{
_theme = _theme == "light" ? "dark" : "light";
await Js.InvokeVoidAsync("sorAdmin.setTheme", _theme);
}
}