Refactor dialog components to use form-container for improved layout and styling; update button styles for consistency

This commit is contained in:
2026-04-03 08:57:55 +02:00
parent c376c70fec
commit a02b0e9436
9 changed files with 114 additions and 35 deletions

View File

@@ -130,6 +130,8 @@
Message="@($"Soll \"{confirmDeleteEntryTitle}\" wirklich gelöscht werden?")"
ConfirmText="Ja, löschen"
CancelText="Nein, abbrechen"
ConfirmButtonClass="btn btn-danger"
ConfirmIconClass="bi bi-trash"
OnConfirm="HandleConfirmDelete"
OnCancel="CancelDeleteConfirm" />
}
@@ -140,6 +142,8 @@
Message="@($"Soll \"{confirmRestoreEntryTitle}\" wiederhergestellt werden?")"
ConfirmText="Ja, wiederherstellen"
CancelText="Nein, abbrechen"
ConfirmButtonClass="btn btn-warning"
ConfirmIconClass="bi bi-arrow-clockwise"
OnConfirm="HandleConfirmRestore"
OnCancel="CancelRestoreConfirm" />
}

View File

@@ -1,9 +1,17 @@
@page "/"
@inject IAccountService AccountService
@inject ISettingsService SettingsService
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>Übersicht</h2>
<div class="d-flex align-items-center flex-grow-1" style="min-width: 0;">
<h2 class="mb-0 mt-0" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
@DisplayClubName
<button class="btn-edit-pen" @onclick="() => showEditClubName = true" title="Vereinsname bearbeiten">
<i class="bi bi-pencil"></i>
</button>
</h2>
</div>
<div class="d-flex gap-2">
<button class="btn btn-primary" @onclick="() => showAddAccount = true">
<i class="bi bi-plus-lg"></i> Neues Konto
@@ -38,12 +46,25 @@
<AddAccountDialog OnSave="HandleAccountCreated" OnCancel="() => showAddAccount = false" />
}
@if (showEditClubName)
{
<EditNameDialog CurrentName="clubName"
DialogTitle="Vereinsname bearbeiten"
NameLabel="Vereinsname"
OnSave="HandleSaveClubName"
OnCancel="() => showEditClubName = false" />
}
@code {
private List<AccountSummaryDto>? accounts;
private bool showAddAccount;
private bool showEditClubName;
private string clubName = string.Empty;
private string DisplayClubName => string.IsNullOrWhiteSpace(clubName) ? "Mein Verein" : clubName;
protected override async Task OnInitializedAsync()
{
await LoadClubName();
await LoadAccounts();
}
@@ -52,10 +73,22 @@
accounts = await AccountService.GetAllAccountsAsync();
}
private async Task LoadClubName()
{
clubName = await SettingsService.GetClubNameAsync() ?? string.Empty;
}
private async Task HandleAccountCreated(string name)
{
await AccountService.CreateAccountAsync(name);
showAddAccount = false;
await LoadAccounts();
}
private async Task HandleSaveClubName(string newName)
{
await SettingsService.SetClubNameAsync(newName);
showEditClubName = false;
await LoadClubName();
}
}