Skip to content

Commit

Permalink
cc
Browse files Browse the repository at this point in the history
  • Loading branch information
BeepBeepBopBop committed Jan 11, 2025
1 parent a25c17d commit 83274d5
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 15 deletions.
56 changes: 56 additions & 0 deletions LM-Kit-Maestro/UI/Razor/Components/Chat.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial class Chat
private double _scrollTop;

private bool _isScrolledToEnd = false;
private bool _isShowingActionPopup;

public bool IsScrolledToEnd
{
Expand Down Expand Up @@ -240,6 +241,7 @@ private void OnConversationItemSelected(ConversationViewModel conversationViewMo
}
}


private void OnConversationItemShowMoreClicked(ConversationViewModel conversationViewModel)
{
if (conversationViewModel != ViewModel.ConversationListViewModel.CurrentConversation)
Expand All @@ -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;
Expand Down
11 changes: 3 additions & 8 deletions LM-Kit-Maestro/UI/Razor/Components/ConversationListItem.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@inherits ComponentBase

<div @onclick="() => OnClicked()" id="item-container" class="@(IsSelected ? "item-selected" : "")">
<div @onclick="() => OnSelect.InvokeAsync()" id="item-container" class="@(IsSelected ? "item-selected" : "")">
<MudText Typo="Typo.subtitle1" Inline=true>
@ViewModel.Title
</MudText>

<div id="show-more-button">
<div id="show-more-button" @onclick="() => OnShowMore.InvokeAsync()" class="@(IsSelected ? "show" :"hide")">
<MudIconButton Icon="@Icons.Material.Filled.MoreHoriz" Size="Size.Small" Color="Color.Dark" />
</div>
</div>
Expand All @@ -16,9 +16,4 @@
[Parameter] public EventCallback<ConversationViewModel> OnShowMore { get; set; }
[Parameter] public required ConversationViewModel ViewModel { get; set; }
[Parameter] public bool IsSelected { get; set; }

private void OnClicked()
{
OnSelect.InvokeAsync(ViewModel);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@

#item-container:hover {
background-color: var(--Surface2);
visibility: hidden;
}

#item-container:has(:hover) #show-more-button {
#item-container:hover #show-more-button {
visibility: visible;
}

#show-more-button:hover {
visibility: visible;
}

#show-more-button {
visibility: hidden;
}
/*
.mud-icon-size-small {
font-size: 10px !important;
Expand Down
2 changes: 1 addition & 1 deletion LM-Kit-Maestro/UI/Razor/Components/Translation.razor
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="vertical-separator"></div>

<div id="translation-output">
<div class="loading-content @(!TranslationViewModel.AwaitingResponse ? "hidden" : "")">
<div class="loading-content @(!TranslationViewModel.AwaitingResponse ? "hide" : "show")">
</div>

<InputBox @bind-InputText="TranslationViewModel.LatestResult" Readonly="true" />
Expand Down
6 changes: 5 additions & 1 deletion LM-Kit-Maestro/wwwroot/css/lmkitmaestro.css
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ body.windows .primary-button {
display: inline-block;
}

.hidden {
.hide {
visibility: hidden;
}

.show{

}

0 comments on commit 83274d5

Please sign in to comment.