|
3 | 3 | @inject IProfileCache ProfileCache
|
4 | 4 | @inject ISnackbar Snackbar
|
5 | 5 | @inject IJSRuntime JsRuntime
|
| 6 | +@inject IBrowserViewportService BrowserViewportService |
6 | 7 | @inject ChatSignalRClient ChatSignalRClient
|
7 | 8 | @attribute [Authorize]
|
8 | 9 |
|
|
14 | 15 | <MudLoading @bind-Loading="_isLoading" Darken Overlap>
|
15 | 16 | <MudGrid Style="height: 600px">
|
16 | 17 |
|
17 |
| - <ChatSelector CurrentUser="_currentUser" Chats="_chats" SelectChatCallback="SelectChat" StartNewChatCallback="StartNewChat"/> |
| 18 | + @if ((_activeChat is null && _isMobile) || _isMobile is false) |
| 19 | + { |
| 20 | + <ChatSelector CurrentUser="_currentUser" Chats="_chats" SelectChatCallback="SelectChat" StartNewChatCallback="StartNewChat"/> |
| 21 | + } |
18 | 22 |
|
19 |
| - <MudItem md="1" lg="1" xl="1" xxl="1"> |
20 |
| - <MudDivider Vertical DividerType="DividerType.FullWidth"/> |
21 |
| - </MudItem> |
| 23 | + @if (_isMobile is false) |
| 24 | + { |
| 25 | + <MudItem md="1" lg="1" xl="1" xxl="1"> |
| 26 | + <MudDivider Vertical DividerType="DividerType.FullWidth"/> |
| 27 | + </MudItem> |
| 28 | + } |
| 29 | + |
| 30 | + @if (_activeChat is not null) |
| 31 | + { |
| 32 | + <MudItem Class="chat-message-window" xs="12" sm="12" md="8" lg="8" xl="8" xxl="8"> |
| 33 | + @if (_isMobile) |
| 34 | + { |
| 35 | + @*something like a banner is needed here, with display name and back button |
| 36 | + Use MudAppBar |
| 37 | + *@ |
| 38 | + <MudScrollToTop OnClick="BackToList"></MudScrollToTop> |
| 39 | + <MudFab StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="BackToList" Color="Color.Primary"/> |
| 40 | + <MudText>@_activeChat.GetDisplayName(_currentUser.Id)</MudText> |
| 41 | + |
| 42 | + } |
22 | 43 |
|
23 |
| - <MudItem Class="chat-message-window" md="8" lg="8" xl="8" xxl="8"> |
24 |
| - @if (_activeChat != null) |
25 |
| - { |
26 | 44 | <MudList Class="chat-message-list" DisablePadding Dense>
|
27 | 45 |
|
28 |
| - <ChatMessageList CurrentUser="_currentUser" ActiveChat="_activeChat" /> |
| 46 | + <ChatMessageList CurrentUser="_currentUser" ActiveChat="_activeChat"/> |
29 | 47 |
|
30 | 48 |
|
31 | 49 | <MudAnimate @ref="_messageSuccessfullySentAnimation"
|
|
56 | 74 | AdornmentColor="@(string.IsNullOrEmpty(_userText) ? Color.Default : Color.Primary)"
|
57 | 75 | OnAdornmentClick="SendMessage"/>
|
58 | 76 | </MudList>
|
59 |
| - } |
60 |
| - </MudItem> |
| 77 | + </MudItem> |
| 78 | + } |
61 | 79 | </MudGrid>
|
62 | 80 | </MudLoading>
|
63 | 81 |
|
|
73 | 91 |
|
74 | 92 | private bool _isActiveChatPublished = true;
|
75 | 93 | private bool _isLoading = true;
|
| 94 | + private bool _isMobile = true; |
76 | 95 |
|
77 | 96 | private MudAnimate _messageSuccessfullySentAnimation = null!;
|
78 | 97 | private Dictionary<Guid, Guid> _lastSuccessfullySentMessageForChat = new();
|
| 98 | + |
79 | 99 | private bool LastMessageWasSentSuccessfullyByCurrentUser
|
80 | 100 | {
|
81 | 101 | get
|
|
107 | 127 | return;
|
108 | 128 | }
|
109 | 129 |
|
| 130 | + var currentBreakpoint = await BrowserViewportService.GetCurrentBreakpointAsync(); |
| 131 | + _isMobile = currentBreakpoint <= Breakpoint.SmAndDown; |
| 132 | + |
110 | 133 | _chats = await ChatService.GetChats(_currentUser.Id);
|
111 | 134 | if (ChatId is not null)
|
112 | 135 | {
|
|
0 commit comments