LANCommander/LANCommander.UI/Components/Chat/ChatList.razor

22 lines
748 B
Text
Raw Permalink Normal View History

@namespace LANCommander.UI.Components
<Flex Direction="FlexDirection.Vertical">
@foreach (var thread in Threads)
{
<ChatListThread Thread="thread" OnSelected="SelectThread" Active="@(SelectedThread?.Id == thread.Id)" />
}
</Flex>
@code {
[Parameter] public required IEnumerable<SDK.Models.ChatThread> Threads { get; set; } = [];
[Parameter] public SDK.Models.ChatThread? SelectedThread { get; set; }
[Parameter] public EventCallback<SDK.Models.ChatThread> SelectedThreadChanged { get; set; }
async Task SelectThread(SDK.Models.ChatThread thread)
{
SelectedThread = thread;
if (SelectedThreadChanged.HasDelegate)
await SelectedThreadChanged.InvokeAsync(SelectedThread);
}
}