Stop using button for collab notifications
This commit is contained in:
parent
26a3f68080
commit
39dff0e827
1 changed files with 35 additions and 39 deletions
|
@ -3,14 +3,14 @@ use anyhow::{anyhow, Result};
|
||||||
use call::{ActiveCall, ParticipantLocation};
|
use call::{ActiveCall, ParticipantLocation};
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
point, size, AnyView, AnyWeakView, Axis, Bounds, Entity as _, IntoElement, Model, Pixels,
|
point, size, AnyView, AnyWeakView, Axis, Bounds, IntoElement, Model, MouseButton, Pixels,
|
||||||
Point, View, ViewContext,
|
Point, View, ViewContext,
|
||||||
};
|
};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use project::Project;
|
use project::Project;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use ui::{prelude::*, Button};
|
use ui::prelude::*;
|
||||||
|
|
||||||
pub const HANDLE_HITBOX_SIZE: f32 = 4.0;
|
pub const HANDLE_HITBOX_SIZE: f32 = 4.0;
|
||||||
const HORIZONTAL_MIN_SIZE: f32 = 80.;
|
const HORIZONTAL_MIN_SIZE: f32 = 80.;
|
||||||
|
@ -183,6 +183,7 @@ impl Member {
|
||||||
|
|
||||||
let mut leader_border = None;
|
let mut leader_border = None;
|
||||||
let mut leader_status_box = None;
|
let mut leader_status_box = None;
|
||||||
|
let mut leader_join_data = None;
|
||||||
if let Some(leader) = &leader {
|
if let Some(leader) = &leader {
|
||||||
let mut leader_color = cx
|
let mut leader_color = cx
|
||||||
.theme()
|
.theme()
|
||||||
|
@ -199,44 +200,21 @@ impl Member {
|
||||||
if Some(leader_project_id) == project.read(cx).remote_id() {
|
if Some(leader_project_id) == project.read(cx).remote_id() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let leader_user = leader.user.clone();
|
leader_join_data = Some((leader_project_id, leader.user.id));
|
||||||
let leader_user_id = leader.user.id;
|
Some(Label::new(format!(
|
||||||
Some(
|
|
||||||
Button::new(
|
|
||||||
("leader-status", pane.entity_id()),
|
|
||||||
format!(
|
|
||||||
"Follow {} to their active project",
|
"Follow {} to their active project",
|
||||||
leader_user.github_login,
|
leader.user.github_login,
|
||||||
),
|
)))
|
||||||
)
|
|
||||||
.on_click(cx.listener(
|
|
||||||
move |this, _, cx| {
|
|
||||||
crate::join_remote_project(
|
|
||||||
leader_project_id,
|
|
||||||
leader_user_id,
|
|
||||||
this.app_state().clone(),
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
.detach_and_log_err(cx);
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ParticipantLocation::UnsharedProject => Some(Button::new(
|
ParticipantLocation::UnsharedProject => Some(Label::new(format!(
|
||||||
("leader-status", pane.entity_id()),
|
|
||||||
format!(
|
|
||||||
"{} is viewing an unshared Zed project",
|
"{} is viewing an unshared Zed project",
|
||||||
leader.user.github_login
|
leader.user.github_login
|
||||||
),
|
))),
|
||||||
)),
|
ParticipantLocation::External => Some(Label::new(format!(
|
||||||
ParticipantLocation::External => Some(Button::new(
|
|
||||||
("leader-status", pane.entity_id()),
|
|
||||||
format!(
|
|
||||||
"{} is viewing a window outside of Zed",
|
"{} is viewing a window outside of Zed",
|
||||||
leader.user.github_login
|
leader.user.github_login
|
||||||
),
|
))),
|
||||||
)),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +242,25 @@ impl Member {
|
||||||
.bottom_3()
|
.bottom_3()
|
||||||
.right_3()
|
.right_3()
|
||||||
.z_index(1)
|
.z_index(1)
|
||||||
.child(status_box),
|
.bg(cx.theme().colors().element_background)
|
||||||
|
.child(status_box)
|
||||||
|
.when_some(
|
||||||
|
leader_join_data,
|
||||||
|
|this, (leader_project_id, leader_user_id)| {
|
||||||
|
this.cursor_pointer().on_mouse_down(
|
||||||
|
MouseButton::Left,
|
||||||
|
cx.listener(move |this, _, cx| {
|
||||||
|
crate::join_remote_project(
|
||||||
|
leader_project_id,
|
||||||
|
leader_user_id,
|
||||||
|
this.app_state().clone(),
|
||||||
|
cx,
|
||||||
|
)
|
||||||
|
.detach_and_log_err(cx);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.into_any()
|
.into_any()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue