Titlebar project menu double click (#3784)

This addresses a bug where popover menus in the titlebar were rendered
only after a 2nd click. The first click was creating the View which the
second one then rendered.
In addition to this, `PopoverMenu::menu` function argument can now
return an `Option<View<T>>` instead of `View<T>` as the creation of the
menu can fail (as it might in case of git popover).

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz
2023-12-22 17:18:12 +01:00
committed by GitHub
parent 172e434bec
commit dc1ed3c39d
6 changed files with 67 additions and 126 deletions
+4 -2
View File
@@ -102,8 +102,10 @@ impl Render for CopilotButton {
div().child(
popover_menu("copilot")
.menu(move |cx| match status {
Status::Authorized => this.update(cx, |this, cx| this.build_copilot_menu(cx)),
_ => this.update(cx, |this, cx| this.build_copilot_start_menu(cx)),
Status::Authorized => {
Some(this.update(cx, |this, cx| this.build_copilot_menu(cx)))
}
_ => Some(this.update(cx, |this, cx| this.build_copilot_start_menu(cx))),
})
.anchor(AnchorCorner::BottomRight)
.trigger(