Improve layout and readability in Documents.razor

- Wrapped checkbox input in a div for better alignment.
- Changed documents initialization from an empty array to a list.
- Updated document addition code for improved readability.
- Modified ConfirmDialogOptions and ToastMessage initializations to use object initializer syntax.
- Translated comment in DocxContentDecoder.cs from Italian to English.
This commit is contained in:
Marco Minerva
2025-06-11 17:47:44 +02:00
parent cdbe2e3a91
commit 1975d63189
2 changed files with 20 additions and 18 deletions
@@ -76,7 +76,9 @@ else
{ {
<tr> <tr>
<td> <td>
<CheckboxInput @bind-Value="document.IsSelected" /> <div class="d-flex justify-content-center align-items-center">
<CheckboxInput @bind-Value="document.IsSelected" />
</div>
</td> </td>
<td>@document.Id</td> <td>@document.Id</td>
<td>@document.Name</td> <td>@document.Name</td>
@@ -138,9 +140,9 @@ else
foreach (var dbDocument in dbDocuments) foreach (var dbDocument in dbDocuments)
{ {
documents.Add(new SelectableDocument(dbDocument.Id, dbDocument.Name, dbDocument.CreationDate, dbDocument.ChunkCount) documents.Add(new SelectableDocument(dbDocument.Id, dbDocument.Name, dbDocument.CreationDate, dbDocument.ChunkCount)
{ {
LocalCreationDateString = await GetLocalDateTimeStringAsync(dbDocument.CreationDate) LocalCreationDateString = await GetLocalDateTimeStringAsync(dbDocument.CreationDate)
}); });
} }
} }
finally finally
@@ -193,12 +195,12 @@ else
var selectedDocumentIds = documents?.Where(d => d.IsSelected).Select(d => d.Id) ?? []; var selectedDocumentIds = documents?.Where(d => d.IsSelected).Select(d => d.Id) ?? [];
var options = new ConfirmDialogOptions var options = new ConfirmDialogOptions
{ {
YesButtonText = "Yes", YesButtonText = "Yes",
YesButtonColor = ButtonColor.Danger, YesButtonColor = ButtonColor.Danger,
NoButtonText = "No", NoButtonText = "No",
NoButtonColor = ButtonColor.Secondary NoButtonColor = ButtonColor.Secondary
}; };
var confirmation = await dialog.ShowAsync( var confirmation = await dialog.ShowAsync(
title: "Delete the selected documents?", title: "Delete the selected documents?",
@@ -236,12 +238,12 @@ else
private async Task<ToastMessage> CreateToastMessageAsync(ToastType toastType, string title, string message) private async Task<ToastMessage> CreateToastMessageAsync(ToastType toastType, string title, string message)
{ {
var toastMessage = new ToastMessage var toastMessage = new ToastMessage
{ {
Type = toastType, Type = toastType,
Title = title, Title = title,
HelpText = await GetLocalDateTimeStringAsync(DateTimeOffset.UtcNow), HelpText = await GetLocalDateTimeStringAsync(DateTimeOffset.UtcNow),
Message = message Message = message
}; };
return toastMessage; return toastMessage;
} }
@@ -36,7 +36,7 @@ public class DocxContentDecoder(IServiceProvider serviceProvider) : IContentDeco
pageBuilder.AppendLine(paragraph.InnerText); pageBuilder.AppendLine(paragraph.InnerText);
} }
// Dopo aver processato tutti i paragrafi, aggiungi l'ultima pagina (anche se vuota) // After processing all paragraphs, add the last page (even if empty).
pages.Add(pageBuilder.ToString()); pages.Add(pageBuilder.ToString());
var chunks = new List<Chunk>(); var chunks = new List<Chunk>();