Skip to content

Commit 50ab87f

Browse files
committed
Adjust click widget action
1 parent e31c85a commit 50ab87f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Core/Sources/SuggestionWidget/WidgetView.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ struct WidgetView: View {
2525
Circle().fill(isHovering ? .white.opacity(0.8) : .white.opacity(0.3))
2626
.onTapGesture {
2727
withAnimation(.easeInOut(duration: 0.2)) {
28-
let isDisplayed = panelViewModel.isPanelDisplayed
29-
|| chatWindowViewModel.isPanelDisplayed
28+
let isDisplayed = {
29+
if panelViewModel.isPanelDisplayed && panelViewModel.content != nil { return true }
30+
if chatWindowViewModel.isPanelDisplayed && chatWindowViewModel.chat != nil { return true }
31+
return false
32+
}()
3033
panelViewModel.isPanelDisplayed = !isDisplayed
3134
chatWindowViewModel.isPanelDisplayed = !isDisplayed
3235
}
@@ -75,6 +78,7 @@ struct WidgetView: View {
7578
}
7679
.onChange(of: viewModel.isProcessing) { _ in refreshRing() }
7780
.onChange(of: panelViewModel.content?.contentHash) { _ in refreshRing() }
81+
.onChange(of: chatWindowViewModel.chat?.id) { _ in refreshRing() }
7882
.onHover { yes in
7983
withAnimation(.easeInOut(duration: 0.2)) {
8084
isHovering = yes

0 commit comments

Comments
 (0)