From 5a41eed120fffd695d0b61f0b6e8d38da51d049b Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 2 Nov 2023 11:34:31 -0600 Subject: [PATCH] WIP --- Cargo.lock | 1 + crates/workspace2/Cargo.toml | 1 + crates/workspace2/src/dock.rs | 1 + crates/workspace2/src/pane_group.rs | 39 ++++++++++++++++++++++++++--- crates/workspace2/src/workspace2.rs | 33 +++++++++++++----------- 5 files changed, 57 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f91f574b9c..134972e3a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10831,6 +10831,7 @@ dependencies = [ "smallvec", "terminal2", "theme2", + "ui2", "util", "uuid 1.4.1", ] diff --git a/crates/workspace2/Cargo.toml b/crates/workspace2/Cargo.toml index 7c55d8bedb..5072f2b8f9 100644 --- a/crates/workspace2/Cargo.toml +++ b/crates/workspace2/Cargo.toml @@ -35,6 +35,7 @@ settings2 = { path = "../settings2" } terminal2 = { path = "../terminal2" } theme2 = { path = "../theme2" } util = { path = "../util" } +ui = { package = "ui2", path = "../ui2" } async-recursion = "1.0.0" itertools = "0.10" diff --git a/crates/workspace2/src/dock.rs b/crates/workspace2/src/dock.rs index 727d777c46..20a06d1658 100644 --- a/crates/workspace2/src/dock.rs +++ b/crates/workspace2/src/dock.rs @@ -606,6 +606,7 @@ impl Render for PanelButtons { type Element = Div; fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + // todo!() let dock = self.dock.read(cx); div().children( dock.panel_entries diff --git a/crates/workspace2/src/pane_group.rs b/crates/workspace2/src/pane_group.rs index f4fdb6ba16..22bbb946a7 100644 --- a/crates/workspace2/src/pane_group.rs +++ b/crates/workspace2/src/pane_group.rs @@ -12,6 +12,7 @@ use project2::Project; use serde::Deserialize; use std::sync::Arc; use theme2::ThemeVariant; +use ui::prelude::*; const HANDLE_HITBOX_SIZE: f32 = 4.0; const HORIZONTAL_MIN_SIZE: f32 = 80.; @@ -124,7 +125,6 @@ impl PaneGroup { pub(crate) fn render( &self, project: &Model, - theme: &ThemeVariant, follower_states: &HashMap, FollowerState>, active_call: Option<&Model>, active_pane: &View, @@ -135,7 +135,6 @@ impl PaneGroup { self.root.render( project, 0, - theme, follower_states, active_call, active_pane, @@ -187,7 +186,6 @@ impl Member { &self, project: &Model, basis: usize, - theme: &ThemeVariant, follower_states: &HashMap, FollowerState>, active_call: Option<&Model>, active_pane: &View, @@ -195,7 +193,40 @@ impl Member { app_state: &Arc, cx: &mut ViewContext, ) -> AnyElement { - todo!() + match self { + Member::Pane(pane) => { + let pane_element = if Some(&**pane) == zoomed { + None + } else { + Some(pane) + }; + + // Stack::new() + // .with_child(pane_element.contained().with_border(leader_border)) + // .with_children(leader_status_box) + // .into_any() + + let el = div() + .flex() + .flex_1() + .gap_px() + .w_full() + .h_full() + .bg(cx.theme().colors().editor) + .children(); + } + Member::Axis(axis) => axis.render( + project, + basis + 1, + theme, + follower_states, + active_call, + active_pane, + zoomed, + app_state, + cx, + ), + } // enum FollowIntoExternalProject {} diff --git a/crates/workspace2/src/workspace2.rs b/crates/workspace2/src/workspace2.rs index 61b9243894..f3516c0fa4 100644 --- a/crates/workspace2/src/workspace2.rs +++ b/crates/workspace2/src/workspace2.rs @@ -3803,20 +3803,25 @@ impl Render for Workspace { // "maxbrunsfeld has requested to add you as a contact.".into(), // )) .child( - div() - .flex() - .flex_col() - .flex_1() - .h_full() - .child(div().flex().flex_1()), // .children( - // Some( - // Panel::new("terminal-panel", cx) - // .child(Terminal::new()) - // .allowed_sides(PanelAllowedSides::BottomOnly) - // .side(PanelSide::Bottom), - // ) - // .filter(|_| self.is_terminal_open()), - // ), + div().flex().flex_col().flex_1().h_full().child( + div().flex().flex_1().child(self.center.render( + project, + follower_states, + active_call, + active_pane, + zoomed, + app_state, + cx, + )), + ), // .children( + // Some( + // Panel::new("terminal-panel", cx) + // .child(Terminal::new()) + // .allowed_sides(PanelAllowedSides::BottomOnly) + // .side(PanelSide::Bottom), + // ) + // .filter(|_| self.is_terminal_open()), + // ), ), // .children( // Some( // Panel::new("chat-panel-outer", cx)