From d78d5712be50a0dca8ee6a82888ef707f237aaf7 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 26 Nov 2021 11:13:05 -0700 Subject: [PATCH] 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 --- Cargo.lock | 24 +++++++++---------- .../Cargo.toml | 2 +- .../src/lib.rs | 24 +++++++++---------- crates/server/src/rpc.rs | 4 ++-- crates/theme/src/lib.rs | 4 ++-- crates/zed/Cargo.toml | 2 +- crates/zed/assets/themes/_base.toml | 22 ++++++++--------- crates/zed/src/lib.rs | 10 ++++---- crates/zed/src/main.rs | 2 +- 9 files changed, 48 insertions(+), 46 deletions(-) rename crates/{people_panel => contacts_panel}/Cargo.toml (91%) rename crates/{people_panel => contacts_panel}/src/lib.rs (96%) diff --git a/Cargo.lock b/Cargo.lock index 5b25f51ff2..851d49181a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1109,6 +1109,17 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "contacts_panel" +version = "0.1.0" +dependencies = [ + "client", + "gpui", + "postage", + "theme", + "workspace", +] + [[package]] name = "cookie" version = "0.14.4" @@ -3197,17 +3208,6 @@ dependencies = [ "regex", ] -[[package]] -name = "people_panel" -version = "0.1.0" -dependencies = [ - "client", - "gpui", - "postage", - "theme", - "workspace", -] - [[package]] name = "percent-encoding" version = "2.1.0" @@ -5673,6 +5673,7 @@ dependencies = [ "chat_panel", "client", "clock", + "contacts_panel", "crossbeam-channel", "ctor", "dirs", @@ -5697,7 +5698,6 @@ dependencies = [ "lsp", "num_cpus", "parking_lot", - "people_panel", "postage", "project", "project_panel", diff --git a/crates/people_panel/Cargo.toml b/crates/contacts_panel/Cargo.toml similarity index 91% rename from crates/people_panel/Cargo.toml rename to crates/contacts_panel/Cargo.toml index dd8e2114be..ffeb8e6a3d 100644 --- a/crates/people_panel/Cargo.toml +++ b/crates/contacts_panel/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "people_panel" +name = "contacts_panel" version = "0.1.0" edition = "2018" diff --git a/crates/people_panel/src/lib.rs b/crates/contacts_panel/src/lib.rs similarity index 96% rename from crates/people_panel/src/lib.rs rename to crates/contacts_panel/src/lib.rs index 00e87dc7e6..8cf8b9191b 100644 --- a/crates/people_panel/src/lib.rs +++ b/crates/contacts_panel/src/lib.rs @@ -17,20 +17,20 @@ action!(ShareWorktree, u64); action!(UnshareWorktree, u64); pub fn init(cx: &mut MutableAppContext) { - cx.add_action(PeoplePanel::share_worktree); - cx.add_action(PeoplePanel::unshare_worktree); - cx.add_action(PeoplePanel::join_worktree); - cx.add_action(PeoplePanel::leave_worktree); + cx.add_action(ContactsPanel::share_worktree); + cx.add_action(ContactsPanel::unshare_worktree); + cx.add_action(ContactsPanel::join_worktree); + cx.add_action(ContactsPanel::leave_worktree); } -pub struct PeoplePanel { +pub struct ContactsPanel { contacts: ListState, user_store: ModelHandle, settings: watch::Receiver, _maintain_contacts: Subscription, } -impl PeoplePanel { +impl ContactsPanel { pub fn new( user_store: ModelHandle, settings: watch::Receiver, @@ -115,7 +115,7 @@ impl PeoplePanel { theme: &Theme, cx: &mut LayoutContext, ) -> ElementBox { - let theme = &theme.people_panel; + let theme = &theme.contacts_panel; let worktree_count = collaborator.worktrees.len(); let font_cache = cx.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); let is_shared = worktree.is_shared; - MouseEventHandler::new::( + MouseEventHandler::new::( worktree_id as usize, cx, |mouse_state, _| { @@ -294,17 +294,17 @@ impl PeoplePanel { pub enum Event {} -impl Entity for PeoplePanel { +impl Entity for ContactsPanel { type Event = Event; } -impl View for PeoplePanel { +impl View for ContactsPanel { fn ui_name() -> &'static str { - "PeoplePanel" + "ContactsPanel" } fn render(&mut self, _: &mut RenderContext) -> 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()) .with_style(theme.container) .boxed() diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index a66e1cf386..4034789308 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -940,6 +940,7 @@ mod tests { self, test::FakeHttpClient, Channel, ChannelDetails, ChannelList, Client, Credentials, EstablishConnectionError, UserStore, }, + contacts_panel::JoinWorktree, editor::{Editor, EditorSettings, Input}, fs::{FakeFs, Fs as _}, language::{ @@ -947,7 +948,6 @@ mod tests { LanguageServerConfig, Point, }, lsp, - people_panel::JoinWorktree, project::{ProjectPath, Worktree}, test::test_app_state, workspace::Workspace, @@ -1060,7 +1060,7 @@ mod tests { #[gpui::test] 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_b = cx_b.update(test_app_state); diff --git a/crates/theme/src/lib.rs b/crates/theme/src/lib.rs index e280b224cc..1a484c6db7 100644 --- a/crates/theme/src/lib.rs +++ b/crates/theme/src/lib.rs @@ -20,7 +20,7 @@ pub struct Theme { pub name: String, pub workspace: Workspace, pub chat_panel: ChatPanel, - pub people_panel: PeoplePanel, + pub contacts_panel: ContactsPanel, pub project_panel: ProjectPanel, pub selector: Selector, pub editor: EditorStyle, @@ -137,7 +137,7 @@ pub struct ProjectPanelEntry { } #[derive(Deserialize, Default)] -pub struct PeoplePanel { +pub struct ContactsPanel { #[serde(flatten)] pub container: ContainerStyle, pub host_row_height: f32, diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 8e4441b594..df27401711 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -40,7 +40,7 @@ go_to_line = { path = "../go_to_line" } gpui = { path = "../gpui" } language = { path = "../language" } lsp = { path = "../lsp" } -people_panel = { path = "../people_panel" } +contacts_panel = { path = "../contacts_panel" } project = { path = "../project" } project_panel = { path = "../project_panel" } rpc = { path = "../rpc" } diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index 94d4415421..dca2e06028 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/crates/zed/assets/themes/_base.toml @@ -146,7 +146,7 @@ underline = true extends = "$chat_panel.sign_in_prompt" color = "$text.1.color" -[people_panel] +[contacts_panel] extends = "$panel" host_row_height = 28 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_color = "$surface.2" -[people_panel.worktree] +[contacts_panel.worktree] height = 24 padding = { left = 8 } guest_avatar = { corner_radius = 8, width = 16 } guest_avatar_spacing = 4 -[people_panel.worktree.name] +[contacts_panel.worktree.name] extends = "$text.1" margin = { right = 6 } -[people_panel.unshared_worktree] -extends = "$people_panel.worktree" +[contacts_panel.unshared_worktree] +extends = "$contacts_panel.worktree" -[people_panel.hovered_unshared_worktree] -extends = "$people_panel.unshared_worktree" +[contacts_panel.hovered_unshared_worktree] +extends = "$contacts_panel.unshared_worktree" background = "$state.hover" corner_radius = 6 -[people_panel.shared_worktree] -extends = "$people_panel.worktree" +[contacts_panel.shared_worktree] +extends = "$contacts_panel.worktree" name.color = "$text.0.color" -[people_panel.hovered_shared_worktree] -extends = "$people_panel.shared_worktree" +[contacts_panel.hovered_shared_worktree] +extends = "$contacts_panel.shared_worktree" background = "$state.hover" corner_radius = 6 diff --git a/crates/zed/src/lib.rs b/crates/zed/src/lib.rs index cace44a816..49e5c30120 100644 --- a/crates/zed/src/lib.rs +++ b/crates/zed/src/lib.rs @@ -7,6 +7,8 @@ pub mod test; use self::language::LanguageRegistry; use chat_panel::ChatPanel; pub use client; +pub use contacts_panel; +use contacts_panel::ContactsPanel; pub use editor; use gpui::{ action, @@ -17,8 +19,6 @@ use gpui::{ }; pub use lsp; use parking_lot::Mutex; -pub use people_panel; -use people_panel::PeoplePanel; use postage::watch; pub use project::{self, fs}; use project_panel::ProjectPanel; @@ -144,8 +144,10 @@ fn build_workspace(params: &WorkspaceParams, cx: &mut ViewContext) -> ); workspace.right_sidebar_mut().add_item( "icons/user-16.svg", - cx.add_view(|cx| PeoplePanel::new(params.user_store.clone(), params.settings.clone(), cx)) - .into(), + cx.add_view(|cx| { + ContactsPanel::new(params.user_store.clone(), params.settings.clone(), cx) + }) + .into(), ); workspace.right_sidebar_mut().add_item( "icons/comment-16.svg", diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index b28066717c..13a3ccf643 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -40,7 +40,7 @@ fn main() { editor::init(cx, &mut entry_openers); go_to_line::init(cx); file_finder::init(cx); - people_panel::init(cx); + contacts_panel::init(cx); chat_panel::init(cx); project_panel::init(cx);