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