From deb1187c40eb864f03218d202923ebc779ec00e8 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 30 Jun 2025 11:18:57 +0800 Subject: [PATCH] story: Fix #1017 duplicate action name error. (#1020) --- Cargo.lock | 28 +++--- crates/story/src/button_story.rs | 120 ++++++++++++++++++++----- crates/story/src/color_picker_story.rs | 1 - crates/story/src/drawer_story.rs | 9 +- crates/story/src/dropdown_story.rs | 7 +- crates/story/src/form_story.rs | 4 +- crates/story/src/input_story.rs | 9 +- crates/story/src/lib.rs | 2 + crates/story/src/list_story.rs | 2 +- crates/story/src/menu_story.rs | 4 +- crates/story/src/modal_story.rs | 8 +- crates/story/src/number_input_story.rs | 8 +- crates/story/src/otp_input_story.rs | 9 +- crates/story/src/popover_story.rs | 4 +- crates/story/src/resizable_story.rs | 4 +- crates/story/src/sidebar_story.rs | 2 +- crates/story/src/switch_story.rs | 6 +- crates/story/src/table_story.rs | 4 +- crates/story/src/tabs_story.rs | 5 +- crates/story/src/tag_story.rs | 8 +- crates/story/src/textarea_story.rs | 6 +- crates/story/src/toggle_story.rs | 6 +- crates/story/src/tooltip_story.rs | 2 +- crates/story/src/welcome_story.rs | 6 +- 24 files changed, 164 insertions(+), 100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d066f7dc..cda1761e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -724,7 +724,7 @@ dependencies = [ "bitflags 2.9.1", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.11.0", "lazy_static", "lazycell", "log", @@ -747,7 +747,7 @@ dependencies = [ "bitflags 2.9.1", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.11.0", "log", "prettyplease", "proc-macro2", @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "indexmap 2.9.0", "rustc-hash 2.1.0", @@ -1975,7 +1975,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "proc-macro2", "quote", @@ -3121,7 +3121,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "anyhow", "as-raw-xcb-connection", @@ -3304,7 +3304,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3574,7 +3574,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "anyhow", "bytes", @@ -3591,7 +3591,7 @@ dependencies = [ [[package]] name = "http_client_tls" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "rustls", "rustls-platform-verifier", @@ -4417,7 +4417,7 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "anyhow", "bindgen 0.71.1", @@ -6322,7 +6322,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "derive_refineable", "workspace-hack", @@ -6477,7 +6477,7 @@ dependencies = [ [[package]] name = "reqwest_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "anyhow", "bytes", @@ -7052,7 +7052,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" [[package]] name = "semantic_version" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "anyhow", "serde", @@ -7634,7 +7634,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "arrayvec", "log", @@ -8862,7 +8862,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" +source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35" dependencies = [ "anyhow", "async-fs 2.1.2", diff --git a/crates/story/src/button_story.rs b/crates/story/src/button_story.rs index 6aaa1f44..0a43c032 100644 --- a/crates/story/src/button_story.rs +++ b/crates/story/src/button_story.rs @@ -1,5 +1,5 @@ use gpui::{ - actions, prelude::FluentBuilder, px, App, AppContext as _, ClickEvent, Context, Entity, + prelude::FluentBuilder, px, Action, App, AppContext as _, ClickEvent, Context, Entity, Focusable, InteractiveElement, IntoElement, ParentElement as _, Render, Styled as _, Window, }; @@ -9,10 +9,18 @@ use gpui_component::{ h_flex, indigo, v_flex, white, ActiveTheme, Disableable as _, Icon, IconName, Selectable as _, Sizable as _, Theme, }; +use serde::Deserialize; use crate::section; -actions!(story, [Disabled, Loading, Selected, Compact]); +#[derive(Clone, Action, PartialEq, Eq, Deserialize)] +#[action(namespace = button_story, no_json)] +enum ButtonAction { + Disabled, + Loading, + Selected, + Compact, +} pub struct ButtonStory { focus_handle: gpui::FocusHandle, @@ -100,10 +108,14 @@ impl Render for ButtonStory { }); v_flex() - .on_action(cx.listener(|this, _: &Disabled, _, _| this.disabled = !this.disabled)) - .on_action(cx.listener(|this, _: &Loading, _, _| this.loading = !this.loading)) - .on_action(cx.listener(|this, _: &Selected, _, _| this.selected = !this.selected)) - .on_action(cx.listener(|this, _: &Compact, _, _| this.compact = !this.compact)) + .on_action( + cx.listener(|this, action: &ButtonAction, _, _| match action { + ButtonAction::Disabled => this.disabled = !this.disabled, + ButtonAction::Loading => this.loading = !this.loading, + ButtonAction::Selected => this.selected = !this.selected, + ButtonAction::Compact => this.compact = !this.compact, + }), + ) .gap_6() .child( h_flex() @@ -697,10 +709,26 @@ impl Render for ButtonStory { .button(Button::new("btn").label("Click Me")) .selected(selected) .popup_menu(move |this, _, _| { - this.menu("Disabled", Box::new(Disabled)) - .menu("Loading", Box::new(Loading)) - .menu("Selected", Box::new(Selected)) - .menu("Compact", Box::new(Compact)) + this.menu_with_check( + "Disabled", + disabled, + Box::new(ButtonAction::Disabled), + ) + .menu_with_check( + "Loading", + loading, + Box::new(ButtonAction::Loading), + ) + .menu_with_check( + "Selected", + selected, + Box::new(ButtonAction::Selected), + ) + .menu_with_check( + "Compact", + compact, + Box::new(ButtonAction::Compact), + ) }), ) .child( @@ -708,10 +736,26 @@ impl Render for ButtonStory { .button(Button::new("btn").label("Click Me")) .selected(selected) .popup_menu(move |this, _, _| { - this.menu("Disabled", Box::new(Disabled)) - .menu("Loading", Box::new(Loading)) - .menu("Selected", Box::new(Selected)) - .menu("Compact", Box::new(Compact)) + this.menu_with_check( + "Disabled", + disabled, + Box::new(ButtonAction::Disabled), + ) + .menu_with_check( + "Loading", + loading, + Box::new(ButtonAction::Loading), + ) + .menu_with_check( + "Selected", + selected, + Box::new(ButtonAction::Selected), + ) + .menu_with_check( + "Compact", + compact, + Box::new(ButtonAction::Compact), + ) }), ) .child( @@ -720,10 +764,26 @@ impl Render for ButtonStory { .button(Button::new("btn").label("Outline Dropdown")) .selected(selected) .popup_menu(move |this, _, _| { - this.menu("Disabled", Box::new(Disabled)) - .menu("Loading", Box::new(Loading)) - .menu("Selected", Box::new(Selected)) - .menu("Compact", Box::new(Compact)) + this.menu_with_check( + "Disabled", + disabled, + Box::new(ButtonAction::Disabled), + ) + .menu_with_check( + "Loading", + loading, + Box::new(ButtonAction::Loading), + ) + .menu_with_check( + "Selected", + selected, + Box::new(ButtonAction::Selected), + ) + .menu_with_check( + "Compact", + compact, + Box::new(ButtonAction::Compact), + ) }), ) .child( @@ -732,10 +792,26 @@ impl Render for ButtonStory { .button(Button::new("btn").label("Ghost Dropdown")) .selected(selected) .popup_menu(move |this, _, _| { - this.menu("Disabled", Box::new(Disabled)) - .menu("Loading", Box::new(Loading)) - .menu("Selected", Box::new(Selected)) - .menu("Compact", Box::new(Compact)) + this.menu_with_check( + "Disabled", + disabled, + Box::new(ButtonAction::Disabled), + ) + .menu_with_check( + "Loading", + loading, + Box::new(ButtonAction::Loading), + ) + .menu_with_check( + "Selected", + selected, + Box::new(ButtonAction::Selected), + ) + .menu_with_check( + "Compact", + compact, + Box::new(ButtonAction::Compact), + ) }), ), ) diff --git a/crates/story/src/color_picker_story.rs b/crates/story/src/color_picker_story.rs index effdc424..84dd134e 100644 --- a/crates/story/src/color_picker_story.rs +++ b/crates/story/src/color_picker_story.rs @@ -13,7 +13,6 @@ use crate::section; pub struct ColorPickerStory { color: Entity, selected_color: Option, - _subscriptions: Vec, } diff --git a/crates/story/src/drawer_story.rs b/crates/story/src/drawer_story.rs index a381df42..fe75669e 100644 --- a/crates/story/src/drawer_story.rs +++ b/crates/story/src/drawer_story.rs @@ -2,9 +2,9 @@ use std::{sync::Arc, time::Duration}; use fake::Fake; use gpui::{ - actions, div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, - Focusable, InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, - Task, Timer, WeakEntity, Window, + div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, Focusable, + InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, Task, Timer, + WeakEntity, Window, }; use raw_window_handle::HasWindowHandle; @@ -21,8 +21,7 @@ use gpui_component::{ }; use crate::section; - -actions!(story, [TestAction]); +use crate::TestAction; pub struct ListItemDeletegate { story: WeakEntity, diff --git a/crates/story/src/dropdown_story.rs b/crates/story/src/dropdown_story.rs index 307b589f..3bbf0deb 100644 --- a/crates/story/src/dropdown_story.rs +++ b/crates/story/src/dropdown_story.rs @@ -1,6 +1,6 @@ use gpui::{ - actions, px, App, AppContext, Context, Entity, Focusable, InteractiveElement, IntoElement, - KeyBinding, ParentElement, Render, SharedString, Styled, Window, + px, App, AppContext, Context, Entity, Focusable, InteractiveElement, IntoElement, KeyBinding, + ParentElement, Render, SharedString, Styled, Window, }; use gpui_component::{ @@ -10,8 +10,7 @@ use gpui_component::{ }; use crate::section; - -actions!(story, [Tab, TabPrev]); +use crate::{Tab, TabPrev}; const CONTEXT: &str = "DropdownStory"; pub fn init(cx: &mut App) { diff --git a/crates/story/src/form_story.rs b/crates/story/src/form_story.rs index feea36bc..c02e733e 100644 --- a/crates/story/src/form_story.rs +++ b/crates/story/src/form_story.rs @@ -1,5 +1,5 @@ use gpui::{ - actions, div, prelude::FluentBuilder as _, App, AppContext, Axis, Context, Entity, Focusable, + div, prelude::FluentBuilder as _, App, AppContext, Axis, Context, Entity, Focusable, InteractiveElement, IntoElement, ParentElement as _, Render, Styled, Window, }; use gpui_component::{ @@ -15,8 +15,6 @@ use gpui_component::{ v_flex, AxisExt, FocusableCycle, Selectable, Sizable, Size, }; -actions!(story, [Tab, TabPrev]); - pub struct FormStory { name_input: Entity, email_input: Entity, diff --git a/crates/story/src/input_story.rs b/crates/story/src/input_story.rs index 3d751f00..57b20b4e 100644 --- a/crates/story/src/input_story.rs +++ b/crates/story/src/input_story.rs @@ -1,18 +1,15 @@ use gpui::{ - actions, div, App, AppContext as _, Context, Entity, FocusHandle, Focusable, - InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, Styled, Subscription, - Window, + div, App, AppContext as _, Context, Entity, FocusHandle, Focusable, InteractiveElement, + IntoElement, KeyBinding, ParentElement as _, Render, Styled, Subscription, Window, }; -use crate::section; +use crate::{section, Tab, TabPrev}; use gpui_component::{ button::{Button, ButtonVariants as _}, input::{InputEvent, InputState, MaskPattern, TextInput}, v_flex, ContextModal, FocusableCycle, Icon, IconName, Sizable, }; -actions!(story, [Tab, TabPrev]); - const CONTEXT: &str = "InputStory"; pub fn init(cx: &mut App) { diff --git a/crates/story/src/lib.rs b/crates/story/src/lib.rs index af7928cb..4af91e85 100644 --- a/crates/story/src/lib.rs +++ b/crates/story/src/lib.rs @@ -125,6 +125,8 @@ actions!(story, [Quit, Open, CloseWindow, ToggleSearch]); const PANEL_NAME: &str = "StoryContainer"; +actions!(story, [TestAction, Tab, TabPrev]); + pub struct AppState { pub invisible_panels: Entity>, } diff --git a/crates/story/src/list_story.rs b/crates/story/src/list_story.rs index 2f89ac23..b875a640 100644 --- a/crates/story/src/list_story.rs +++ b/crates/story/src/list_story.rs @@ -16,7 +16,7 @@ use gpui_component::{ v_flex, ActiveTheme, Sizable, }; -actions!(story, [SelectedCompany]); +actions!(list_story, [SelectedCompany]); #[derive(Clone, Default)] struct Company { diff --git a/crates/story/src/menu_story.rs b/crates/story/src/menu_story.rs index ce217fe4..0fc576dd 100644 --- a/crates/story/src/menu_story.rs +++ b/crates/story/src/menu_story.rs @@ -12,10 +12,10 @@ use serde::Deserialize; use crate::section; #[derive(Action, Clone, PartialEq, Deserialize)] -#[action(namespace = story, no_json)] +#[action(namespace = menu_story, no_json)] struct Info(usize); -actions!(story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); +actions!(menu_story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); pub fn init(cx: &mut App) { cx.bind_keys([ diff --git a/crates/story/src/modal_story.rs b/crates/story/src/modal_story.rs index f80e5ec0..04d73d4a 100644 --- a/crates/story/src/modal_story.rs +++ b/crates/story/src/modal_story.rs @@ -1,7 +1,6 @@ use gpui::{ - actions, div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, - Focusable, InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, - Window, + div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, Focusable, + InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, Window, }; use gpui_component::{ @@ -16,8 +15,7 @@ use gpui_component::{ v_flex, ActiveTheme, ContextModal as _, }; -use crate::section; -actions!(story, [TestAction]); +use crate::{section, TestAction}; pub struct ModalStory { focus_handle: FocusHandle, diff --git a/crates/story/src/number_input_story.rs b/crates/story/src/number_input_story.rs index d5b1cf85..3b48949e 100644 --- a/crates/story/src/number_input_story.rs +++ b/crates/story/src/number_input_story.rs @@ -1,18 +1,16 @@ use gpui::{ - actions, App, AppContext as _, Context, Entity, FocusHandle, Focusable, InteractiveElement, - IntoElement, KeyBinding, ParentElement as _, Render, Styled, Subscription, Window, + App, AppContext as _, Context, Entity, FocusHandle, Focusable, InteractiveElement, IntoElement, + KeyBinding, ParentElement as _, Render, Styled, Subscription, Window, }; use regex::Regex; -use crate::section; +use crate::{section, Tab, TabPrev}; use gpui_component::{ button::{Button, ButtonVariants}, input::{InputEvent, InputState, MaskPattern, NumberInput, NumberInputEvent, StepAction}, v_flex, FocusableCycle, IconName, Sizable, }; -actions!(story, [Tab, TabPrev]); - const CONTEXT: &str = "NumberInputStory"; pub fn init(cx: &mut App) { diff --git a/crates/story/src/otp_input_story.rs b/crates/story/src/otp_input_story.rs index 691862b5..29acc744 100644 --- a/crates/story/src/otp_input_story.rs +++ b/crates/story/src/otp_input_story.rs @@ -1,7 +1,7 @@ use gpui::{ - actions, prelude::FluentBuilder as _, px, App, AppContext as _, Context, Entity, FocusHandle, - Focusable, InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, - SharedString, Styled, Subscription, Window, + prelude::FluentBuilder as _, px, App, AppContext as _, Context, Entity, FocusHandle, Focusable, + InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, SharedString, Styled, + Subscription, Window, }; use gpui_component::{ checkbox::Checkbox, @@ -10,8 +10,7 @@ use gpui_component::{ v_flex, FocusableCycle, Sizable, StyledExt, }; -use crate::section; -actions!(story, [Tab, TabPrev]); +use crate::{section, Tab, TabPrev}; const CONTEXT: &str = "OtpInputStory"; diff --git a/crates/story/src/popover_story.rs b/crates/story/src/popover_story.rs index c7deac8d..476130be 100644 --- a/crates/story/src/popover_story.rs +++ b/crates/story/src/popover_story.rs @@ -14,10 +14,10 @@ use gpui_component::{ use serde::Deserialize; #[derive(Action, Clone, PartialEq, Eq, Deserialize)] -#[action(namespace = story, no_json)] +#[action(namespace = popover_story, no_json)] struct Info(usize); -actions!(story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); +actions!(popover_story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); pub fn init(cx: &mut App) { cx.bind_keys([ diff --git a/crates/story/src/resizable_story.rs b/crates/story/src/resizable_story.rs index 37297d0f..736079f1 100644 --- a/crates/story/src/resizable_story.rs +++ b/crates/story/src/resizable_story.rs @@ -1,5 +1,5 @@ use gpui::{ - div, px, AnyElement, App, AppContext, Context, Entity, Focusable, IntoElement, + div, px, AnyElement, App, AppContext, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement as _, Pixels, Render, SharedString, Styled, Window, }; use gpui_component::{ @@ -8,7 +8,7 @@ use gpui_component::{ }; pub struct ResizableStory { - focus_handle: gpui::FocusHandle, + focus_handle: FocusHandle, state1: Entity, state2: Entity, state3: Entity, diff --git a/crates/story/src/sidebar_story.rs b/crates/story/src/sidebar_story.rs index 10f9b554..d3f811fe 100644 --- a/crates/story/src/sidebar_story.rs +++ b/crates/story/src/sidebar_story.rs @@ -22,7 +22,7 @@ use gpui_component::{ use serde::Deserialize; #[derive(Action, Clone, PartialEq, Eq, Deserialize)] -#[action(namespace = story, no_json)] +#[action(namespace = sidebar_story, no_json)] pub struct SelectCompany(SharedString); pub struct SidebarStory { diff --git a/crates/story/src/switch_story.rs b/crates/story/src/switch_story.rs index 87dae4af..5af702fc 100644 --- a/crates/story/src/switch_story.rs +++ b/crates/story/src/switch_story.rs @@ -1,6 +1,6 @@ use gpui::{ - px, App, AppContext, Context, Div, Entity, Focusable, IntoElement, ParentElement, Render, - SharedString, Styled, Window, + px, App, AppContext, Context, Div, Entity, FocusHandle, Focusable, IntoElement, ParentElement, + Render, SharedString, Styled, Window, }; use gpui_component::{ @@ -10,7 +10,7 @@ use gpui_component::{ use crate::section; pub struct SwitchStory { - focus_handle: gpui::FocusHandle, + focus_handle: FocusHandle, switch1: bool, switch2: bool, switch3: bool, diff --git a/crates/story/src/table_story.rs b/crates/story/src/table_story.rs index 371c2cc2..6df0f734 100644 --- a/crates/story/src/table_story.rs +++ b/crates/story/src/table_story.rs @@ -24,11 +24,11 @@ use gpui_component::{ use serde::Deserialize; #[derive(Action, Clone, PartialEq, Eq, Deserialize)] -#[action(namespace = story, no_json)] +#[action(namespace = table_story, no_json)] struct ChangeSize(Size); #[derive(Action, Clone, PartialEq, Eq, Deserialize)] -#[action(namespace = story, no_json)] +#[action(namespace = table_story, no_json)] struct OpenDetail(usize); #[derive(Clone, Debug, Default)] diff --git a/crates/story/src/tabs_story.rs b/crates/story/src/tabs_story.rs index 9a705b23..85600e93 100644 --- a/crates/story/src/tabs_story.rs +++ b/crates/story/src/tabs_story.rs @@ -1,5 +1,6 @@ use gpui::{ - App, AppContext, Context, Entity, Focusable, IntoElement, ParentElement, Render, Styled, Window, + App, AppContext, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement, Render, + Styled, Window, }; use gpui_component::{ @@ -13,7 +14,7 @@ use gpui_component::{ use crate::section; pub struct TabsStory { - focus_handle: gpui::FocusHandle, + focus_handle: FocusHandle, active_tab_ix: usize, size: Size, menu: bool, diff --git a/crates/story/src/tag_story.rs b/crates/story/src/tag_story.rs index 564e2c44..fa487131 100644 --- a/crates/story/src/tag_story.rs +++ b/crates/story/src/tag_story.rs @@ -1,6 +1,6 @@ use gpui::{ - px, App, AppContext, Context, Entity, Focusable, IntoElement, ParentElement, Render, Styled, - Window, + px, App, AppContext, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement, + Render, Styled, Window, }; use gpui_component::{h_flex, indigo_50, indigo_500, tag::Tag, v_flex, ColorName, Sizable}; @@ -8,7 +8,7 @@ use gpui_component::{h_flex, indigo_50, indigo_500, tag::Tag, v_flex, ColorName, use crate::section; pub struct TagStory { - focus_handle: gpui::FocusHandle, + focus_handle: FocusHandle, } impl super::Story for TagStory { @@ -37,7 +37,7 @@ impl TagStory { } } impl Focusable for TagStory { - fn focus_handle(&self, _: &gpui::App) -> gpui::FocusHandle { + fn focus_handle(&self, _: &App) -> FocusHandle { self.focus_handle.clone() } } diff --git a/crates/story/src/textarea_story.rs b/crates/story/src/textarea_story.rs index d1c99355..b1f8cca5 100644 --- a/crates/story/src/textarea_story.rs +++ b/crates/story/src/textarea_story.rs @@ -1,9 +1,9 @@ use gpui::{ - actions, px, App, AppContext as _, ClickEvent, Context, Entity, FocusHandle, Focusable, + px, App, AppContext as _, ClickEvent, Context, Entity, FocusHandle, Focusable, InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, Styled, Window, }; -use crate::section; +use crate::{section, Tab, TabPrev}; use gpui_component::{ button::Button, h_flex, @@ -11,8 +11,6 @@ use gpui_component::{ v_flex, FocusableCycle, Sizable, }; -actions!(story, [Tab, TabPrev]); - const CONTEXT: &str = "TextareaStory"; pub fn init(cx: &mut App) { diff --git a/crates/story/src/toggle_story.rs b/crates/story/src/toggle_story.rs index 37783e6b..eb88dc2c 100644 --- a/crates/story/src/toggle_story.rs +++ b/crates/story/src/toggle_story.rs @@ -1,5 +1,5 @@ use gpui::{ - actions, App, AppContext as _, Context, Entity, Focusable, IntoElement, ParentElement as _, + App, AppContext as _, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement as _, Render, Styled as _, Window, }; @@ -8,10 +8,8 @@ use gpui_component::{ h_flex, v_flex, IconName, Sizable, }; -actions!(story, [Disabled, Loading, Selected, Compact]); - pub struct ToggleStory { - focus_handle: gpui::FocusHandle, + focus_handle: FocusHandle, single_toggle: usize, checked: Vec, } diff --git a/crates/story/src/tooltip_story.rs b/crates/story/src/tooltip_story.rs index 81f0ff6b..10325e64 100644 --- a/crates/story/src/tooltip_story.rs +++ b/crates/story/src/tooltip_story.rs @@ -16,7 +16,7 @@ use gpui_component::{ use crate::{section, Story}; -actions!(story, [Info]); +actions!(tooltip_story, [Info]); pub fn init(cx: &mut App) { cx.bind_keys([KeyBinding::new("ctrl-shift-delete", Info, Some("Tooltip"))]); diff --git a/crates/story/src/welcome_story.rs b/crates/story/src/welcome_story.rs index dff1b4f2..296f1d7d 100644 --- a/crates/story/src/welcome_story.rs +++ b/crates/story/src/welcome_story.rs @@ -1,11 +1,13 @@ -use gpui::{App, AppContext, Context, Entity, Focusable, ParentElement, Render, Styled, Window}; +use gpui::{ + App, AppContext, Context, Entity, FocusHandle, Focusable, ParentElement, Render, Styled, Window, +}; use gpui_component::{dock::PanelControl, text::TextView, v_flex}; use crate::Story; pub struct WelcomeStory { - focus_handle: gpui::FocusHandle, + focus_handle: FocusHandle, } impl WelcomeStory {