WIP dismiss agent panel onboarding panel when typing
This commit is contained in:
parent
b349a8f34c
commit
d8276cd661
2 changed files with 15 additions and 0 deletions
|
@ -300,6 +300,7 @@ impl ActiveView {
|
|||
MessageEditorEvent::Changed | MessageEditorEvent::EstimatedTokenCount => {
|
||||
cx.notify();
|
||||
}
|
||||
MessageEditorEvent::DismissOnboarding => {}
|
||||
MessageEditorEvent::ScrollThreadToBottom => match &this.active_view {
|
||||
ActiveView::Thread { thread, .. } => {
|
||||
thread.update(cx, |thread, cx| {
|
||||
|
@ -670,6 +671,17 @@ impl AgentPanel {
|
|||
)
|
||||
});
|
||||
|
||||
cx.subscribe(&message_editor, |_, _, event, cx| match event {
|
||||
// todo!: I don't like how this is writing to the db everything time the user types
|
||||
//this also doens't work for text threads and newly openned threads??
|
||||
MessageEditorEvent::DismissOnboarding => {
|
||||
OnboardingUpsell::set_dismissed(true, cx);
|
||||
cx.notify();
|
||||
}
|
||||
_ => {}
|
||||
})
|
||||
.detach();
|
||||
|
||||
let acp_history_store = cx.new(|cx| agent2::HistoryStore::new(context_store.clone(), cx));
|
||||
let acp_history = cx.new(|cx| AcpThreadHistory::new(acp_history_store.clone(), window, cx));
|
||||
cx.subscribe_in(
|
||||
|
|
|
@ -217,6 +217,7 @@ impl MessageEditor {
|
|||
cx.subscribe_in(&context_strip, window, Self::handle_context_strip_event),
|
||||
cx.subscribe(&editor, |this, _, event: &EditorEvent, cx| {
|
||||
if event == &EditorEvent::BufferEdited {
|
||||
cx.emit(MessageEditorEvent::DismissOnboarding);
|
||||
this.handle_message_changed(cx)
|
||||
}
|
||||
}),
|
||||
|
@ -1416,6 +1417,7 @@ impl MessageEditor {
|
|||
}
|
||||
|
||||
fn message_or_context_changed(&mut self, debounce: bool, cx: &mut Context<Self>) {
|
||||
// todo! Might want to use this instead of dismiss onboarding event
|
||||
cx.emit(MessageEditorEvent::Changed);
|
||||
self.update_token_count_task.take();
|
||||
|
||||
|
@ -1639,6 +1641,7 @@ pub enum MessageEditorEvent {
|
|||
EstimatedTokenCount,
|
||||
Changed,
|
||||
ScrollThreadToBottom,
|
||||
DismissOnboarding,
|
||||
}
|
||||
|
||||
impl Focusable for MessageEditor {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue