Move PopoverButton
into ui
(#25724)
This PR moves the `PopoverButton` component into the `ui` crate. The `popover_button` crate only depended on `ui`, so there doesn't seem to be a need for it to live in its own crate and add another step in the crate graph. Release Notes: - N/A
This commit is contained in:
parent
3505a17452
commit
da22f21dec
11 changed files with 13 additions and 47 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -5412,7 +5412,6 @@ dependencies = [
|
|||
"multi_buffer",
|
||||
"panel",
|
||||
"picker",
|
||||
"popover_button",
|
||||
"postage",
|
||||
"project",
|
||||
"schemars",
|
||||
|
@ -7047,7 +7046,6 @@ dependencies = [
|
|||
"language_model",
|
||||
"log",
|
||||
"picker",
|
||||
"popover_button",
|
||||
"proto",
|
||||
"ui",
|
||||
"workspace",
|
||||
|
@ -10012,14 +10010,6 @@ version = "0.2.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7"
|
||||
|
||||
[[package]]
|
||||
name = "popover_button"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"gpui",
|
||||
"ui",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "postage"
|
||||
version = "0.5.0"
|
||||
|
|
|
@ -98,7 +98,6 @@ members = [
|
|||
"crates/panel",
|
||||
"crates/paths",
|
||||
"crates/picker",
|
||||
"crates/popover_button",
|
||||
"crates/prettier",
|
||||
"crates/project",
|
||||
"crates/project_panel",
|
||||
|
@ -302,7 +301,6 @@ outline_panel = { path = "crates/outline_panel" }
|
|||
paths = { path = "crates/paths" }
|
||||
panel = { path = "crates/panel" }
|
||||
picker = { path = "crates/picker" }
|
||||
popover_button = { path = "crates/popover_button" }
|
||||
plugin = { path = "crates/plugin" }
|
||||
plugin_macros = { path = "crates/plugin_macros" }
|
||||
prettier = { path = "crates/prettier" }
|
||||
|
|
|
@ -33,7 +33,6 @@ menu.workspace = true
|
|||
multi_buffer.workspace = true
|
||||
panel.workspace = true
|
||||
picker.workspace = true
|
||||
popover_button.workspace = true
|
||||
postage.workspace = true
|
||||
project.workspace = true
|
||||
schemars.workspace = true
|
||||
|
|
|
@ -10,7 +10,9 @@ use gpui::{
|
|||
use picker::{Picker, PickerDelegate};
|
||||
use project::{Project, ProjectPath};
|
||||
use std::sync::Arc;
|
||||
use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing, PopoverMenuHandle};
|
||||
use ui::{
|
||||
prelude::*, HighlightedLabel, ListItem, ListItemSpacing, PopoverMenuHandle, TriggerablePopover,
|
||||
};
|
||||
use util::ResultExt;
|
||||
use workspace::notifications::DetachAndPromptErr;
|
||||
use workspace::{ModalView, Workspace};
|
||||
|
@ -78,7 +80,7 @@ pub struct BranchList {
|
|||
_subscription: Option<Subscription>,
|
||||
}
|
||||
|
||||
impl popover_button::TriggerablePopover for BranchList {
|
||||
impl TriggerablePopover for BranchList {
|
||||
fn menu_handle(
|
||||
&mut self,
|
||||
_window: &mut Window,
|
||||
|
|
|
@ -4,9 +4,8 @@ use crate::branch_picker::{self, BranchList};
|
|||
use crate::git_panel::{commit_message_editor, GitPanel};
|
||||
use git::Commit;
|
||||
use panel::{panel_button, panel_editor_style, panel_filled_button};
|
||||
use popover_button::TriggerablePopover;
|
||||
use project::Project;
|
||||
use ui::{prelude::*, KeybindingHint, Tooltip};
|
||||
use ui::{prelude::*, KeybindingHint, PopoverButton, Tooltip, TriggerablePopover};
|
||||
|
||||
use editor::{Editor, EditorElement};
|
||||
use gpui::*;
|
||||
|
@ -288,7 +287,7 @@ impl CommitModal {
|
|||
}))
|
||||
.style(ButtonStyle::Transparent);
|
||||
|
||||
let branch_picker = popover_button::PopoverButton::new(
|
||||
let branch_picker = PopoverButton::new(
|
||||
self.branch_list.clone(),
|
||||
Corner::BottomLeft,
|
||||
branch_picker_button,
|
||||
|
|
|
@ -17,7 +17,6 @@ gpui.workspace = true
|
|||
language_model.workspace = true
|
||||
log.workspace = true
|
||||
picker.workspace = true
|
||||
popover_button.workspace = true
|
||||
proto.workspace = true
|
||||
ui.workspace = true
|
||||
workspace.workspace = true
|
||||
|
|
|
@ -9,10 +9,10 @@ use language_model::{
|
|||
AuthenticateError, LanguageModel, LanguageModelAvailability, LanguageModelRegistry,
|
||||
};
|
||||
use picker::{Picker, PickerDelegate};
|
||||
use popover_button::{PopoverButton, TriggerablePopover};
|
||||
use proto::Plan;
|
||||
use ui::{
|
||||
prelude::*, ButtonLike, IconButtonShape, ListItem, ListItemSpacing, PopoverMenuHandle, Tooltip,
|
||||
prelude::*, ButtonLike, IconButtonShape, ListItem, ListItemSpacing, PopoverButton,
|
||||
PopoverMenuHandle, Tooltip, TriggerablePopover,
|
||||
};
|
||||
use workspace::ShowConfiguration;
|
||||
|
||||
|
@ -555,7 +555,7 @@ impl RenderOnce for AssistantLanguageModelSelector {
|
|||
_ => SharedString::from("No model selected"),
|
||||
};
|
||||
|
||||
popover_button::PopoverButton::new(
|
||||
PopoverButton::new(
|
||||
self.selector.clone(),
|
||||
Corner::BottomRight,
|
||||
ButtonLike::new("active-model")
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
[package]
|
||||
name = "popover_button"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
publish.workspace = true
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
path = "src/popover_button.rs"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
[dependencies]
|
||||
gpui.workspace = true
|
||||
ui.workspace = true
|
|
@ -1 +0,0 @@
|
|||
../../LICENSE-GPL
|
|
@ -19,6 +19,7 @@ mod modal;
|
|||
mod navigable;
|
||||
mod numeric_stepper;
|
||||
mod popover;
|
||||
mod popover_button;
|
||||
mod popover_menu;
|
||||
mod radio;
|
||||
mod right_click_menu;
|
||||
|
@ -56,6 +57,7 @@ pub use modal::*;
|
|||
pub use navigable::*;
|
||||
pub use numeric_stepper::*;
|
||||
pub use popover::*;
|
||||
pub use popover_button::*;
|
||||
pub use popover_menu::*;
|
||||
pub use radio::*;
|
||||
pub use right_click_menu::*;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use gpui::{AnyView, Corner, Entity, ManagedView};
|
||||
use ui::{
|
||||
px, App, ButtonCommon, IntoElement, PopoverMenu, PopoverMenuHandle, PopoverTrigger, RenderOnce,
|
||||
Window,
|
||||
};
|
||||
|
||||
use crate::{prelude::*, PopoverMenu, PopoverMenuHandle, PopoverTrigger};
|
||||
|
||||
pub trait TriggerablePopover: ManagedView {
|
||||
fn menu_handle(
|
||||
|
@ -12,7 +10,6 @@ pub trait TriggerablePopover: ManagedView {
|
|||
) -> PopoverMenuHandle<Self>;
|
||||
}
|
||||
|
||||
// We want a button, that tells us what parameters to pass, and that "just works" after that
|
||||
pub struct PopoverButton<T, B, F> {
|
||||
selector: Entity<T>,
|
||||
button: B,
|
Loading…
Add table
Add a link
Reference in a new issue