...docker test
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@page "/cards"
|
||||
@inject HttpClient Http
|
||||
|
||||
<PageTitle>Card Gallery</PageTitle>
|
||||
|
||||
@@ -211,6 +212,19 @@
|
||||
<span class="field-value">@selectedCard.ImmortalizeFrom</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (selectedCard.IsAgent)
|
||||
{
|
||||
<div class="detail-field note">
|
||||
<span class="field-label"><i class="bi bi-pencil-fill"></i> Personal Note</span>
|
||||
<textarea class="form-control note-input" @bind="currentNote" @onblur="SaveNote"
|
||||
placeholder="Add a private note about this agent..."></textarea>
|
||||
@if (isSaving)
|
||||
{
|
||||
<span class="saving-indicator">Saving...</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -225,6 +239,8 @@
|
||||
private string costFilter = "";
|
||||
private CardData? selectedCard;
|
||||
private List<string> factions = [];
|
||||
private string currentNote = "";
|
||||
private bool isSaving = false;
|
||||
|
||||
private bool HasActiveFilters => categoryFilter != "" || factionFilter != "" || costFilter != "";
|
||||
|
||||
@@ -276,9 +292,41 @@
|
||||
search = "";
|
||||
}
|
||||
|
||||
private void SelectCard(CardData card)
|
||||
private async Task SelectCard(CardData card)
|
||||
{
|
||||
selectedCard = card;
|
||||
if (card.IsAgent)
|
||||
{
|
||||
currentNote = "";
|
||||
try
|
||||
{
|
||||
var note = await Http.GetFromJsonAsync<CardNote>($"api/notes/{Uri.EscapeDataString(card.Name)}");
|
||||
currentNote = note?.Note ?? "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
currentNote = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveNote()
|
||||
{
|
||||
if (selectedCard == null || !selectedCard.IsAgent) return;
|
||||
|
||||
isSaving = true;
|
||||
try
|
||||
{
|
||||
await Http.PostAsJsonAsync("api/notes", new CardNote { CardName = selectedCard.Name, Note = currentNote });
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Error handling
|
||||
}
|
||||
finally
|
||||
{
|
||||
isSaving = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseDetail()
|
||||
|
||||
Reference in New Issue
Block a user