Skip to content

Commit

Permalink
less null refs
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsPilgaard committed Aug 18, 2024
1 parent 275ca99 commit f639da6
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/web/Jordnaer/Features/Chat/ChatMessageList.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,30 @@

<MudItem Class="@MudItemClass" Style="@MudItemStyle" xs="12" sm="12" md="8" lg="8" xl="8" xxl="8">

@if (ActiveChat is null && IsMobile is false)
@switch (ActiveChat)
{
<MudStack Row Style="margin-left: -24px;">
<MudIcon Icon="@Icons.Material.Filled.ArrowCircleLeft" Size="Size.Large" Color="Color.Info" />
<MudText Typo="Typo.h5">Vælg én at skrive med</MudText>
</MudStack>
return;
case null when IsMobile:
return;
case null when IsMobile is false:
<MudStack Row Style="margin-left: -24px;">
<MudIcon Icon="@Icons.Material.Filled.ArrowCircleLeft" Size="Size.Large" Color="Color.Info" />
<MudText Typo="Typo.h5">Vælg én at skrive med</MudText>
</MudStack>
return;
case not null when IsMobile:
<MudAppBar Dense
ToolBarClass="justify-space-between h-100"
Color="Color.Primary"
Elevation="5">
<MudFab StartIcon="@Icons.Material.Filled.ArrowBack"
OnClick="BackToList"
Color="Color.Info"
Size="Size.Small" />
<MudText Typo="Typo.h5">@ActiveChat.GetDisplayName(CurrentUser.Id!)</MudText>
</MudAppBar>
break;
}

@if (IsMobile)
{
<MudAppBar Dense
ToolBarClass="justify-space-between h-100"
Color="Color.Primary"
Elevation="5">
<MudFab StartIcon="@Icons.Material.Filled.ArrowBack"
OnClick="BackToList"
Color="Color.Info"
Size="Size.Small" />
<MudText Typo="Typo.h5">@ActiveChat.GetDisplayName(CurrentUser.Id!)</MudText>
</MudAppBar>
}

@*The elements below cannot be readonly/disabled, as it disabled the tooltips *@
<MudList Class="chat-message-list" Padding="false" Dense T="RenderFragment">
<MudSpacer />
Expand Down Expand Up @@ -163,7 +164,7 @@

protected override async Task OnAfterRenderAsync(bool firstRender)
{
await JsRuntime.ScrollToBottomOfElement(".chat-message-window");
await JsRuntime.ScrollToBottomOfElement(".chat-message-window");
}

private void MarkMessageIfSuccessfullySentByCurrentUser()
Expand Down

0 comments on commit f639da6

Please sign in to comment.