diff --git a/LM-Kit-Maestro/UI/Razor/Components/Chat.razor.cs b/LM-Kit-Maestro/UI/Razor/Components/Chat.razor.cs index 2aaaf47..2d0d0c0 100644 --- a/LM-Kit-Maestro/UI/Razor/Components/Chat.razor.cs +++ b/LM-Kit-Maestro/UI/Razor/Components/Chat.razor.cs @@ -22,6 +22,7 @@ public partial class Chat private double _scrollTop; private bool _isScrolledToEnd = false; + private bool _isShowingActionPopup; public bool IsScrolledToEnd { @@ -240,6 +241,7 @@ private void OnConversationItemSelected(ConversationViewModel conversationViewMo } } + private void OnConversationItemShowMoreClicked(ConversationViewModel conversationViewModel) { if (conversationViewModel != ViewModel.ConversationListViewModel.CurrentConversation) @@ -248,6 +250,60 @@ private void OnConversationItemShowMoreClicked(ConversationViewModel conversatio } } + private async Task OnShowMoreClicked(ConversationViewModel conversationViewModel) + { + if (_isShowingActionPopup) + { + return; + } + + _isShowingActionPopup = true; + + ChatConversationActionPopupViewModel chatConversationActionPopupViewModel = new ChatConversationActionPopupViewModel() + { + ConversationX = 400, + //ConversationY = conversationItem.Y - collectionView.ScrollY + conversationItem.Height + UIConstants.TabBarHeight + UIConstants.PageTopBarHeight, + //ConversationItemHeight = conversationItem.Height, + //ConversationListHeight = Height + }; + + var popup = new ChatConversationActionPopup(ViewModel.PopupNavigation, chatConversationActionPopupViewModel) + { + Animation = new Mopups.Animations.FadeAnimation() + { + DurationIn = 1, + DurationOut = 1, + EasingIn = Easing.Linear, + EasingOut = Easing.Linear + } + }; + + conversationViewModel!.IsShowingActionPopup = true; + await ViewModel.PopupNavigation.PushAsync(popup); + + var result = await popup.PopupTask; + + if (result != null && result.Value is ChatConversationAction chatConversationAction) + { + switch (chatConversationAction) + { + case ChatConversationAction.Select: + ViewModel.ConversationListViewModel.CurrentConversation = conversationViewModel!; + break; + + case ChatConversationAction.Rename: + conversationViewModel!.IsRenaming = true; + break; + + case ChatConversationAction.Delete: + await ViewModel.ConversationListViewModel.DeleteConversation(conversationViewModel!); + break; + } + } + + conversationViewModel!.IsShowingActionPopup = false; + } + private int CalculateUsagePercentage(int used, int total) { if (total == 0) return 0; diff --git a/LM-Kit-Maestro/UI/Razor/Components/ConversationListItem.razor b/LM-Kit-Maestro/UI/Razor/Components/ConversationListItem.razor index 847cb09..12c5d9c 100644 --- a/LM-Kit-Maestro/UI/Razor/Components/ConversationListItem.razor +++ b/LM-Kit-Maestro/UI/Razor/Components/ConversationListItem.razor @@ -1,11 +1,11 @@ @inherits ComponentBase -