Skip to content

Commit

Permalink
note about queryString chatId, remove active chat class
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsPilgaard committed Aug 17, 2023
1 parent 6995bb0 commit e848b2c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/web/Client/Features/Chat/LargeChatComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@inject IJSRuntime JsRuntime
@inject IScrollManager ScrollManager
@attribute [Authorize]

@if (_currentUser is null)
{
return;
Expand All @@ -27,10 +28,8 @@
- Fetch all messages now found in cache
- Fetch all chats not found in cache
- Virtualize chat (load at the top with scroll listener)
- Update selected chat classes
- Select active chat with url to enable chat links
*@
<MudListItem OnClick="@(() => SelectChat(chat))" Dense="true" Class="@(chat.Id == _activeChat?.Id ? _activeChatClass : _inactiveChatClass)">
<MudListItem OnClick="@(() => SelectChat(chat))" Dense="true" Class="chat-selector">

<MudAvatar Size="Size.Large" Class="mr-3">
<MudImage Src="@chat.GetChatImage(_currentUser.Id)" loading="lazy" Alt="Avatar" />
Expand Down Expand Up @@ -97,9 +96,7 @@
private UserSlim _currentUserSlim = null!;
private List<ChatDto> _chats = new();
private ChatDto? _activeChat;

private string _activeChatClass = "chat-selector active";
private string _inactiveChatClass = "chat-selector";

private string _userText = string.Empty;

private bool _enableScrollListener = false;
Expand All @@ -108,6 +105,10 @@

private ElementReference _chatContainer;

// TODO: Select currently displayed chat using this, when we update to dotnet 8
[SupplyParameterFromQuery]
public Guid? ChatId { get; set; }

protected override async Task OnInitializedAsync()
{
_currentUser = await ProfileCache.GetOrCreateProfileAsync();
Expand Down

0 comments on commit e848b2c

Please sign in to comment.