Merge branch 'gpui2-ui' into gpui2

Marshall Bowers created

Change summary

crates/ui2/src/components/list.rs      |  2 
crates/ui2/src/components/workspace.rs | 92 ++++++++++++---------------
2 files changed, 43 insertions(+), 51 deletions(-)

Detailed changes

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

@@ -99,7 +99,7 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
         let color = ThemeColor::new(cx);
 
         let is_toggleable = self.toggleable != Toggleable::NotToggleable;
-        let is_toggled = Toggleable::is_toggled(&self.toggleable);
+        let is_toggled = self.toggleable.is_toggled();
 
         let disclosure_control = self.disclosure_control();
 

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

@@ -1,22 +1,22 @@
 use chrono::DateTime;
-use gpui3::{px, relative, rems, view, Context, Size, View};
+use gpui3::{px, relative, view, Context, Size, View};
 
 use crate::prelude::*;
 use crate::{
-    theme, v_stack, AssistantPanel, Button, ChatMessage, ChatPanel, CollabPanel, EditorPane, Label,
-    LanguageSelector, NotificationToast, Pane, PaneGroup, Panel, PanelAllowedSides, PanelSide,
-    ProjectPanel, SplitDirection, StatusBar, Terminal, TitleBar, Toast, ToastOrigin,
+    theme, v_stack, AssistantPanel, ChatMessage, ChatPanel, CollabPanel, EditorPane, Label,
+    LanguageSelector, Pane, PaneGroup, Panel, PanelAllowedSides, PanelSide, ProjectPanel,
+    SplitDirection, StatusBar, Terminal, TitleBar, Toast, ToastOrigin,
 };
 
 #[derive(Clone)]
 pub struct Workspace {
     title_bar: View<TitleBar>,
     editor_1: View<EditorPane>,
-    editor_2: View<EditorPane>,
     show_project_panel: bool,
     show_collab_panel: bool,
     show_chat_panel: bool,
     show_assistant_panel: bool,
+    show_notifications_panel: bool,
     show_terminal: bool,
     show_language_selector: bool,
     left_panel_scroll_state: ScrollState,
@@ -30,13 +30,13 @@ impl Workspace {
         Self {
             title_bar: TitleBar::view(cx),
             editor_1: EditorPane::view(cx),
-            editor_2: EditorPane::view(cx),
             show_project_panel: true,
             show_collab_panel: false,
-            show_chat_panel: true,
+            show_chat_panel: false,
             show_assistant_panel: false,
             show_terminal: true,
             show_language_selector: false,
+            show_notifications_panel: true,
             left_panel_scroll_state: ScrollState::default(),
             right_panel_scroll_state: ScrollState::default(),
             tab_bar_scroll_state: ScrollState::default(),
@@ -88,6 +88,18 @@ impl Workspace {
         cx.notify();
     }
 
+    pub fn is_notifications_panel_open(&self) -> bool {
+        self.show_notifications_panel
+    }
+
+    pub fn toggle_notifications_panel(&mut self, cx: &mut ViewContext<Self>) {
+        self.show_notifications_panel = !self.show_notifications_panel;
+
+        self.show_notifications_panel = false;
+
+        cx.notify();
+    }
+
     pub fn is_assistant_panel_open(&self) -> bool {
         self.show_assistant_panel
     }
@@ -117,43 +129,15 @@ impl Workspace {
     pub fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
         let theme = theme(cx).clone();
 
-        let temp_size = rems(36.).into();
-
-        let root_group = PaneGroup::new_groups(
-            vec![
-                PaneGroup::new_panes(
-                    vec![
-                        Pane::new(
-                            ScrollState::default(),
-                            Size {
-                                width: relative(1.).into(),
-                                height: temp_size,
-                            },
-                        )
-                        .child(self.editor_1.clone()),
-                        Pane::new(
-                            ScrollState::default(),
-                            Size {
-                                width: relative(1.).into(),
-                                height: temp_size,
-                            },
-                        )
-                        .child(Terminal::new()),
-                    ],
-                    SplitDirection::Vertical,
-                ),
-                PaneGroup::new_panes(
-                    vec![Pane::new(
-                        ScrollState::default(),
-                        Size {
-                            width: relative(1.).into(),
-                            height: relative(1.).into(),
-                        },
-                    )
-                    .child(self.editor_2.clone())],
-                    SplitDirection::Vertical,
-                ),
-            ],
+        let root_group = PaneGroup::new_panes(
+            vec![Pane::new(
+                ScrollState::default(),
+                Size {
+                    width: relative(1.).into(),
+                    height: relative(1.).into(),
+                },
+            )
+            .child(self.editor_1.clone())],
             SplitDirection::Horizontal,
         );
 
@@ -243,6 +227,14 @@ impl Workspace {
                         )
                         .filter(|_| self.is_chat_panel_open()),
                     )
+                    .children(
+                        Some(
+                            Panel::new(self.right_panel_scroll_state.clone())
+                                .side(PanelSide::Right)
+                                .child(div().w_96().h_full().child("Notifications")),
+                        )
+                        .filter(|_| self.is_notifications_panel_open()),
+                    )
                     .children(
                         Some(
                             Panel::new(self.right_panel_scroll_state.clone())
@@ -264,12 +256,12 @@ impl Workspace {
                 .filter(|_| self.is_language_selector_open()),
             )
             .child(Toast::new(ToastOrigin::Bottom).child(Label::new("A toast")))
-            // .child(Toast::new(ToastOrigin::BottomRight).child(Label::new("Another toast")))
-            .child(NotificationToast::new(
-                "Can't pull changes from origin",
-                "Your local branch is behind the remote branch. Please pull the latest changes before pushing.",
-                Button::new("Stash & Switch").variant(ButtonVariant::Filled),
-            ).secondary_action(Button::new("Cancel")))
+        // .child(Toast::new(ToastOrigin::BottomRight).child(Label::new("Another toast")))
+        // .child(NotificationToast::new(
+        //     "Can't pull changes from origin",
+        //     "Your local branch is behind the remote branch. Please pull the latest changes before pushing.",
+        //     Button::new("Stash & Switch").variant(ButtonVariant::Filled),
+        // ).secondary_action(Button::new("Cancel")))
     }
 }