mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Show sign in button directly in titlebar when not signed in
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
parent
a6ebc9bd26
commit
75901f1c33
1 changed files with 18 additions and 2 deletions
|
@ -119,12 +119,12 @@ impl View for CollabTitlebarItem {
|
||||||
let status = &*status.borrow();
|
let status = &*status.borrow();
|
||||||
if matches!(status, client::Status::Connected { .. }) {
|
if matches!(status, client::Status::Connected { .. }) {
|
||||||
right_container.add_child(self.render_toggle_contacts_button(&theme, cx));
|
right_container.add_child(self.render_toggle_contacts_button(&theme, cx));
|
||||||
|
right_container.add_child(self.render_user_menu_button(&theme, cx));
|
||||||
} else {
|
} else {
|
||||||
right_container.add_children(self.render_connection_status(status, cx));
|
right_container.add_children(self.render_connection_status(status, cx));
|
||||||
|
right_container.add_child(self.render_sign_in_button(&theme, cx));
|
||||||
}
|
}
|
||||||
|
|
||||||
right_container.add_child(self.render_user_menu_button(&theme, cx));
|
|
||||||
|
|
||||||
Stack::new()
|
Stack::new()
|
||||||
.with_child(left_container.boxed())
|
.with_child(left_container.boxed())
|
||||||
.with_child(right_container.aligned().right().boxed())
|
.with_child(right_container.aligned().right().boxed())
|
||||||
|
@ -554,6 +554,22 @@ impl CollabTitlebarItem {
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_sign_in_button(&self, theme: &Theme, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
|
let titlebar = &theme.workspace.titlebar;
|
||||||
|
MouseEventHandler::<Authenticate>::new(0, cx, |state, _| {
|
||||||
|
let style = titlebar.sign_in_prompt.style_for(state, false);
|
||||||
|
Label::new("Sign In", style.text.clone())
|
||||||
|
.contained()
|
||||||
|
.with_style(style.container)
|
||||||
|
.boxed()
|
||||||
|
})
|
||||||
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
|
.on_click(MouseButton::Left, move |_, cx| {
|
||||||
|
cx.dispatch_action(Authenticate);
|
||||||
|
})
|
||||||
|
.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
fn render_contacts_popover_host<'a>(
|
fn render_contacts_popover_host<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
theme: &'a theme::Titlebar,
|
theme: &'a theme::Titlebar,
|
||||||
|
|
Loading…
Reference in a new issue