{
- let kind = details.kind;
- let settings = ProjectPanelSettings::get_global(cx);
- const INDENT_SIZE: Pixels = px(16.0);
- let padding = INDENT_SIZE + details.depth as f32 * px(settings.indent_size);
- let show_editor = details.is_editing && !details.is_processing;
- let is_selected = self
- .selection
- .map_or(false, |selection| selection.entry_id == entry_id);
-
- Self::render_entry_visual_element(&details, Some(&self.filename_editor), padding, cx)
- .id(entry_id.to_proto() as usize)
- .w_full()
- .cursor_pointer()
- .when(is_selected, |this| {
- this.bg(cx.theme().colors().element_selected)
- })
- .hover(|style| style.bg(cx.theme().colors().element_hover))
.on_click(cx.listener(move |this, event: &gpui::ClickEvent, cx| {
if !show_editor {
if kind.is_dir() {
@@ -1410,12 +1391,9 @@ impl ProjectPanel {
}
}
}))
- .on_mouse_down(
- MouseButton::Right,
- cx.listener(move |this, event: &MouseDownEvent, cx| {
- this.deploy_context_menu(event.position, entry_id, cx);
- }),
- )
+ .on_secondary_mouse_down(cx.listener(move |this, event: &MouseDownEvent, cx| {
+ this.deploy_context_menu(event.position, entry_id, cx);
+ }))
// .on_drop::
(|this, event, cx| {
// this.move_entry(
// *dragged_entry,
diff --git a/crates/storybook2/src/stories/focus.rs b/crates/storybook2/src/stories/focus.rs
index 6f757240ebe21df85f12e0958946f34ab06797e0..77aa057b09407a10e6bf658f7c73c1a4a1c7470a 100644
--- a/crates/storybook2/src/stories/focus.rs
+++ b/crates/storybook2/src/stories/focus.rs
@@ -33,7 +33,6 @@ impl Render for FocusStory {
let theme = cx.theme();
let color_1 = theme.status().created;
let color_2 = theme.status().modified;
- let color_3 = theme.status().deleted;
let color_4 = theme.status().conflict;
let color_5 = theme.status().ignored;
let color_6 = theme.status().renamed;
@@ -42,10 +41,10 @@ impl Render for FocusStory {
.id("parent")
.focusable()
.key_context("parent")
- .on_action(cx.listener(|_, action: &ActionA, cx| {
+ .on_action(cx.listener(|_, _action: &ActionA, _cx| {
println!("Action A dispatched on parent");
}))
- .on_action(cx.listener(|_, action: &ActionB, cx| {
+ .on_action(cx.listener(|_, _action: &ActionB, _cx| {
println!("Action B dispatched on parent");
}))
.on_focus(cx.listener(|_, _, _| println!("Parent focused")))
@@ -61,7 +60,7 @@ impl Render for FocusStory {
div()
.track_focus(&self.child_1_focus)
.key_context("child-1")
- .on_action(cx.listener(|_, action: &ActionB, cx| {
+ .on_action(cx.listener(|_, _action: &ActionB, _cx| {
println!("Action B dispatched on child 1 during");
}))
.w_full()
@@ -83,7 +82,7 @@ impl Render for FocusStory {
div()
.track_focus(&self.child_2_focus)
.key_context("child-2")
- .on_action(cx.listener(|_, action: &ActionC, cx| {
+ .on_action(cx.listener(|_, _action: &ActionC, _cx| {
println!("Action C dispatched on child 2");
}))
.w_full()
diff --git a/crates/storybook2/src/stories/kitchen_sink.rs b/crates/storybook2/src/stories/kitchen_sink.rs
index f79a27aa89f875ae10cfdd12fd15b13192459a54..271285cc2f56263593f2ed0a7691bd5ca649b5e3 100644
--- a/crates/storybook2/src/stories/kitchen_sink.rs
+++ b/crates/storybook2/src/stories/kitchen_sink.rs
@@ -9,7 +9,7 @@ pub struct KitchenSinkStory;
impl KitchenSinkStory {
pub fn view(cx: &mut WindowContext) -> View {
- cx.build_view(|cx| Self)
+ cx.build_view(|_cx| Self)
}
}
diff --git a/crates/storybook2/src/stories/picker.rs b/crates/storybook2/src/stories/picker.rs
index 13822c85459f119a5bbe705da202f078dc6f6781..75eb0d88e792a383d058823a3f3a22473fd9844d 100644
--- a/crates/storybook2/src/stories/picker.rs
+++ b/crates/storybook2/src/stories/picker.rs
@@ -1,11 +1,11 @@
use fuzzy::StringMatchCandidate;
use gpui::{
- div, prelude::*, AnyElement, Div, KeyBinding, Render, SharedString, Styled, Task, View,
- WindowContext,
+ div, prelude::*, Div, KeyBinding, Render, SharedString, Styled, Task, View, WindowContext,
};
use picker::{Picker, PickerDelegate};
use std::sync::Arc;
use theme2::ActiveTheme;
+use ui::{Label, ListItem};
pub struct PickerStory {
picker: View>,
@@ -37,6 +37,8 @@ impl Delegate {
}
impl PickerDelegate for Delegate {
+ type ListItem = ListItem;
+
fn match_count(&self) -> usize {
self.candidates.len()
}
@@ -49,27 +51,20 @@ impl PickerDelegate for Delegate {
&self,
ix: usize,
selected: bool,
- cx: &mut gpui::ViewContext>,
- ) -> AnyElement {
- let colors = cx.theme().colors();
+ _cx: &mut gpui::ViewContext>,
+ ) -> Option {
let Some(candidate_ix) = self.matches.get(ix) else {
- return div().into_any();
+ return None;
};
// TASK: Make StringMatchCandidate::string a SharedString
let candidate = SharedString::from(self.candidates[*candidate_ix].string.clone());
- div()
- .text_color(colors.text)
- .when(selected, |s| {
- s.border_l_10().border_color(colors.terminal_ansi_yellow)
- })
- .hover(|style| {
- style
- .bg(colors.element_active)
- .text_color(colors.text_accent)
- })
- .child(candidate)
- .into_any()
+ Some(
+ ListItem::new(ix)
+ .inset(true)
+ .selected(selected)
+ .child(Label::new(candidate)),
+ )
}
fn selected_index(&self) -> usize {
@@ -81,7 +76,7 @@ impl PickerDelegate for Delegate {
cx.notify();
}
- fn confirm(&mut self, secondary: bool, cx: &mut gpui::ViewContext>) {
+ fn confirm(&mut self, secondary: bool, _cx: &mut gpui::ViewContext>) {
let candidate_ix = self.matches[self.selected_ix];
let candidate = self.candidates[candidate_ix].string.clone();
diff --git a/crates/storybook2/src/stories/scroll.rs b/crates/storybook2/src/stories/scroll.rs
index 9b9a54e1e6736e05183654c51f4fff7ccc69b968..297e65d411ddfecd2cfa1d92d853ad0082e53e00 100644
--- a/crates/storybook2/src/stories/scroll.rs
+++ b/crates/storybook2/src/stories/scroll.rs
@@ -6,7 +6,7 @@ pub struct ScrollStory;
impl ScrollStory {
pub fn view(cx: &mut WindowContext) -> View {
- cx.build_view(|cx| ScrollStory)
+ cx.build_view(|_cx| ScrollStory)
}
}
diff --git a/crates/storybook2/src/stories/text.rs b/crates/storybook2/src/stories/text.rs
index 42009136c414750de416dd3272e82955cb17ef60..3cb39aa01a2122691ed4a337d37e4d6a26c1eb07 100644
--- a/crates/storybook2/src/stories/text.rs
+++ b/crates/storybook2/src/stories/text.rs
@@ -8,7 +8,7 @@ pub struct TextStory;
impl TextStory {
pub fn view(cx: &mut WindowContext) -> View