workspace.rs

 1use gpui2::{
 2    elements::{div, div::ScrollState},
 3    style::StyleHelpers,
 4    Element, IntoElement, ParentElement, ViewContext,
 5};
 6use ui::{chat_panel, project_panel, status_bar, tab_bar, theme, title_bar, toolbar};
 7
 8#[derive(Element, Default)]
 9pub struct WorkspaceElement {
10    left_scroll_state: ScrollState,
11    right_scroll_state: ScrollState,
12    tab_bar_scroll_state: ScrollState,
13}
14
15impl WorkspaceElement {
16    fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
17        let theme = theme(cx);
18
19        div()
20            .size_full()
21            .flex()
22            .flex_col()
23            .font("Zed Sans Extended")
24            .gap_0()
25            .justify_start()
26            .items_start()
27            .text_color(theme.lowest.base.default.foreground)
28            .fill(theme.lowest.base.default.background)
29            .child(title_bar())
30            .child(
31                div()
32                    .flex_1()
33                    .w_full()
34                    .flex()
35                    .flex_row()
36                    .overflow_hidden()
37                    .child(project_panel(self.left_scroll_state.clone()))
38                    .child(
39                        div()
40                            .h_full()
41                            .flex_1()
42                            .fill(theme.highest.base.default.background)
43                            .child(
44                                div()
45                                    .flex()
46                                    .flex_col()
47                                    .flex_1()
48                                    .child(tab_bar(self.tab_bar_scroll_state.clone()))
49                                    .child(toolbar()),
50                            ),
51                    )
52                    .child(chat_panel(self.right_scroll_state.clone())),
53            )
54            .child(status_bar())
55    }
56}