Skip to content

Commit f639da6

Browse files
committed
less null refs
1 parent 275ca99 commit f639da6

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

src/web/Jordnaer/Features/Chat/ChatMessageList.razor

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,30 @@
1111

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

14-
@if (ActiveChat is null && IsMobile is false)
14+
@switch (ActiveChat)
1515
{
16-
<MudStack Row Style="margin-left: -24px;">
17-
<MudIcon Icon="@Icons.Material.Filled.ArrowCircleLeft" Size="Size.Large" Color="Color.Info" />
18-
<MudText Typo="Typo.h5">Vælg én at skrive med</MudText>
19-
</MudStack>
20-
return;
16+
case null when IsMobile:
17+
return;
18+
case null when IsMobile is false:
19+
<MudStack Row Style="margin-left: -24px;">
20+
<MudIcon Icon="@Icons.Material.Filled.ArrowCircleLeft" Size="Size.Large" Color="Color.Info" />
21+
<MudText Typo="Typo.h5">Vælg én at skrive med</MudText>
22+
</MudStack>
23+
return;
24+
case not null when IsMobile:
25+
<MudAppBar Dense
26+
ToolBarClass="justify-space-between h-100"
27+
Color="Color.Primary"
28+
Elevation="5">
29+
<MudFab StartIcon="@Icons.Material.Filled.ArrowBack"
30+
OnClick="BackToList"
31+
Color="Color.Info"
32+
Size="Size.Small" />
33+
<MudText Typo="Typo.h5">@ActiveChat.GetDisplayName(CurrentUser.Id!)</MudText>
34+
</MudAppBar>
35+
break;
2136
}
2237

23-
@if (IsMobile)
24-
{
25-
<MudAppBar Dense
26-
ToolBarClass="justify-space-between h-100"
27-
Color="Color.Primary"
28-
Elevation="5">
29-
<MudFab StartIcon="@Icons.Material.Filled.ArrowBack"
30-
OnClick="BackToList"
31-
Color="Color.Info"
32-
Size="Size.Small" />
33-
<MudText Typo="Typo.h5">@ActiveChat.GetDisplayName(CurrentUser.Id!)</MudText>
34-
</MudAppBar>
35-
}
36-
3738
@*The elements below cannot be readonly/disabled, as it disabled the tooltips *@
3839
<MudList Class="chat-message-list" Padding="false" Dense T="RenderFragment">
3940
<MudSpacer />
@@ -163,7 +164,7 @@
163164

164165
protected override async Task OnAfterRenderAsync(bool firstRender)
165166
{
166-
await JsRuntime.ScrollToBottomOfElement(".chat-message-window");
167+
await JsRuntime.ScrollToBottomOfElement(".chat-message-window");
167168
}
168169

169170
private void MarkMessageIfSuccessfullySentByCurrentUser()

0 commit comments

Comments
 (0)