Merge branch 'gpui2-ui' into gpui2
This commit is contained in:
commit
c8b452d411
2 changed files with 43 additions and 51 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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,32 +129,7 @@ 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(
|
||||
let root_group = PaneGroup::new_panes(
|
||||
vec![Pane::new(
|
||||
ScrollState::default(),
|
||||
Size {
|
||||
|
@ -150,10 +137,7 @@ impl Workspace {
|
|||
height: relative(1.).into(),
|
||||
},
|
||||
)
|
||||
.child(self.editor_2.clone())],
|
||||
SplitDirection::Vertical,
|
||||
),
|
||||
],
|
||||
.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())
|
||||
|
@ -265,11 +257,11 @@ impl Workspace {
|
|||
)
|
||||
.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(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")))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue