WIP UI Tweaks (#2911)

- Tighten up toolbar
- Reduce intensity of active tools
- Remove divider between project + branch
- Add a styletree for toolbar + move breadcrumb into it
- Some ts theme tidying

[[PR Description]]

Release Notes:

- Improved density and contrast of a number of UI elements.
This commit is contained in:
Nate Butler
2023-08-30 11:19:05 -04:00
committed by GitHub
38 changed files with 493 additions and 372 deletions
+4 -4
View File
@@ -50,7 +50,7 @@ impl View for Breadcrumbs {
let not_editor = active_item.downcast::<editor::Editor>().is_none();
let theme = theme::current(cx).clone();
let style = &theme.workspace.breadcrumbs;
let style = &theme.workspace.toolbar.breadcrumbs;
let breadcrumbs = match active_item.breadcrumbs(&theme, cx) {
Some(breadcrumbs) => breadcrumbs,
@@ -60,7 +60,7 @@ impl View for Breadcrumbs {
.map(|breadcrumb| {
Text::new(
breadcrumb.text,
theme.workspace.breadcrumbs.default.text.clone(),
theme.workspace.toolbar.breadcrumbs.default.text.clone(),
)
.with_highlights(breadcrumb.highlights.unwrap_or_default())
.into_any()
@@ -68,10 +68,10 @@ impl View for Breadcrumbs {
let crumbs = Flex::row()
.with_children(Itertools::intersperse_with(breadcrumbs, || {
Label::new(" 〉 ", style.default.text.clone()).into_any()
Label::new(" › ", style.default.text.clone()).into_any()
}))
.constrained()
.with_height(theme.workspace.breadcrumb_height)
.with_height(theme.workspace.toolbar.breadcrumb_height)
.contained();
if not_editor || !self.pane_focused {
+31 -44
View File
@@ -213,7 +213,6 @@ impl CollabTitlebarItem {
.map(|branch| util::truncate_and_trailoff(&branch, MAX_BRANCH_NAME_LENGTH));
let project_style = theme.titlebar.project_menu_button.clone();
let git_style = theme.titlebar.git_menu_button.clone();
let divider_style = theme.titlebar.project_name_divider.clone();
let item_spacing = theme.titlebar.item_spacing;
let mut ret = Flex::row().with_child(
@@ -248,49 +247,37 @@ impl CollabTitlebarItem {
);
if let Some(git_branch) = branch_prepended {
ret = ret.with_child(
Flex::row()
.with_child(
Label::new("/", divider_style.text)
.contained()
.with_style(divider_style.container)
.aligned()
.left(),
)
.with_child(
Stack::new()
.with_child(
MouseEventHandler::new::<ToggleVcsMenu, _>(
0,
cx,
|mouse_state, cx| {
enum BranchPopoverTooltip {}
let style = git_style
.in_state(self.branch_popover.is_some())
.style_for(mouse_state);
Label::new(git_branch, style.text.clone())
.contained()
.with_style(style.container.clone())
.with_margin_right(item_spacing)
.aligned()
.left()
.with_tooltip::<BranchPopoverTooltip>(
0,
"Recent branches",
Some(Box::new(ToggleVcsMenu)),
theme.tooltip.clone(),
cx,
)
.into_any_named("title-project-branch")
},
)
.with_cursor_style(CursorStyle::PointingHand)
.on_down(MouseButton::Left, move |_, this, cx| {
this.toggle_vcs_menu(&Default::default(), cx)
})
.on_click(MouseButton::Left, move |_, _, _| {}),
)
.with_children(self.render_branches_popover_host(&theme.titlebar, cx)),
),
Flex::row().with_child(
Stack::new()
.with_child(
MouseEventHandler::new::<ToggleVcsMenu, _>(0, cx, |mouse_state, cx| {
enum BranchPopoverTooltip {}
let style = git_style
.in_state(self.branch_popover.is_some())
.style_for(mouse_state);
Label::new(git_branch, style.text.clone())
.contained()
.with_style(style.container.clone())
.with_margin_right(item_spacing)
.aligned()
.left()
.with_tooltip::<BranchPopoverTooltip>(
0,
"Recent branches",
Some(Box::new(ToggleVcsMenu)),
theme.tooltip.clone(),
cx,
)
.into_any_named("title-project-branch")
})
.with_cursor_style(CursorStyle::PointingHand)
.on_down(MouseButton::Left, move |_, this, cx| {
this.toggle_vcs_menu(&Default::default(), cx)
})
.on_click(MouseButton::Left, move |_, _, _| {}),
)
.with_children(self.render_branches_popover_host(&theme.titlebar, cx)),
),
)
}
ret.into_any()
+2 -3
View File
@@ -88,8 +88,6 @@ pub struct Workspace {
pub dock: Dock,
pub status_bar: StatusBar,
pub toolbar: Toolbar,
pub breadcrumb_height: f32,
pub breadcrumbs: Interactive<ContainedText>,
pub disconnected_overlay: ContainedText,
pub modal: ContainerStyle,
pub zoomed_panel_foreground: ContainerStyle,
@@ -120,7 +118,6 @@ pub struct Titlebar {
pub height: f32,
pub menu: TitlebarMenu,
pub project_menu_button: Toggleable<Interactive<ContainedText>>,
pub project_name_divider: ContainedText,
pub git_menu_button: Toggleable<Interactive<ContainedText>>,
pub item_spacing: f32,
pub face_pile_spacing: f32,
@@ -411,6 +408,8 @@ pub struct Toolbar {
pub height: f32,
pub item_spacing: f32,
pub toggleable_tool: Toggleable<Interactive<IconButton>>,
pub breadcrumb_height: f32,
pub breadcrumbs: Interactive<ContainedText>,
}
#[derive(Clone, Deserialize, Default, JsonSchema)]