Checkpoint - Still Broken

This commit is contained in:
Nate Butler 2023-10-19 14:38:01 -04:00
parent bca97f7186
commit 58650b7d2d
31 changed files with 298 additions and 213 deletions

View file

@ -3,7 +3,7 @@ use std::marker::PhantomData;
use gpui3::{Hsla, WindowContext};
use crate::prelude::*;
use crate::{h_stack, theme, v_stack, Icon, IconElement};
use crate::{h_stack, v_stack, Icon, IconElement};
#[derive(Default, PartialEq, Copy, Clone)]
pub struct PlayerCursor {
@ -232,7 +232,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
.flex_1()
.w_full()
.h_full()
.bg(color.editor_background)
.bg(color.editor)
.children(rows)
}
}
@ -279,14 +279,14 @@ mod stories {
div()
.w(rems(64.))
.h_96()
.child(hello_world_rust_buffer_example(&theme)),
.child(hello_world_rust_buffer_example(&color)),
)
.child(Story::label(cx, "Hello World (Rust) with Status"))
.child(
div()
.w(rems(64.))
.h_96()
.child(hello_world_rust_buffer_with_status_example(&theme)),
.child(hello_world_rust_buffer_with_status_example(&color)),
)
}
}

View file

@ -29,7 +29,7 @@ impl BufferSearch {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
let color = ThemeColor::new(cx);
h_stack().bg(color.toolbar_background).p_2().child(
h_stack().bg(color.toolbar).p_2().child(
h_stack().child(Input::new("Search")).child(
IconButton::<Self>::new(Icon::Replace)
.when(self.is_replace_open, |this| this.color(IconColor::Accent))

View file

@ -3,7 +3,6 @@ use std::marker::PhantomData;
use chrono::NaiveDateTime;
use crate::prelude::*;
use crate::theme::theme;
use crate::{Icon, IconButton, Input, Label, LabelColor};
#[derive(Element)]

View file

@ -3,7 +3,6 @@ use std::marker::PhantomData;
use gpui3::{img, svg, SharedString};
use crate::prelude::*;
use crate::theme::{theme, Theme};
use crate::{
static_collab_panel_channels, static_collab_panel_current_call, v_stack, Icon, List,
ListHeader, ToggleState,

View file

@ -1,5 +1,5 @@
use crate::{prelude::*, ListItemVariant};
use crate::{theme, v_stack, Label, List, ListEntry, ListItem, ListSeparator, ListSubHeader};
use crate::{v_stack, Label, List, ListEntry, ListItem, ListSeparator, ListSubHeader};
#[derive(Clone)]
pub enum ContextMenuItem<S: 'static + Send + Sync + Clone> {

View file

@ -56,7 +56,7 @@ impl EditorPane {
.w_full()
.h_full()
.flex_1()
.child(TabBar::new(self.tabs.clone()))
.child(TabBar::new(self.tabs.clone()).can_navigate((false, true)))
.child(
Toolbar::new()
.left_item(Breadcrumb::new(self.path.clone(), self.symbols.clone()))

View file

@ -4,7 +4,7 @@ use std::sync::Arc;
use gpui3::{Interactive, MouseButton};
use crate::{h_stack, prelude::*};
use crate::{theme, ClickHandler, Icon, IconColor, IconElement};
use crate::{ClickHandler, Icon, IconColor, IconElement};
struct IconButtonHandlers<S: 'static + Send + Sync> {
click: Option<ClickHandler<S>>,

View file

@ -4,7 +4,6 @@ use std::marker::PhantomData;
use strum::{EnumIter, IntoEnumIterator};
use crate::prelude::*;
use crate::theme;
#[derive(Element, Clone)]
pub struct Keybinding<S: 'static + Send + Sync + Clone> {

View file

@ -4,7 +4,6 @@ use gpui3::{div, Div};
use crate::prelude::*;
use crate::settings::user_settings;
use crate::theme::theme;
use crate::{h_stack, v_stack, Avatar, Icon, IconColor, IconElement, IconSize, Label, LabelColor};
#[derive(Clone, Copy, Default, Debug, PartialEq)]

View file

@ -73,11 +73,11 @@ mod stories {
.child(Story::title_for::<_, MultiBuffer<S>>(cx))
.child(Story::label(cx, "Default"))
.child(MultiBuffer::new(vec![
hello_world_rust_buffer_example(&theme),
hello_world_rust_buffer_example(&theme),
hello_world_rust_buffer_example(&theme),
hello_world_rust_buffer_example(&theme),
hello_world_rust_buffer_example(&theme),
hello_world_rust_buffer_example(&color),
hello_world_rust_buffer_example(&color),
hello_world_rust_buffer_example(&color),
hello_world_rust_buffer_example(&color),
hello_world_rust_buffer_example(&color),
]))
}
}

View file

@ -1,7 +1,6 @@
use std::marker::PhantomData;
use crate::prelude::*;
use crate::theme::theme;
use crate::{h_stack, v_stack, Keybinding, Label, LabelColor};
#[derive(Element)]

View file

@ -3,9 +3,9 @@ use std::marker::PhantomData;
use gpui3::{AbsoluteLength, AnyElement};
use smallvec::SmallVec;
use crate::prelude::*;
use crate::settings::user_settings;
use crate::v_stack;
use crate::{prelude::*, theme};
#[derive(Default, Debug, PartialEq, Eq, Hash, Clone, Copy)]
pub enum PanelAllowedSides {
@ -99,43 +99,24 @@ impl<S: 'static + Send + Sync> Panel<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
let panel_base;
let current_width = self.width.unwrap_or(self.initial_width);
let current_size = self.width.unwrap_or(self.initial_width);
match self.current_side {
PanelSide::Left => {
panel_base = v_stack()
.flex_initial()
.h_full()
// .w(current_width)
.w_64()
.bg(theme.middle.base.default.background)
.border_r()
.border_color(theme.middle.base.default.border);
}
PanelSide::Right => {
panel_base = v_stack()
.flex_initial()
.h_full()
// .w(current_width)
.w_64()
.bg(theme.middle.base.default.background)
.border_l()
.border_color(theme.middle.base.default.border);
}
PanelSide::Bottom => {
panel_base = v_stack()
.flex_initial()
.w_full()
// .h(current_width)
.h_64()
.bg(theme.middle.base.default.background)
.border_t()
.border_color(theme.middle.base.default.border);
}
}
panel_base.children(self.children.drain(..))
v_stack()
.flex_initial()
.when(
self.current_side == PanelSide::Left || self.current_side == PanelSide::Right,
|this| this.h_full().w(current_size),
)
.when(self.current_side == PanelSide::Left, |this| this.border_r())
.when(self.current_side == PanelSide::Right, |this| {
this.border_l()
})
.when(self.current_side == PanelSide::Bottom, |this| {
this.border_b().w_full().h(current_size)
})
.bg(color.surface)
.border_color(color.border)
.children(self.children.drain(..))
}
}

View file

@ -4,7 +4,6 @@ use gpui3::{hsla, AnyElement, Hsla, Length, Size};
use smallvec::SmallVec;
use crate::prelude::*;
use crate::theme;
#[derive(Default, PartialEq)]
pub enum SplitDirection {
@ -99,7 +98,6 @@ impl<S: 'static + Send + Sync> PaneGroup<S> {
.gap_px()
.w_full()
.h_full()
.bg(theme.lowest.base.default.background)
.children(self.panes.iter_mut().map(|pane| pane.render(view, cx)));
if self.split_direction == SplitDirection::Horizontal {
@ -116,7 +114,7 @@ impl<S: 'static + Send + Sync> PaneGroup<S> {
.gap_px()
.w_full()
.h_full()
.bg(theme.lowest.base.default.background)
.bg(color.editor)
.children(self.groups.iter_mut().map(|group| group.render(view, cx)));
if self.split_direction == SplitDirection::Horizontal {

View file

@ -2,8 +2,7 @@ use std::marker::PhantomData;
use crate::prelude::*;
use crate::{
static_project_panel_project_items, static_project_panel_single_items, theme, Input, List,
ListHeader,
static_project_panel_project_items, static_project_panel_single_items, Input, List, ListHeader,
};
#[derive(Element)]

View file

@ -96,16 +96,18 @@ impl StatusBar {
.items_center()
.justify_between()
.w_full()
.bg(theme.lowest.base.default.background)
.child(self.left_tools(view, &theme))
.child(self.right_tools(view, &theme))
.bg(color.status_bar)
.child(self.left_tools(view, cx))
.child(self.right_tools(view, cx))
}
fn left_tools(
&self,
workspace: &mut Workspace,
theme: &Theme,
cx: &WindowContext,
) -> impl Element<ViewState = Workspace> {
let color = ThemeColor::new(cx);
div()
.flex()
.items_center()
@ -135,8 +137,10 @@ impl StatusBar {
fn right_tools(
&self,
workspace: &mut Workspace,
theme: &Theme,
cx: &WindowContext,
) -> impl Element<ViewState = Workspace> {
let color = ThemeColor::new(cx);
div()
.flex()
.items_center()

View file

@ -1,7 +1,7 @@
use std::marker::PhantomData;
use crate::prelude::*;
use crate::{theme, Icon, IconColor, IconElement, Label, LabelColor};
use crate::{Icon, IconColor, IconElement, Label, LabelColor};
#[derive(Element, Clone)]
pub struct Tab<S: 'static + Send + Sync + Clone> {
@ -96,17 +96,28 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
let close_icon = IconElement::new(Icon::Close).color(IconColor::Muted);
let (tab_bg, tab_hover_bg, tab_active_bg) = match self.current {
true => (
color.ghost_element,
color.ghost_element_hover,
color.ghost_element_active,
),
false => (
color.filled_element,
color.filled_element_hover,
color.filled_element_active,
),
};
div()
.px_2()
.py_0p5()
.flex()
.items_center()
.justify_center()
.bg(if self.current {
theme.highest.base.default.background
} else {
theme.middle.base.default.background
})
.bg(tab_bg)
.hover(|h| h.bg(tab_hover_bg))
// .active(|a| a.bg(tab_active_bg))
.child(
div()
.px_1()

View file

@ -1,12 +1,14 @@
use std::marker::PhantomData;
use crate::prelude::*;
use crate::{theme, Icon, IconButton, Tab};
use crate::{Icon, IconButton, Tab};
#[derive(Element)]
pub struct TabBar<S: 'static + Send + Sync + Clone> {
state_type: PhantomData<S>,
scroll_state: ScrollState,
/// Backwards, Forwards
can_navigate: (bool, bool),
tabs: Vec<Tab<S>>,
}
@ -15,6 +17,7 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
Self {
state_type: PhantomData,
scroll_state: ScrollState::default(),
can_navigate: (false, false),
tabs,
}
}
@ -23,15 +26,20 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
self.scroll_state = scroll_state;
}
pub fn can_navigate(mut self, can_navigate: (bool, bool)) -> Self {
self.can_navigate = can_navigate;
self
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
let can_navigate_back = true;
let can_navigate_forward = false;
let (can_navigate_back, can_navigate_forward) = self.can_navigate;
div()
.w_full()
.flex()
.bg(theme.middle.base.default.background)
.bg(color.tab_bar)
// Left Side
.child(
div()

View file

@ -3,7 +3,7 @@ use std::marker::PhantomData;
use gpui3::{relative, rems, Size};
use crate::prelude::*;
use crate::{theme, Icon, IconButton, Pane, Tab};
use crate::{Icon, IconButton, Pane, Tab};
#[derive(Element)]
pub struct Terminal<S: 'static + Send + Sync + Clone> {
@ -32,7 +32,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
div()
.w_full()
.flex()
.bg(theme.middle.base.default.background)
.bg(color.surface)
.child(
div().px_1().flex().flex_none().gap_2().child(
div()
@ -79,7 +79,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
height: rems(36.).into(),
},
)
.child(crate::static_data::terminal_buffer(&theme)),
.child(crate::static_data::terminal_buffer(&color)),
)
}
}

View file

@ -6,7 +6,7 @@ use gpui3::{view, Context, View};
use crate::prelude::*;
use crate::settings::user_settings;
use crate::{
random_players_with_call_status, theme, Avatar, Button, Icon, IconButton, IconColor, MicStatus,
random_players_with_call_status, Avatar, Button, Icon, IconButton, IconColor, MicStatus,
PlayerWithCallStatus, ScreenShareStatus, ToolDivider, TrafficLights,
};

View file

@ -2,7 +2,6 @@ use gpui3::AnyElement;
use smallvec::SmallVec;
use crate::prelude::*;
use crate::theme;
#[derive(Clone)]
pub struct ToolbarItem {}
@ -59,7 +58,7 @@ impl<S: 'static + Send + Sync> Toolbar<S> {
let color = ThemeColor::new(cx);
div()
.bg(theme.highest.base.default.background)
.bg(color.toolbar)
.p_2()
.flex()
.justify_between()
@ -111,21 +110,21 @@ mod stories {
Symbol(vec![
HighlightedText {
text: "impl ".to_string(),
color: HighlightColor::Keyword.hsla(&theme),
color: color.syntax.keyword,
},
HighlightedText {
text: "ToolbarStory".to_string(),
color: HighlightColor::Function.hsla(&theme),
color: color.syntax.function,
},
]),
Symbol(vec![
HighlightedText {
text: "fn ".to_string(),
color: HighlightColor::Keyword.hsla(&theme),
color: color.syntax.keyword,
},
HighlightedText {
text: "render".to_string(),
color: HighlightColor::Function.hsla(&theme),
color: color.syntax.function,
},
]),
],

View file

@ -1,7 +1,7 @@
use std::marker::PhantomData;
use crate::prelude::*;
use crate::{theme, SystemColor};
use crate::SystemColor;
#[derive(Clone, Copy)]
enum TrafficLightColor {
@ -34,7 +34,7 @@ impl<S: 'static + Send + Sync> TrafficLight<S> {
(true, TrafficLightColor::Red) => system_color.mac_os_traffic_light_red,
(true, TrafficLightColor::Yellow) => system_color.mac_os_traffic_light_yellow,
(true, TrafficLightColor::Green) => system_color.mac_os_traffic_light_green,
(false, _) => theme.lowest.base.active.background,
(false, _) => color.filled_element,
};
div().w_3().h_3().rounded_full().bg(fill)