Get left, right, and bottom docks rendering in the right places in the workspace

Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-11-13 10:47:15 -08:00
parent 13255ef133
commit 13dd912817
4 changed files with 51 additions and 42 deletions

View file

@ -238,6 +238,24 @@ pub fn blue() -> Hsla {
} }
} }
pub fn green() -> Hsla {
Hsla {
h: 0.33,
s: 1.,
l: 0.5,
a: 1.,
}
}
pub fn yellow() -> Hsla {
Hsla {
h: 0.16,
s: 1.,
l: 0.5,
a: 1.,
}
}
impl Hsla { impl Hsla {
/// Returns true if the HSLA color is fully transparent, false otherwise. /// Returns true if the HSLA color is fully transparent, false otherwise.
pub fn is_transparent(&self) -> bool { pub fn is_transparent(&self) -> bool {

View file

@ -31,7 +31,7 @@ use std::{
sync::Arc, sync::Arc,
}; };
use theme::ActiveTheme as _; use theme::ActiveTheme as _;
use ui::{h_stack, v_stack}; use ui::{h_stack, v_stack, Label};
use unicase::UniCase; use unicase::UniCase;
use util::TryFutureExt; use util::TryFutureExt;
use workspace::{ use workspace::{
@ -1382,7 +1382,7 @@ impl ProjectPanel {
if let (Some(editor), true) = (editor, show_editor) { if let (Some(editor), true) = (editor, show_editor) {
div().child(editor.clone()) div().child(editor.clone())
} else { } else {
div().child(details.filename.clone()) div().child(Label::new(details.filename.clone()))
} }
.ml_1(), .ml_1(),
) )
@ -1449,6 +1449,7 @@ impl Render for ProjectPanel {
if has_worktree { if has_worktree {
div() div()
.size_full()
.id("project-panel") .id("project-panel")
.track_focus(&self.focus_handle) .track_focus(&self.focus_handle)
.child( .child(
@ -1472,6 +1473,7 @@ impl Render for ProjectPanel {
items items
}, },
) )
.size_full()
.track_scroll(self.list.clone()), .track_scroll(self.list.clone()),
) )
} else { } else {

View file

@ -1,7 +1,7 @@
use crate::{status_bar::StatusItemView, Axis, Workspace}; use crate::{status_bar::StatusItemView, Axis, Workspace};
use gpui::{ use gpui::{
div, Action, AnyView, AppContext, Div, Entity, EntityId, EventEmitter, FocusHandle, div, Action, AnyView, AppContext, Div, Entity, EntityId, EventEmitter, FocusHandle,
ParentElement, Render, Subscription, View, ViewContext, WeakView, WindowContext, ParentElement, Render, Styled, Subscription, View, ViewContext, WeakView, WindowContext,
}; };
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -428,7 +428,11 @@ impl Render for Dock {
type Element = Div<Self>; type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element { fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!() if let Some(entry) = self.visible_entry() {
div().size_full().child(entry.panel.to_any())
} else {
div()
}
} }
} }

View file

@ -3642,45 +3642,30 @@ impl Render for Workspace {
.border_t() .border_t()
.border_b() .border_b()
.border_color(cx.theme().colors().border) .border_color(cx.theme().colors().border)
// .children(
// Some(
// Panel::new("project-panel-outer", cx)
// .side(PanelSide::Left)
// .child(ProjectPanel::new("project-panel-inner")),
// )
// .filter(|_| self.is_project_panel_open()),
// )
// .children(
// Some(
// Panel::new("collab-panel-outer", cx)
// .child(CollabPanel::new("collab-panel-inner"))
// .side(PanelSide::Left),
// )
// .filter(|_| self.is_collab_panel_open()),
// )
// .child(NotificationToast::new(
// "maxbrunsfeld has requested to add you as a contact.".into(),
// ))
.child( .child(
div().flex().flex_col().flex_1().h_full().child( div()
div().flex().flex_1().child(self.center.render( .flex()
&self.project, .flex_row()
&self.follower_states, .flex_1()
self.active_call(), .h_full()
&self.active_pane, .child(div().flex().flex_1().child(self.left_dock.clone()))
self.zoomed.as_ref(), .child(
&self.app_state, div()
cx, .flex()
)), .flex_col()
), // .children( .flex_1()
// Some( .child(self.center.render(
// Panel::new("terminal-panel", cx) &self.project,
// .child(Terminal::new()) &self.follower_states,
// .allowed_sides(PanelAllowedSides::BottomOnly) self.active_call(),
// .side(PanelSide::Bottom), &self.active_pane,
// ) self.zoomed.as_ref(),
// .filter(|_| self.is_terminal_open()), &self.app_state,
// ), cx,
))
.child(div().flex().flex_1().child(self.bottom_dock.clone())),
)
.child(div().flex().flex_1().child(self.right_dock.clone())),
), // .children( ), // .children(
// Some( // Some(
// Panel::new("chat-panel-outer", cx) // Panel::new("chat-panel-outer", cx)