Fix last thing

Conrad Irwin created

Change summary

crates/terminal_view2/src/terminal_view.rs |  1 
crates/ui2/src/components/list.rs          |  9 +++----
crates/ui2/src/components/panel.rs         |  6 +---
crates/workspace2/src/dock.rs              | 28 +++++++++++------------
4 files changed, 19 insertions(+), 25 deletions(-)

Detailed changes

crates/terminal_view2/src/terminal_view.rs 🔗

@@ -63,7 +63,6 @@ pub struct SendKeystroke(String);
 actions!(Clear, Copy, Paste, ShowCharacterPalette, SearchTest);
 
 pub fn init(cx: &mut AppContext) {
-    workspace::ui::init(cx);
     terminal_panel::init(cx);
     terminal::init(cx);
 

crates/ui2/src/components/list.rs 🔗

@@ -1,8 +1,9 @@
-use gpui::{div, AnyElement, ClickEvent, Div, RenderOnce, Stateful, StatefulInteractiveElement};
+use gpui::{
+    div, px, AnyElement, ClickEvent, Div, RenderOnce, Stateful, StatefulInteractiveElement,
+};
 use smallvec::SmallVec;
 use std::rc::Rc;
 
-use crate::settings::user_settings;
 use crate::{
     disclosure_control, h_stack, v_stack, Avatar, Icon, IconElement, IconSize, Label, Toggle,
 };
@@ -331,8 +332,6 @@ impl Component for ListItem {
     type Rendered = Stateful<Div>;
 
     fn render(self, cx: &mut WindowContext) -> Self::Rendered {
-        let settings = user_settings(cx);
-
         let left_content = match self.left_slot.clone() {
             Some(GraphicSlot::Icon(i)) => Some(
                 h_stack().child(
@@ -377,7 +376,7 @@ impl Component for ListItem {
                     // .ml(rems(0.75 * self.indent_level as f32))
                     .children((0..self.indent_level).map(|_| {
                         div()
-                            .w(*settings.list_indent_depth)
+                            .w(px(4.))
                             .h_full()
                             .flex()
                             .justify_center()

crates/ui2/src/components/panel.rs 🔗

@@ -1,8 +1,8 @@
+use gpui::px;
 use gpui::{prelude::*, AbsoluteLength, AnyElement, Div, RenderOnce};
 use smallvec::SmallVec;
 
 use crate::prelude::*;
-use crate::settings::user_settings;
 use crate::v_stack;
 
 #[derive(Default, Debug, PartialEq, Eq, Hash, Clone, Copy)]
@@ -75,13 +75,11 @@ impl Component for Panel {
 
 impl Panel {
     pub fn new(id: impl Into<ElementId>, cx: &mut WindowContext) -> Self {
-        let settings = user_settings(cx);
-
         Self {
             id: id.into(),
             current_side: PanelSide::default(),
             allowed_sides: PanelAllowedSides::default(),
-            initial_width: *settings.default_panel_size,
+            initial_width: px(320.).into(),
             width: None,
             children: SmallVec::new(),
         }

crates/workspace2/src/dock.rs 🔗

@@ -8,7 +8,9 @@ use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 use std::sync::Arc;
 use theme2::ActiveTheme;
-use ui::{h_stack, menu_handle, ContextMenu, IconButton, InteractionState, Tooltip};
+use ui::{
+    h_stack, menu_handle, ContextMenu, IconButton, InteractionState, Label, ListItem, Tooltip,
+};
 
 pub enum PanelEvent {
     ChangePosition,
@@ -711,25 +713,21 @@ impl Render for PanelButtons {
                                 DockPosition::Bottom,
                             ];
 
-                            //CX: Pane
                             ContextMenu::build(cx, |mut menu, cx| {
-                                // CX: Menu
                                 for position in POSITIONS {
                                     if position != dock_position
                                         && panel.position_is_valid(position, cx)
                                     {
-                                        // let panel = panel.clone();
-                                        todo!()
-                                        // menu = menu.entry(
-                                        //     ListEntry::new(Label::new(format!(
-                                        //         "Dock {}",
-                                        //         position.to_label()
-                                        //     ))),
-                                        // cx.listener(move |_, cx| {
-                                        //     //What should CX be? CX: Pane
-                                        //     panel.set_position(position, cx);
-                                        // }),
-                                        //)
+                                        let panel = panel.clone();
+                                        menu = menu.entry(
+                                            ListItem::new(
+                                                panel.entity_id(),
+                                                Label::new(format!("Dock {}", position.to_label())),
+                                            ),
+                                            move |_, cx| {
+                                                panel.set_position(position, cx);
+                                            },
+                                        )
                                     }
                                 }
                                 menu