Rename PeoplePanel to ContactsPanel
Yeah, it's true they're people, but this is a more specific way in which they're people. Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
c8ad5b68e0
commit
d78d5712be
9 changed files with 48 additions and 46 deletions
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -1109,6 +1109,17 @@ version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "contacts_panel"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"client",
|
||||||
|
"gpui",
|
||||||
|
"postage",
|
||||||
|
"theme",
|
||||||
|
"workspace",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cookie"
|
name = "cookie"
|
||||||
version = "0.14.4"
|
version = "0.14.4"
|
||||||
|
@ -3197,17 +3208,6 @@ dependencies = [
|
||||||
"regex",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "people_panel"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"client",
|
|
||||||
"gpui",
|
|
||||||
"postage",
|
|
||||||
"theme",
|
|
||||||
"workspace",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
|
@ -5673,6 +5673,7 @@ dependencies = [
|
||||||
"chat_panel",
|
"chat_panel",
|
||||||
"client",
|
"client",
|
||||||
"clock",
|
"clock",
|
||||||
|
"contacts_panel",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"ctor",
|
"ctor",
|
||||||
"dirs",
|
"dirs",
|
||||||
|
@ -5697,7 +5698,6 @@ dependencies = [
|
||||||
"lsp",
|
"lsp",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"people_panel",
|
|
||||||
"postage",
|
"postage",
|
||||||
"project",
|
"project",
|
||||||
"project_panel",
|
"project_panel",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "people_panel"
|
name = "contacts_panel"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
|
@ -17,20 +17,20 @@ action!(ShareWorktree, u64);
|
||||||
action!(UnshareWorktree, u64);
|
action!(UnshareWorktree, u64);
|
||||||
|
|
||||||
pub fn init(cx: &mut MutableAppContext) {
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_action(PeoplePanel::share_worktree);
|
cx.add_action(ContactsPanel::share_worktree);
|
||||||
cx.add_action(PeoplePanel::unshare_worktree);
|
cx.add_action(ContactsPanel::unshare_worktree);
|
||||||
cx.add_action(PeoplePanel::join_worktree);
|
cx.add_action(ContactsPanel::join_worktree);
|
||||||
cx.add_action(PeoplePanel::leave_worktree);
|
cx.add_action(ContactsPanel::leave_worktree);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PeoplePanel {
|
pub struct ContactsPanel {
|
||||||
contacts: ListState,
|
contacts: ListState,
|
||||||
user_store: ModelHandle<UserStore>,
|
user_store: ModelHandle<UserStore>,
|
||||||
settings: watch::Receiver<Settings>,
|
settings: watch::Receiver<Settings>,
|
||||||
_maintain_contacts: Subscription,
|
_maintain_contacts: Subscription,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PeoplePanel {
|
impl ContactsPanel {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
user_store: ModelHandle<UserStore>,
|
user_store: ModelHandle<UserStore>,
|
||||||
settings: watch::Receiver<Settings>,
|
settings: watch::Receiver<Settings>,
|
||||||
|
@ -115,7 +115,7 @@ impl PeoplePanel {
|
||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
cx: &mut LayoutContext,
|
cx: &mut LayoutContext,
|
||||||
) -> ElementBox {
|
) -> ElementBox {
|
||||||
let theme = &theme.people_panel;
|
let theme = &theme.contacts_panel;
|
||||||
let worktree_count = collaborator.worktrees.len();
|
let worktree_count = collaborator.worktrees.len();
|
||||||
let font_cache = cx.font_cache();
|
let font_cache = cx.font_cache();
|
||||||
let line_height = theme.unshared_worktree.name.text.line_height(font_cache);
|
let line_height = theme.unshared_worktree.name.text.line_height(font_cache);
|
||||||
|
@ -216,7 +216,7 @@ impl PeoplePanel {
|
||||||
.any(|guest| Some(guest.id) == current_user_id);
|
.any(|guest| Some(guest.id) == current_user_id);
|
||||||
let is_shared = worktree.is_shared;
|
let is_shared = worktree.is_shared;
|
||||||
|
|
||||||
MouseEventHandler::new::<PeoplePanel, _, _, _>(
|
MouseEventHandler::new::<ContactsPanel, _, _, _>(
|
||||||
worktree_id as usize,
|
worktree_id as usize,
|
||||||
cx,
|
cx,
|
||||||
|mouse_state, _| {
|
|mouse_state, _| {
|
||||||
|
@ -294,17 +294,17 @@ impl PeoplePanel {
|
||||||
|
|
||||||
pub enum Event {}
|
pub enum Event {}
|
||||||
|
|
||||||
impl Entity for PeoplePanel {
|
impl Entity for ContactsPanel {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl View for PeoplePanel {
|
impl View for ContactsPanel {
|
||||||
fn ui_name() -> &'static str {
|
fn ui_name() -> &'static str {
|
||||||
"PeoplePanel"
|
"ContactsPanel"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
|
fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
|
||||||
let theme = &self.settings.borrow().theme.people_panel;
|
let theme = &self.settings.borrow().theme.contacts_panel;
|
||||||
Container::new(List::new(self.contacts.clone()).boxed())
|
Container::new(List::new(self.contacts.clone()).boxed())
|
||||||
.with_style(theme.container)
|
.with_style(theme.container)
|
||||||
.boxed()
|
.boxed()
|
|
@ -940,6 +940,7 @@ mod tests {
|
||||||
self, test::FakeHttpClient, Channel, ChannelDetails, ChannelList, Client, Credentials,
|
self, test::FakeHttpClient, Channel, ChannelDetails, ChannelList, Client, Credentials,
|
||||||
EstablishConnectionError, UserStore,
|
EstablishConnectionError, UserStore,
|
||||||
},
|
},
|
||||||
|
contacts_panel::JoinWorktree,
|
||||||
editor::{Editor, EditorSettings, Input},
|
editor::{Editor, EditorSettings, Input},
|
||||||
fs::{FakeFs, Fs as _},
|
fs::{FakeFs, Fs as _},
|
||||||
language::{
|
language::{
|
||||||
|
@ -947,7 +948,6 @@ mod tests {
|
||||||
LanguageServerConfig, Point,
|
LanguageServerConfig, Point,
|
||||||
},
|
},
|
||||||
lsp,
|
lsp,
|
||||||
people_panel::JoinWorktree,
|
|
||||||
project::{ProjectPath, Worktree},
|
project::{ProjectPath, Worktree},
|
||||||
test::test_app_state,
|
test::test_app_state,
|
||||||
workspace::Workspace,
|
workspace::Workspace,
|
||||||
|
@ -1060,7 +1060,7 @@ mod tests {
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_unshare_worktree(mut cx_a: TestAppContext, mut cx_b: TestAppContext) {
|
async fn test_unshare_worktree(mut cx_a: TestAppContext, mut cx_b: TestAppContext) {
|
||||||
cx_b.update(zed::people_panel::init);
|
cx_b.update(zed::contacts_panel::init);
|
||||||
let mut app_state_a = cx_a.update(test_app_state);
|
let mut app_state_a = cx_a.update(test_app_state);
|
||||||
let mut app_state_b = cx_b.update(test_app_state);
|
let mut app_state_b = cx_b.update(test_app_state);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub struct Theme {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub workspace: Workspace,
|
pub workspace: Workspace,
|
||||||
pub chat_panel: ChatPanel,
|
pub chat_panel: ChatPanel,
|
||||||
pub people_panel: PeoplePanel,
|
pub contacts_panel: ContactsPanel,
|
||||||
pub project_panel: ProjectPanel,
|
pub project_panel: ProjectPanel,
|
||||||
pub selector: Selector,
|
pub selector: Selector,
|
||||||
pub editor: EditorStyle,
|
pub editor: EditorStyle,
|
||||||
|
@ -137,7 +137,7 @@ pub struct ProjectPanelEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Default)]
|
#[derive(Deserialize, Default)]
|
||||||
pub struct PeoplePanel {
|
pub struct ContactsPanel {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub container: ContainerStyle,
|
pub container: ContainerStyle,
|
||||||
pub host_row_height: f32,
|
pub host_row_height: f32,
|
||||||
|
|
|
@ -40,7 +40,7 @@ go_to_line = { path = "../go_to_line" }
|
||||||
gpui = { path = "../gpui" }
|
gpui = { path = "../gpui" }
|
||||||
language = { path = "../language" }
|
language = { path = "../language" }
|
||||||
lsp = { path = "../lsp" }
|
lsp = { path = "../lsp" }
|
||||||
people_panel = { path = "../people_panel" }
|
contacts_panel = { path = "../contacts_panel" }
|
||||||
project = { path = "../project" }
|
project = { path = "../project" }
|
||||||
project_panel = { path = "../project_panel" }
|
project_panel = { path = "../project_panel" }
|
||||||
rpc = { path = "../rpc" }
|
rpc = { path = "../rpc" }
|
||||||
|
|
|
@ -146,7 +146,7 @@ underline = true
|
||||||
extends = "$chat_panel.sign_in_prompt"
|
extends = "$chat_panel.sign_in_prompt"
|
||||||
color = "$text.1.color"
|
color = "$text.1.color"
|
||||||
|
|
||||||
[people_panel]
|
[contacts_panel]
|
||||||
extends = "$panel"
|
extends = "$panel"
|
||||||
host_row_height = 28
|
host_row_height = 28
|
||||||
host_avatar = { corner_radius = 10, width = 20 }
|
host_avatar = { corner_radius = 10, width = 20 }
|
||||||
|
@ -154,30 +154,30 @@ host_username = { extends = "$text.0", padding.left = 8 }
|
||||||
tree_branch_width = 1
|
tree_branch_width = 1
|
||||||
tree_branch_color = "$surface.2"
|
tree_branch_color = "$surface.2"
|
||||||
|
|
||||||
[people_panel.worktree]
|
[contacts_panel.worktree]
|
||||||
height = 24
|
height = 24
|
||||||
padding = { left = 8 }
|
padding = { left = 8 }
|
||||||
guest_avatar = { corner_radius = 8, width = 16 }
|
guest_avatar = { corner_radius = 8, width = 16 }
|
||||||
guest_avatar_spacing = 4
|
guest_avatar_spacing = 4
|
||||||
|
|
||||||
[people_panel.worktree.name]
|
[contacts_panel.worktree.name]
|
||||||
extends = "$text.1"
|
extends = "$text.1"
|
||||||
margin = { right = 6 }
|
margin = { right = 6 }
|
||||||
|
|
||||||
[people_panel.unshared_worktree]
|
[contacts_panel.unshared_worktree]
|
||||||
extends = "$people_panel.worktree"
|
extends = "$contacts_panel.worktree"
|
||||||
|
|
||||||
[people_panel.hovered_unshared_worktree]
|
[contacts_panel.hovered_unshared_worktree]
|
||||||
extends = "$people_panel.unshared_worktree"
|
extends = "$contacts_panel.unshared_worktree"
|
||||||
background = "$state.hover"
|
background = "$state.hover"
|
||||||
corner_radius = 6
|
corner_radius = 6
|
||||||
|
|
||||||
[people_panel.shared_worktree]
|
[contacts_panel.shared_worktree]
|
||||||
extends = "$people_panel.worktree"
|
extends = "$contacts_panel.worktree"
|
||||||
name.color = "$text.0.color"
|
name.color = "$text.0.color"
|
||||||
|
|
||||||
[people_panel.hovered_shared_worktree]
|
[contacts_panel.hovered_shared_worktree]
|
||||||
extends = "$people_panel.shared_worktree"
|
extends = "$contacts_panel.shared_worktree"
|
||||||
background = "$state.hover"
|
background = "$state.hover"
|
||||||
corner_radius = 6
|
corner_radius = 6
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ pub mod test;
|
||||||
use self::language::LanguageRegistry;
|
use self::language::LanguageRegistry;
|
||||||
use chat_panel::ChatPanel;
|
use chat_panel::ChatPanel;
|
||||||
pub use client;
|
pub use client;
|
||||||
|
pub use contacts_panel;
|
||||||
|
use contacts_panel::ContactsPanel;
|
||||||
pub use editor;
|
pub use editor;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
action,
|
action,
|
||||||
|
@ -17,8 +19,6 @@ use gpui::{
|
||||||
};
|
};
|
||||||
pub use lsp;
|
pub use lsp;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
pub use people_panel;
|
|
||||||
use people_panel::PeoplePanel;
|
|
||||||
use postage::watch;
|
use postage::watch;
|
||||||
pub use project::{self, fs};
|
pub use project::{self, fs};
|
||||||
use project_panel::ProjectPanel;
|
use project_panel::ProjectPanel;
|
||||||
|
@ -144,8 +144,10 @@ fn build_workspace(params: &WorkspaceParams, cx: &mut ViewContext<Workspace>) ->
|
||||||
);
|
);
|
||||||
workspace.right_sidebar_mut().add_item(
|
workspace.right_sidebar_mut().add_item(
|
||||||
"icons/user-16.svg",
|
"icons/user-16.svg",
|
||||||
cx.add_view(|cx| PeoplePanel::new(params.user_store.clone(), params.settings.clone(), cx))
|
cx.add_view(|cx| {
|
||||||
.into(),
|
ContactsPanel::new(params.user_store.clone(), params.settings.clone(), cx)
|
||||||
|
})
|
||||||
|
.into(),
|
||||||
);
|
);
|
||||||
workspace.right_sidebar_mut().add_item(
|
workspace.right_sidebar_mut().add_item(
|
||||||
"icons/comment-16.svg",
|
"icons/comment-16.svg",
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn main() {
|
||||||
editor::init(cx, &mut entry_openers);
|
editor::init(cx, &mut entry_openers);
|
||||||
go_to_line::init(cx);
|
go_to_line::init(cx);
|
||||||
file_finder::init(cx);
|
file_finder::init(cx);
|
||||||
people_panel::init(cx);
|
contacts_panel::init(cx);
|
||||||
chat_panel::init(cx);
|
chat_panel::init(cx);
|
||||||
project_panel::init(cx);
|
project_panel::init(cx);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue