mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-10 20:29:05 +00:00
🎨 Remove unnecessary JoinProjectParams struct
This commit is contained in:
parent
184a454f6f
commit
eee1cec3d4
2 changed files with 9 additions and 13 deletions
|
@ -1,5 +1,3 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use client::{Contact, UserStore};
|
||||
use gpui::{
|
||||
elements::*,
|
||||
|
@ -8,8 +6,9 @@ use gpui::{
|
|||
Element, ElementBox, Entity, LayoutContext, ModelHandle, RenderContext, Subscription, View,
|
||||
ViewContext,
|
||||
};
|
||||
use workspace::{AppState, JoinProject, JoinProjectParams};
|
||||
use settings::Settings;
|
||||
use std::sync::Arc;
|
||||
use workspace::{AppState, JoinProject};
|
||||
|
||||
pub struct ContactsPanel {
|
||||
contacts: ListState,
|
||||
|
@ -207,10 +206,10 @@ impl ContactsPanel {
|
|||
})
|
||||
.on_click(move |cx| {
|
||||
if !is_host && !is_guest {
|
||||
cx.dispatch_global_action(JoinProject(JoinProjectParams {
|
||||
cx.dispatch_global_action(JoinProject {
|
||||
project_id,
|
||||
app_state: app_state.clone(),
|
||||
}));
|
||||
});
|
||||
}
|
||||
})
|
||||
.flex(1., true)
|
||||
|
|
|
@ -97,7 +97,10 @@ pub struct OpenPaths {
|
|||
pub struct ToggleFollow(pub PeerId);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct JoinProject(pub JoinProjectParams);
|
||||
pub struct JoinProject {
|
||||
pub project_id: u64,
|
||||
pub app_state: Arc<AppState>,
|
||||
}
|
||||
|
||||
impl_internal_actions!(
|
||||
workspace,
|
||||
|
@ -115,7 +118,7 @@ pub fn init(client: &Arc<Client>, cx: &mut MutableAppContext) {
|
|||
open_new(&action.0, cx)
|
||||
});
|
||||
cx.add_global_action(move |action: &JoinProject, cx: &mut MutableAppContext| {
|
||||
join_project(action.0.project_id, &action.0.app_state, cx).detach();
|
||||
join_project(action.project_id, &action.app_state, cx).detach();
|
||||
});
|
||||
|
||||
cx.add_action(Workspace::toggle_share);
|
||||
|
@ -187,12 +190,6 @@ pub struct AppState {
|
|||
) -> Workspace,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct JoinProjectParams {
|
||||
pub project_id: u64,
|
||||
pub app_state: Arc<AppState>,
|
||||
}
|
||||
|
||||
pub trait Item: View {
|
||||
fn deactivated(&mut self, _: &mut ViewContext<Self>) {}
|
||||
fn navigate(&mut self, _: Box<dyn Any>, _: &mut ViewContext<Self>) -> bool {
|
||||
|
|
Loading…
Reference in a new issue