decePubClient/Pages/ExpandMessage.razor
Eugenio Chiodo ba4a4b14c8 Saving
2022-02-14 01:51:37 +01:00

43 lines
1.1 KiB
Plaintext

@page "/expand/{messageId}"
<Title>@Localizer</Title>
<section class="block relative w-full h-full neomorphInset is-nxsmall rounded-xl">
<div class="flex flex-col space-y-4 p-4 md:p-5 w-full h-full absolute overflow-y-auto">
</div>
</section>
@code {
[CascadingParameter] IStringLocalizer<AllStrings> Localizer { get; set; }
[Inject] NavigationManager Navigation { get; set; }
[Inject] IStorage DbStorage { get; set; }
[SupplyParameterFromQuery] string messageId { get; set; }
List<Message> Messages { get; set; } = new();
protected override async Task OnInitializedAsync()
{
if (messageId is { Length: 0 })
{
Navigation.NavigateTo("/");
return;
}
var currentMessage = await DbStorage.GetMessage(messageId);
var messages = await DbStorage.GetMessages();
if (currentMessage.RootMessageId is { Length: > 0 })
Messages = messages.Where(m => m.RootMessageId == currentMessage.RootMessageId)
.OrderByDescending(m => m.CreatedAt)
.ToList();
else
Messages = messages.Where(m => m.RootMessageId == messageId)
.OrderByDescending(m => m.CreatedAt)
.ToList();
}
}