52 lines
No EOL
1.2 KiB
Text
52 lines
No EOL
1.2 KiB
Text
@using LANCommander.SDK.Services
|
|
@inject ChatClient ChatClient
|
|
@inject ModalService ModalService
|
|
@namespace LANCommander.UI.Components
|
|
|
|
|
|
<Button OnClick="StartThread">New Thread</Button>
|
|
|
|
<ChatList Threads="_threads" />
|
|
|
|
<ChatThread Id="_currentThreadId" />
|
|
|
|
@code {
|
|
IEnumerable<SDK.Models.ChatThread> _threads = [];
|
|
|
|
Guid _currentThreadId;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
_threads = await ChatClient.GetThreadsAsync();
|
|
}
|
|
|
|
async Task StartThread()
|
|
{
|
|
ModalRef modalRef = default;
|
|
modalRef = ModalService.CreateModal<ChatUsersDialog>(new()
|
|
{
|
|
OnOk = async e =>
|
|
{
|
|
modalRef?.SetConfirmLoading(true);
|
|
await Task.Delay(1000);
|
|
|
|
await modalRef.CloseAsync();
|
|
},
|
|
OnCancel = async e =>
|
|
{
|
|
await modalRef.CloseAsync();
|
|
},
|
|
});
|
|
|
|
//await ChatClient.StartThreadAsync(["DoctorDalek"]);
|
|
|
|
//_threads = await ChatClient.GetThreadsAsync();
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
async Task OpenThread(Guid threadId)
|
|
{
|
|
_currentThreadId = threadId;
|
|
}
|
|
} |