🎨 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 client::{Contact, UserStore};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
elements::*,
|
elements::*,
|
||||||
|
@ -8,8 +6,9 @@ use gpui::{
|
||||||
Element, ElementBox, Entity, LayoutContext, ModelHandle, RenderContext, Subscription, View,
|
Element, ElementBox, Entity, LayoutContext, ModelHandle, RenderContext, Subscription, View,
|
||||||
ViewContext,
|
ViewContext,
|
||||||
};
|
};
|
||||||
use workspace::{AppState, JoinProject, JoinProjectParams};
|
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use workspace::{AppState, JoinProject};
|
||||||
|
|
||||||
pub struct ContactsPanel {
|
pub struct ContactsPanel {
|
||||||
contacts: ListState,
|
contacts: ListState,
|
||||||
|
@ -207,10 +206,10 @@ impl ContactsPanel {
|
||||||
})
|
})
|
||||||
.on_click(move |cx| {
|
.on_click(move |cx| {
|
||||||
if !is_host && !is_guest {
|
if !is_host && !is_guest {
|
||||||
cx.dispatch_global_action(JoinProject(JoinProjectParams {
|
cx.dispatch_global_action(JoinProject {
|
||||||
project_id,
|
project_id,
|
||||||
app_state: app_state.clone(),
|
app_state: app_state.clone(),
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.flex(1., true)
|
.flex(1., true)
|
||||||
|
|
|
@ -97,7 +97,10 @@ pub struct OpenPaths {
|
||||||
pub struct ToggleFollow(pub PeerId);
|
pub struct ToggleFollow(pub PeerId);
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct JoinProject(pub JoinProjectParams);
|
pub struct JoinProject {
|
||||||
|
pub project_id: u64,
|
||||||
|
pub app_state: Arc<AppState>,
|
||||||
|
}
|
||||||
|
|
||||||
impl_internal_actions!(
|
impl_internal_actions!(
|
||||||
workspace,
|
workspace,
|
||||||
|
@ -115,7 +118,7 @@ pub fn init(client: &Arc<Client>, cx: &mut MutableAppContext) {
|
||||||
open_new(&action.0, cx)
|
open_new(&action.0, cx)
|
||||||
});
|
});
|
||||||
cx.add_global_action(move |action: &JoinProject, cx: &mut MutableAppContext| {
|
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);
|
cx.add_action(Workspace::toggle_share);
|
||||||
|
@ -187,12 +190,6 @@ pub struct AppState {
|
||||||
) -> Workspace,
|
) -> Workspace,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct JoinProjectParams {
|
|
||||||
pub project_id: u64,
|
|
||||||
pub app_state: Arc<AppState>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait Item: View {
|
pub trait Item: View {
|
||||||
fn deactivated(&mut self, _: &mut ViewContext<Self>) {}
|
fn deactivated(&mut self, _: &mut ViewContext<Self>) {}
|
||||||
fn navigate(&mut self, _: Box<dyn Any>, _: &mut ViewContext<Self>) -> bool {
|
fn navigate(&mut self, _: Box<dyn Any>, _: &mut ViewContext<Self>) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue