Extend tooltip to take meta + kb

This commit is contained in:
Nate Butler 2023-11-14 12:59:53 -05:00
parent 5ae96e4eb6
commit 251b4640c6
2 changed files with 63 additions and 13 deletions

View file

@ -69,7 +69,7 @@ use std::{
};
use theme2::ActiveTheme;
pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
use ui::{h_stack, Button, ButtonVariant, Label, LabelColor};
use ui::{h_stack, Button, ButtonVariant, Label, LabelColor, TextTooltip};
use util::ResultExt;
use uuid::Uuid;
use workspace_settings::{AutosaveSetting, WorkspaceSettings};
@ -2660,17 +2660,42 @@ impl Workspace {
h_stack()
// TODO - Add player menu
.child(
Button::new("player")
.variant(ButtonVariant::Ghost)
.color(Some(LabelColor::Player(0))),
div()
.id("project_owner_indicator")
.child(
Button::new("player")
.variant(ButtonVariant::Ghost)
.color(Some(LabelColor::Player(0))),
)
.tooltip(move |_, cx| {
cx.build_view(|cx| TextTooltip::new("Toggle following"))
}),
)
// TODO - Add project menu
.child(Button::new("project_name").variant(ButtonVariant::Ghost))
.child(
div()
.id("titlebar_project_menu_button")
.child(Button::new("project_name").variant(ButtonVariant::Ghost))
.tooltip(move |_, cx| {
cx.build_view(|cx| TextTooltip::new("Recent Projects"))
}),
)
// TODO - Add git menu
.child(
Button::new("branch_name")
.variant(ButtonVariant::Ghost)
.color(Some(LabelColor::Muted)),
div()
.id("titlebar_git_menu_button")
.child(
Button::new("branch_name")
.variant(ButtonVariant::Ghost)
.color(Some(LabelColor::Muted)),
)
.tooltip(move |_, cx| {
cx.build_view(|cx| {
TextTooltip::new("Recent Branches")
.keybinding("⌘B")
.meta("Only local branches shown")
})
}),
),
) // self.titlebar_item
.child(h_stack().child(Label::new("Right side titlebar item")))