diff --git a/assets/settings/default.json b/assets/settings/default.json index 2ddf4a137f..08faedbed6 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -126,7 +126,7 @@ // Whether to show the collaboration panel button in the status bar. "button": true, // Where to dock channels panel. Can be 'left' or 'right'. - "dock": "right", + "dock": "left", // Default width of the channels panel. "default_width": 240 }, diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 0e7bd5f929..fb0547cd44 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -2354,7 +2354,7 @@ impl View for CollabPanel { .into_any() }) .on_click(MouseButton::Left, |_, _, cx| cx.focus_self()) - .into_any_named("channels panel") + .into_any_named("collab panel") } } @@ -2404,7 +2404,10 @@ impl Panel for CollabPanel { } fn icon_tooltip(&self) -> (String, Option>) { - ("Channels Panel".to_string(), Some(Box::new(ToggleFocus))) + ( + "Collaboration Panel".to_string(), + Some(Box::new(ToggleFocus)), + ) } fn should_change_position_on_event(event: &Self::Event) -> bool { diff --git a/crates/gpui/examples/components.rs b/crates/gpui/examples/components.rs index cf695ea834..ad38b5893c 100644 --- a/crates/gpui/examples/components.rs +++ b/crates/gpui/examples/components.rs @@ -72,7 +72,7 @@ impl View for TestView { TextStyle::for_color(Color::blue()), ) .with_style(ButtonStyle::fill(Color::yellow())) - .into_element(), + .element(), ) .with_child( ToggleableButton::new(self.is_doubling, move |_, v: &mut Self, cx| { @@ -84,7 +84,7 @@ impl View for TestView { inactive: ButtonStyle::fill(Color::red()), active: ButtonStyle::fill(Color::green()), }) - .into_element(), + .element(), ) .expanded() .contained() diff --git a/crates/gpui/src/elements/component.rs b/crates/gpui/src/elements/component.rs index a26355a539..035637c377 100644 --- a/crates/gpui/src/elements/component.rs +++ b/crates/gpui/src/elements/component.rs @@ -9,6 +9,12 @@ use super::Empty; pub trait GeneralComponent { fn render(self, v: &mut V, cx: &mut ViewContext) -> AnyElement; + fn element(self) -> ComponentAdapter + where + Self: Sized, + { + ComponentAdapter::new(self) + } } pub trait StyleableComponent { @@ -50,6 +56,53 @@ impl Component for C { } } +// StylableComponent -> GeneralComponent +pub struct StylableComponentAdapter, V: View> { + component: C, + phantom: std::marker::PhantomData, +} + +impl, V: View> StylableComponentAdapter { + fn new(component: C) -> Self { + Self { + component, + phantom: std::marker::PhantomData, + } + } +} + +impl StyleableComponent for StylableComponentAdapter { + type Style = (); + + type Output = C; + + fn with_style(self, _: Self::Style) -> Self::Output { + self.component + } +} + +// Element -> Component +pub struct ElementAdapter { + element: AnyElement, + _phantom: std::marker::PhantomData, +} + +impl ElementAdapter { + pub fn new(element: AnyElement) -> Self { + Self { + element, + _phantom: std::marker::PhantomData, + } + } +} + +impl Component for ElementAdapter { + fn render(self, _: &mut V, _: &mut ViewContext) -> AnyElement { + self.element + } +} + +// Component -> Element pub struct ComponentAdapter { component: Option, element: Option>, diff --git a/styles/src/style_tree/collab_panel.ts b/styles/src/style_tree/collab_panel.ts index 7f0fd5f423..a102ee7691 100644 --- a/styles/src/style_tree/collab_panel.ts +++ b/styles/src/style_tree/collab_panel.ts @@ -37,7 +37,7 @@ export default function contacts_panel(): any { width: 14, }, name: { - ...text(layer, "ui_sans", { size: "sm" }), + ...text(layer, "sans", { size: "sm" }), margin: { left: NAME_MARGIN, right: 4, @@ -69,7 +69,7 @@ export default function contacts_panel(): any { const subheader_row = toggleable({ base: interactive({ base: { - ...text(layer, "ui_sans", { size: "sm" }), + ...text(layer, "sans", { size: "sm" }), padding: { left: SPACING, right: SPACING, @@ -87,7 +87,7 @@ export default function contacts_panel(): any { state: { active: { default: { - ...text(theme.lowest, "ui_sans", { size: "sm" }), + ...text(theme.lowest, "sans", { size: "sm" }), background: background(theme.lowest), }, clicked: { @@ -100,8 +100,8 @@ export default function contacts_panel(): any { const filter_input = { background: background(layer, "on"), corner_radius: 6, - text: text(layer, "ui_sans", "base"), - placeholder_text: text(layer, "ui_sans", "base", "disabled", { + text: text(layer, "sans", "base"), + placeholder_text: text(layer, "sans", "base", "disabled", { size: "xs", }), selection: theme.players[0], @@ -140,7 +140,7 @@ export default function contacts_panel(): any { }, active: { default: { - ...text(theme.lowest, "ui_sans", { size: "sm" }), + ...text(theme.lowest, "sans", { size: "sm" }), background: background(theme.lowest), }, clicked: { @@ -194,10 +194,10 @@ export default function contacts_panel(): any { add_channel_button: header_icon_button, leave_call_button: header_icon_button, row_height: ITEM_HEIGHT, - channel_indent: INDENT_SIZE, + channel_indent: INDENT_SIZE * 2, section_icon_size: 14, header_row: { - ...text(layer, "ui_sans", { size: "sm", weight: "bold" }), + ...text(layer, "sans", { size: "sm", weight: "bold" }), margin: { top: SPACING }, padding: { left: SPACING, @@ -251,7 +251,7 @@ export default function contacts_panel(): any { }, active: { default: { - ...text(theme.lowest, "ui_sans", { size: "sm" }), + ...text(theme.lowest, "sans", { size: "sm" }), background: background(theme.lowest), }, clicked: { @@ -262,7 +262,7 @@ export default function contacts_panel(): any { }), channel_row: item_row, channel_name: { - ...text(layer, "ui_sans", { size: "sm" }), + ...text(layer, "sans", { size: "sm" }), margin: { left: NAME_MARGIN, }, @@ -279,7 +279,7 @@ export default function contacts_panel(): any { list_empty_state: toggleable({ base: interactive({ base: { - ...text(layer, "ui_sans", "variant", { size: "sm" }), + ...text(layer, "sans", "variant", { size: "sm" }), padding: { top: SPACING / 2, bottom: SPACING / 2, @@ -301,7 +301,7 @@ export default function contacts_panel(): any { }, active: { default: { - ...text(theme.lowest, "ui_sans", { size: "sm" }), + ...text(theme.lowest, "sans", { size: "sm" }), background: background(theme.lowest), }, clicked: { @@ -325,12 +325,12 @@ export default function contacts_panel(): any { right: 4, }, background: background(layer, "hovered"), - ...text(layer, "ui_sans", "hovered", { size: "xs" }) + ...text(layer, "sans", "hovered", { size: "xs" }) }, contact_status_free: indicator({ layer, color: "positive" }), contact_status_busy: indicator({ layer, color: "negative" }), contact_username: { - ...text(layer, "ui_sans", { size: "sm" }), + ...text(layer, "sans", { size: "sm" }), margin: { left: NAME_MARGIN, }, @@ -347,7 +347,7 @@ export default function contacts_panel(): any { color: foreground(layer, "on"), }, calling_indicator: { - ...text(layer, "mono", "variant", { size: "xs" }), + ...text(layer, "sans", "variant", { size: "xs" }), }, tree_branch: toggleable({ base: interactive({ @@ -380,7 +380,7 @@ export default function contacts_panel(): any { }, name: { ...project_row.name, - ...text(layer, "mono", { size: "sm" }), + ...text(layer, "sans", { size: "sm" }), }, }, state: { diff --git a/styles/src/style_tree/context_menu.ts b/styles/src/style_tree/context_menu.ts index 84688c0971..2225cee527 100644 --- a/styles/src/style_tree/context_menu.ts +++ b/styles/src/style_tree/context_menu.ts @@ -19,7 +19,7 @@ export default function context_menu(): any { icon_width: 14, padding: { left: 6, right: 6, top: 2, bottom: 2 }, corner_radius: 6, - label: text(theme.middle, "ui_sans", { size: "sm" }), + label: text(theme.middle, "sans", { size: "sm" }), keystroke: { ...text(theme.middle, "sans", "variant", { size: "sm",