mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 18:41:10 +00:00
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"
|
||||
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",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "people_panel"
|
||||
name = "contacts_panel"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
|
@ -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<UserStore>,
|
||||
settings: watch::Receiver<Settings>,
|
||||
_maintain_contacts: Subscription,
|
||||
}
|
||||
|
||||
impl PeoplePanel {
|
||||
impl ContactsPanel {
|
||||
pub fn new(
|
||||
user_store: ModelHandle<UserStore>,
|
||||
settings: watch::Receiver<Settings>,
|
||||
|
@ -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::<PeoplePanel, _, _, _>(
|
||||
MouseEventHandler::new::<ContactsPanel, _, _, _>(
|
||||
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<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())
|
||||
.with_style(theme.container)
|
||||
.boxed()
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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>) ->
|
|||
);
|
||||
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",
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue