Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 67 additions & 25 deletions apps/maple-agent/app/src/ui/chat/composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ impl ChatScreen {

/// `button` as the opener of `popup`, with `menu` attached below or
/// above it while the popup is open.
fn with_menu(
fn with_menu<E: gpui::StatefulInteractiveElement + IntoElement>(
&self,
popup: ChatPopup,
button: gpui::Stateful<Div>,
button: E,
placement: Placement,
window: &mut Window,
cx: &mut Context<Self>,
Expand Down Expand Up @@ -427,11 +427,15 @@ impl ChatScreen {
.items_center()
.justify_center()
.rounded(theme::RADIUS_SM)
.hover(|style| {
style
.bg(gpui::rgb(theme::accent_container()))
.cursor_pointer()
.map(|element| {
let rest: gpui::Hsla = gpui::transparent_black();
crate::ui::motion::hover_background(
element,
rest,
gpui::rgb(theme::bg_sidebar_pill()),
)
})
.hover(|style| style.cursor_pointer())
.active(|style| style.bg(gpui::rgb(theme::bg_sidebar_pill())))
.when(self.attachment_picking, |el| el.opacity(0.5))
.tooltip(widgets::tooltip("Attach files or images", None))
Expand All @@ -452,11 +456,23 @@ impl ChatScreen {
.justify_center()
.rounded(theme::RADIUS_SM)
.when(recording, |el| el.bg(gpui::rgb(theme::status_error())))
.hover(|style| {
style
.bg(gpui::rgb(theme::accent_container()))
.cursor_pointer()
.map(|element| {
let rest: gpui::Hsla = if recording {
gpui::rgb(theme::status_error()).into()
} else {
gpui::transparent_black()
};
crate::ui::motion::hover_background(
element,
rest,
gpui::rgb(if recording {
theme::status_error()
} else {
theme::bg_sidebar_pill()
}),
)
})
.hover(|style| style.cursor_pointer())
.when(transcribing, |el| el.opacity(0.5))
.tooltip(widgets::tooltip(
if recording {
Expand Down Expand Up @@ -689,11 +705,19 @@ impl ChatScreen {
.when(is_selected, |row| {
row.bg(gpui::rgb(theme::bg_sidebar_row_selected()))
})
.hover(|style| {
style
.bg(gpui::rgb(theme::bg_sidebar_row_hover()))
.cursor_pointer()
.map(|element| {
let rest: gpui::Hsla = if is_selected {
gpui::rgb(theme::bg_sidebar_row_selected()).into()
} else {
gpui::transparent_black()
};
crate::ui::motion::hover_background(
element,
rest,
gpui::rgb(theme::bg_sidebar_row_hover()),
)
})
.hover(|style| style.cursor_pointer())
.on_click(move |_event, _window, cx: &mut gpui::App| {
chat.update(cx, |chat, cx| chat.complete_slash_command(&name, cx))
.ok();
Expand Down Expand Up @@ -854,7 +878,14 @@ impl ChatScreen {
.cursor_pointer()
.text_sm()
.text_color(gpui::rgb(theme::text_muted()))
.hover(|style| style.bg(gpui::rgb(theme::bg_elevated())))
.map(|element| {
let rest: gpui::Hsla = gpui::transparent_black();
crate::ui::motion::hover_background(
element,
rest,
gpui::rgb(theme::bg_elevated()),
)
})
.on_click(cx.listener(|this, _event, _window, cx| {
this.close_side_thread(cx);
}))
Expand Down Expand Up @@ -994,7 +1025,10 @@ impl ChatScreen {
.px_3()
.py_2()
.cursor_pointer()
.hover(|style| style.bg(gpui::rgb(theme::bg_elevated())))
.map(|element| {
let rest: gpui::Hsla = gpui::transparent_black();
crate::ui::motion::hover_background(element, rest, gpui::rgb(theme::bg_elevated()))
})
.on_click(cx.listener(|this, _event, _window, cx| {
this.toggle_plan_collapsed(cx);
}))
Expand Down Expand Up @@ -1283,11 +1317,15 @@ impl ChatScreen {
.items_center()
.justify_center()
.rounded(theme::RADIUS_SM)
.hover(|style| {
style
.bg(gpui::rgb(theme::accent_container()))
.cursor_pointer()
.map(|element| {
let rest: gpui::Hsla = gpui::transparent_black();
crate::ui::motion::hover_background(
element,
rest,
gpui::rgb(theme::bg_sidebar_pill()),
)
})
.hover(|style| style.cursor_pointer())
.tooltip(widgets::tooltip(
if expanded {
"Shrink composer"
Expand Down Expand Up @@ -1468,7 +1506,7 @@ fn chip(
chevron: bool,
active: bool,
highlight: bool,
) -> gpui::Stateful<Div> {
) -> crate::ui::motion::HoverBackground {
let color = if highlight {
theme::accent()
} else if active {
Expand All @@ -1492,11 +1530,15 @@ fn chip(
.font_weight(gpui::FontWeight::MEDIUM)
.text_color(gpui::rgb(color))
.when(active, |el| el.bg(gpui::rgb(theme::bg_sidebar_pill())))
.hover(|style| {
style
.bg(gpui::rgb(theme::bg_sidebar_pill()))
.cursor_pointer()
.map(|element| {
let rest: gpui::Hsla = if active {
gpui::rgb(theme::bg_sidebar_pill()).into()
} else {
gpui::transparent_black()
};
crate::ui::motion::hover_background(element, rest, gpui::rgb(theme::bg_sidebar_pill()))
})
.hover(|style| style.cursor_pointer())
.active(|style| style.bg(gpui::rgb(theme::bg_sidebar_row_selected())))
.children(leading.map(|name| icon(name, px(16.), color)))
.child(div().whitespace_nowrap().child(label))
Expand Down
32 changes: 25 additions & 7 deletions apps/maple-agent/app/src/ui/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3822,9 +3822,15 @@ impl ChatScreen {
.py_0p5()
.rounded(theme::RADIUS_SM)
.text_color(gpui::rgb(theme::accent()))
.hover(|style| {
style.bg(theme::overlay_hover()).cursor_pointer()
.map(|element| {
let rest: gpui::Hsla = gpui::transparent_black();
crate::ui::motion::hover_background(
element,
rest,
theme::overlay_hover(),
)
})
.hover(|style| style.cursor_pointer())
.on_click(cx.listener(move |_, _, _, cx| {
cx.emit(crate::update::UpdateRequested(action));
}))
Expand All @@ -3839,7 +3845,15 @@ impl ChatScreen {
.px_2()
.py_0p5()
.rounded(theme::RADIUS_SM)
.hover(|style| style.bg(theme::overlay_hover()).cursor_pointer())
.map(|element| {
let rest: gpui::Hsla = gpui::transparent_black();
crate::ui::motion::hover_background(
element,
rest,
theme::overlay_hover(),
)
})
.hover(|style| style.cursor_pointer())
.on_click(cx.listener(|_, _, _, cx| {
cx.emit(crate::update::UpdateRequested(
crate::update::UpdateAction::Later,
Expand Down Expand Up @@ -7061,11 +7075,15 @@ impl ChatScreen {
.pl(mark_padding)
.rounded(theme::RADIUS_SM)
.focus_visible(widgets::focus_ring)
.hover(|style| {
style
.bg(gpui::rgb(theme::bg_sidebar_row_hover()))
.cursor_pointer()
.map(|element| {
let rest: gpui::Hsla = gpui::transparent_black();
crate::ui::motion::hover_background(
element,
rest,
gpui::rgb(theme::bg_sidebar_row_hover()),
)
})
.hover(|style| style.cursor_pointer())
.active(|style| style.bg(gpui::rgb(theme::bg_sidebar_row_selected())))
// Inside a drag region: a press here is a click, not a drag.
.on_mouse_down(gpui::MouseButton::Left, |_event, _window, cx| {
Expand Down
10 changes: 9 additions & 1 deletion apps/maple-agent/app/src/ui/chat/project_folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,15 @@ impl ProjectFolderDialog {
.when(self.highlighted == Some(index), |row| {
row.bg(gpui::rgb(theme::bg_sidebar_row_selected()))
})
.hover(|row| row.bg(theme::overlay_hover()).cursor_pointer())
.map(|element| {
let rest: gpui::Hsla = if self.highlighted == Some(index) {
gpui::rgb(theme::bg_sidebar_row_selected()).into()
} else {
gpui::transparent_black()
};
crate::ui::motion::hover_background(element, rest, theme::overlay_hover())
})
.hover(|row| row.cursor_pointer())
.on_click(cx.listener(move |this, _, window, cx| {
window.focus(&this.focus(Control::List, cx), cx);
this.enter_folder(index, cx);
Expand Down
14 changes: 8 additions & 6 deletions apps/maple-agent/app/src/ui/chat/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,15 @@ impl ChatScreen {
.justify_center()
.rounded(theme::RADIUS_SM)
.when(busy, |button| button.opacity(0.5))
.when(!busy, |button| {
button.hover(|style| {
style
.bg(gpui::rgb(theme::bg_sidebar_row_hover()))
.cursor_pointer()
})
.map(|button| {
crate::ui::motion::hover_background(
button,
gpui::transparent_black(),
gpui::rgb(theme::bg_sidebar_row_hover()),
)
})
.when(busy, |button| button.highlighted(false))
.when(!busy, |button| button.hover(|style| style.cursor_pointer()))
.child(icon(icon_name, px(12.), theme::text_secondary()))
};
Some(
Expand Down
Loading
Loading