Add ChannelList to AppState
This commit is contained in:
parent
43bb38206f
commit
5ecedd894d
12 changed files with 134 additions and 93 deletions
|
@ -372,8 +372,14 @@ impl Workspace {
|
|||
let mut right_sidebar = Sidebar::new(Side::Right);
|
||||
right_sidebar.add_item(
|
||||
"icons/comment-16.svg",
|
||||
cx.add_view(|_| ChatPanel::new(app_state.settings.clone()))
|
||||
.into(),
|
||||
cx.add_view(|cx| {
|
||||
ChatPanel::new(
|
||||
app_state.channel_list.clone(),
|
||||
app_state.settings.clone(),
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.into(),
|
||||
);
|
||||
right_sidebar.add_item("icons/user-16.svg", cx.add_view(|_| ProjectBrowser).into());
|
||||
|
||||
|
@ -1018,7 +1024,7 @@ mod tests {
|
|||
|
||||
#[gpui::test]
|
||||
async fn test_open_paths_action(mut cx: gpui::TestAppContext) {
|
||||
let app_state = cx.read(build_app_state);
|
||||
let app_state = cx.update(build_app_state);
|
||||
let dir = temp_tree(json!({
|
||||
"a": {
|
||||
"aa": null,
|
||||
|
@ -1091,7 +1097,7 @@ mod tests {
|
|||
},
|
||||
}));
|
||||
|
||||
let app_state = cx.read(build_app_state);
|
||||
let app_state = cx.update(build_app_state);
|
||||
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(&app_state, cx));
|
||||
workspace
|
||||
|
@ -1195,7 +1201,7 @@ mod tests {
|
|||
fs.insert_file("/dir1/a.txt", "".into()).await.unwrap();
|
||||
fs.insert_file("/dir2/b.txt", "".into()).await.unwrap();
|
||||
|
||||
let mut app_state = cx.read(build_app_state);
|
||||
let mut app_state = cx.update(build_app_state);
|
||||
Arc::get_mut(&mut app_state).unwrap().fs = Arc::new(fs);
|
||||
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(&app_state, cx));
|
||||
|
@ -1264,7 +1270,7 @@ mod tests {
|
|||
"a.txt": "",
|
||||
}));
|
||||
|
||||
let app_state = cx.read(build_app_state);
|
||||
let app_state = cx.update(build_app_state);
|
||||
let (window_id, workspace) = cx.add_window(|cx| Workspace::new(&app_state, cx));
|
||||
workspace
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
|
@ -1309,7 +1315,7 @@ mod tests {
|
|||
#[gpui::test]
|
||||
async fn test_open_and_save_new_file(mut cx: gpui::TestAppContext) {
|
||||
let dir = TempDir::new("test-new-file").unwrap();
|
||||
let app_state = cx.read(build_app_state);
|
||||
let app_state = cx.update(build_app_state);
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(&app_state, cx));
|
||||
workspace
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
|
@ -1408,7 +1414,7 @@ mod tests {
|
|||
async fn test_new_empty_workspace(mut cx: gpui::TestAppContext) {
|
||||
cx.update(init);
|
||||
|
||||
let app_state = cx.read(build_app_state);
|
||||
let app_state = cx.update(build_app_state);
|
||||
cx.dispatch_global_action(OpenNew(app_state));
|
||||
let window_id = *cx.window_ids().first().unwrap();
|
||||
let workspace = cx.root_view::<Workspace>(window_id).unwrap();
|
||||
|
@ -1454,7 +1460,7 @@ mod tests {
|
|||
},
|
||||
}));
|
||||
|
||||
let app_state = cx.read(build_app_state);
|
||||
let app_state = cx.update(build_app_state);
|
||||
let (window_id, workspace) = cx.add_window(|cx| Workspace::new(&app_state, cx));
|
||||
workspace
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue