Skip to content

Commit a87eafe

Browse files
Delete the dead code the flag retirement orphaned
Collapsing the OpenWarpNewSettingsModes call sites removed the only callers of the widgets and renderers that lived in the flag's disabled branch, so they became unreachable and `cargo build` flagged all seven under dead_code. Each has a live replacement that the enabled branch already routed to: the external-editor and auto-open-code-review-pane controls now live on the Editor and Code Review settings page, and the anonymous-user sign-up affordances were dropped from the tab bar and the terminal banner when the flag rolled out. Removes the widgets, the field and view they read, the two tab-bar renderers, the banner inserter, the mouse states behind them, and the imports left unused.
1 parent c435eda commit a87eafe

6 files changed

Lines changed: 6 additions & 246 deletions

File tree

app/src/settings_view/appearance_page.rs

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ use crate::workspace::WorkspaceAction;
9191
use crate::workspace::header_toolbar_editor::HeaderToolbarInlineEditor;
9292
use crate::workspace::tab_settings::{
9393
DirectoryTabColor, HideTitleBarSearchBarInVerticalTabs, PreserveActiveTabColor,
94-
ShowCodeReviewButton, ShowIndicatorsButton, ShowVerticalTabPanelInRestoredWindows,
95-
TabCloseButtonPosition, TabSettings, TabSettingsChangedEvent,
96-
UseLatestUserPromptAsConversationTitleInTabNames, UseVerticalTabs,
97-
WorkspaceDecorationVisibility, canonical_directory_key,
94+
ShowIndicatorsButton, ShowVerticalTabPanelInRestoredWindows, TabCloseButtonPosition,
95+
TabSettings, TabSettingsChangedEvent, UseLatestUserPromptAsConversationTitleInTabNames,
96+
UseVerticalTabs, WorkspaceDecorationVisibility, canonical_directory_key,
9897
};
9998
use crate::{send_telemetry_from_ctx, themes};
10099

@@ -4865,51 +4864,6 @@ impl SettingsWidget for TabIndicatorWidget {
48654864
}
48664865
}
48674866

4868-
#[derive(Default)]
4869-
struct CodeReviewButtonWidget {
4870-
switch_state: SwitchStateHandle,
4871-
}
4872-
4873-
impl SettingsWidget for CodeReviewButtonWidget {
4874-
type View = AppearanceSettingsPageView;
4875-
4876-
fn search_terms(&self) -> &str {
4877-
"code review button tab bar"
4878-
}
4879-
4880-
fn render(
4881-
&self,
4882-
view: &Self::View,
4883-
appearance: &Appearance,
4884-
app: &AppContext,
4885-
) -> Box<dyn Element> {
4886-
let tab_settings = TabSettings::as_ref(app);
4887-
4888-
render_body_item::<AppearancePageAction>(
4889-
"Show code review button".into(),
4890-
None,
4891-
LocalOnlyIconState::for_setting(
4892-
ShowCodeReviewButton::storage_key(),
4893-
ShowCodeReviewButton::sync_to_cloud(),
4894-
&mut view.local_only_icon_tooltip_states.borrow_mut(),
4895-
app,
4896-
),
4897-
ToggleState::Enabled,
4898-
appearance,
4899-
appearance
4900-
.ui_builder()
4901-
.switch(self.switch_state.clone())
4902-
.check(*tab_settings.show_code_review_button)
4903-
.build()
4904-
.on_click(move |ctx, _, _| {
4905-
ctx.dispatch_typed_action(AppearancePageAction::ToggleShowCodeReviewButton);
4906-
})
4907-
.finish(),
4908-
None,
4909-
)
4910-
}
4911-
}
4912-
49134867
#[derive(Default)]
49144868
struct PreserveActiveTabColorWidget {
49154869
switch_state: SwitchStateHandle,

app/src/settings_view/features/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub use undo_close::UndoCloseView;
44
cfg_if::cfg_if! {
55
if #[cfg(feature = "local_fs")] {
66
pub mod external_editor;
7-
pub use external_editor::ExternalEditorView;
87
}
98
}
109

app/src/settings_view/features_page.rs

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ use crate::terminal::alt_screen_reporting::{
8282
AltScreenReporting, FocusReportingEnabled, MouseReportingEnabled, ScrollReportingEnabled,
8383
};
8484
use crate::terminal::general_settings::{
85-
AutoOpenCodeReviewPaneOnFirstAgentChange, GeneralSettings, LinkTooltip, LoginItem,
86-
QuitOnLastWindowClosed, RestoreSession, ShowWarningBeforeQuitting,
85+
GeneralSettings, LinkTooltip, LoginItem, QuitOnLastWindowClosed, RestoreSession,
86+
ShowWarningBeforeQuitting,
8787
};
8888
use crate::terminal::input::OPEN_COMPLETIONS_KEYBINDING_NAME;
8989
use crate::terminal::keys_settings::{
@@ -1419,8 +1419,6 @@ pub struct FeaturesPageView {
14191419
mouse_scroll_input_editor: ViewHandle<EditorView>,
14201420
valid_mouse_scroll_multiplier: bool,
14211421

1422-
#[cfg(feature = "local_fs")]
1423-
external_editor_view: ViewHandle<features::ExternalEditorView>,
14241422
word_boundary_editor: ViewHandle<EditorView>,
14251423

14261424
tab_behavior_dropdown: ViewHandle<Dropdown<FeaturesPageAction>>,
@@ -2466,9 +2464,6 @@ impl FeaturesPageView {
24662464
}
24672465
});
24682466

2469-
#[cfg(feature = "local_fs")]
2470-
let external_editor_view = ctx.add_typed_action_view(features::ExternalEditorView::new);
2471-
24722467
let global_hotkey_mode =
24732468
KeysSettings::handle(ctx).read(ctx, |settings, ctx| settings.global_hotkey_mode(ctx));
24742469
let global_hotkey_dropdown = ctx.add_typed_action_view(|ctx| {
@@ -2730,8 +2725,6 @@ impl FeaturesPageView {
27302725
max_block_size_input_editor: block_size_editor,
27312726
valid_max_block_size: true,
27322727

2733-
#[cfg(feature = "local_fs")]
2734-
external_editor_view,
27352728
word_boundary_editor,
27362729
global_hotkey_dropdown,
27372730

@@ -4857,28 +4850,6 @@ impl SettingsWidget for LinkTooltipWidget {
48574850
}
48584851
}
48594852

4860-
#[cfg(feature = "local_fs")]
4861-
#[derive(Default)]
4862-
struct ExternalEditorWidget {}
4863-
4864-
#[cfg(feature = "local_fs")]
4865-
impl SettingsWidget for ExternalEditorWidget {
4866-
type View = FeaturesPageView;
4867-
4868-
fn search_terms(&self) -> &str {
4869-
"editor open files markdown AI conversations layout pane tab"
4870-
}
4871-
4872-
fn render(
4873-
&self,
4874-
view: &Self::View,
4875-
_appearance: &Appearance,
4876-
_app: &AppContext,
4877-
) -> Box<dyn Element> {
4878-
ChildView::new(&view.external_editor_view).finish()
4879-
}
4880-
}
4881-
48824853
#[derive(Default)]
48834854
struct QuitWarningModalWidget {
48844855
switch_state: SwitchStateHandle,
@@ -5157,53 +5128,6 @@ impl SettingsWidget for MouseScrollMultiplierWidget {
51575128
}
51585129
}
51595130

5160-
#[derive(Default)]
5161-
struct AutoOpenCodeReviewPaneWidget {
5162-
switch_state: SwitchStateHandle,
5163-
}
5164-
5165-
impl SettingsWidget for AutoOpenCodeReviewPaneWidget {
5166-
type View = FeaturesPageView;
5167-
5168-
fn search_terms(&self) -> &str {
5169-
"oz auto open code review pane panel agent mode change first time accepted diff view conversation"
5170-
}
5171-
5172-
fn render(
5173-
&self,
5174-
view: &Self::View,
5175-
appearance: &Appearance,
5176-
app: &AppContext,
5177-
) -> Box<dyn Element> {
5178-
let general_settings = GeneralSettings::as_ref(app);
5179-
let ui_builder = appearance.ui_builder();
5180-
render_body_item::<FeaturesPageAction>(
5181-
"Auto open code review panel".into(),
5182-
None,
5183-
LocalOnlyIconState::for_setting(
5184-
AutoOpenCodeReviewPaneOnFirstAgentChange::storage_key(),
5185-
AutoOpenCodeReviewPaneOnFirstAgentChange::sync_to_cloud(),
5186-
&mut view
5187-
.button_mouse_states
5188-
.local_only_icon_tooltip_states
5189-
.borrow_mut(),
5190-
app,
5191-
),
5192-
ToggleState::Enabled,
5193-
appearance,
5194-
ui_builder
5195-
.switch(self.switch_state.clone())
5196-
.check(*general_settings.auto_open_code_review_pane_on_first_agent_change)
5197-
.build()
5198-
.on_click(move |ctx, _, _| {
5199-
ctx.dispatch_typed_action(FeaturesPageAction::ToggleAutoOpenCodeReviewPane);
5200-
})
5201-
.finish(),
5202-
Some("When this setting is on, the code review panel will open on the first accepted diff of a conversation".into()),
5203-
)
5204-
}
5205-
}
5206-
52075131
#[derive(Default)]
52085132
struct DefaultTerminalWidget {
52095133
link_state: MouseStateHandle,

app/src/terminal/view.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10724,35 +10724,6 @@ impl TerminalView {
1072410724
}
1072510725
}
1072610726

10727-
fn insert_anonymous_user_ai_sign_up_banner(&mut self, ctx: &mut ViewContext<Self>) {
10728-
if *GeneralSettings::as_ref(ctx)
10729-
.anonymous_user_ai_sign_up_banner_shown
10730-
.value()
10731-
{
10732-
return;
10733-
}
10734-
10735-
let banner_id = self.inline_banners_state.next_banner_id();
10736-
let banner_state = AnonymousUserAISignUpBannerState::new(banner_id);
10737-
10738-
self.model
10739-
.lock()
10740-
.block_list_mut()
10741-
.append_inline_banner_with_custom_height(
10742-
InlineBannerItem::new(banner_id, InlineBannerType::AnonymousUserAISignUp),
10743-
3.0,
10744-
);
10745-
10746-
self.inline_banners_state.anonymous_user_ai_sign_up_banner = Some(banner_state);
10747-
GeneralSettings::handle(ctx).update(ctx, |settings, ctx| {
10748-
let _ = settings
10749-
.anonymous_user_ai_sign_up_banner_shown
10750-
.set_value(true, ctx);
10751-
});
10752-
10753-
ctx.notify();
10754-
}
10755-
1075610727
fn remove_anonymous_user_ai_sign_up_banner(&mut self, ctx: &mut ViewContext<Self>) {
1075710728
if let Some(banner_state) = self
1075810729
.inline_banners_state

app/src/workspace/util.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ pub(super) struct WorkspaceMouseStates {
3232
pub(super) left_panel_icon: MouseStateHandle,
3333
pub(super) settings_icon: MouseStateHandle,
3434
pub(super) dismiss_banner_button: MouseStateHandle,
35-
pub(super) sign_in_button: MouseStateHandle,
36-
pub(super) sign_up_button: MouseStateHandle,
3735
pub(super) offline_icon: MouseStateHandle,
3836
pub(super) avatar_icon: MouseStateHandle,
3937
pub(super) header_dimming: MouseStateHandle,

app/src/workspace/view.rs

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ use warpui::platform::{
108108
Cursor, FilePickerConfiguration, FullscreenState, SystemTheme, TerminationMode,
109109
};
110110
use warpui::text_layout::ClipConfig;
111-
use warpui::ui_components::button::{Button, ButtonVariant};
111+
use warpui::ui_components::button::Button;
112112
use warpui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
113113
use warpui::windowing::state::ApplicationStage;
114114
use warpui::windowing::{StateEvent, WindowManager};
@@ -21729,92 +21729,6 @@ impl Workspace {
2172921729
.finish()
2173021730
}
2173121731

21732-
fn render_web_anonymous_user_sign_in_button(
21733-
&self,
21734-
appearance: &Appearance,
21735-
) -> Box<dyn Element> {
21736-
let default_styles = UiComponentStyles {
21737-
font_color: Some(appearance.theme().active_ui_text_color().into()),
21738-
font_size: Some(12.),
21739-
font_weight: Some(Weight::Light),
21740-
font_family_id: Some(appearance.ui_font_family()),
21741-
border_color: None,
21742-
border_radius: Some(CornerRadius::with_all(Radius::Pixels(5.))),
21743-
border_width: Some(1.),
21744-
width: Some(80.),
21745-
height: Some(24.),
21746-
..Default::default()
21747-
};
21748-
let hovered_styles = UiComponentStyles {
21749-
font_color: Some(appearance.theme().accent().into()),
21750-
border_color: Some(appearance.theme().accent().into()),
21751-
..default_styles
21752-
};
21753-
let button = appearance
21754-
.ui_builder()
21755-
.button_with_custom_styles(
21756-
ButtonVariant::Text,
21757-
self.mouse_states.sign_in_button.clone(),
21758-
default_styles,
21759-
Some(hovered_styles),
21760-
Some(hovered_styles),
21761-
None,
21762-
)
21763-
.with_centered_text_label(String::from("Sign up"));
21764-
21765-
Align::new(
21766-
button
21767-
.build()
21768-
.on_click(|ctx, _, _| {
21769-
ctx.dispatch_typed_action(WorkspaceAction::SignInAnonymousWebUser)
21770-
})
21771-
.finish(),
21772-
)
21773-
.finish()
21774-
}
21775-
21776-
fn render_anonymous_sign_up_user_button(&self, appearance: &Appearance) -> Box<dyn Element> {
21777-
let default_styles = UiComponentStyles {
21778-
font_color: Some(appearance.theme().active_ui_text_color().into()),
21779-
font_size: Some(12.),
21780-
font_weight: Some(Weight::Semibold),
21781-
font_family_id: Some(appearance.ui_font_family()),
21782-
border_color: Some(appearance.theme().active_ui_text_color().into()),
21783-
border_radius: Some(CornerRadius::with_all(Radius::Pixels(5.))),
21784-
border_width: Some(1.),
21785-
width: Some(80.),
21786-
height: Some(24.),
21787-
..Default::default()
21788-
};
21789-
let hovered_styles = UiComponentStyles {
21790-
font_color: Some(appearance.theme().accent().into()),
21791-
border_color: Some(appearance.theme().accent().into()),
21792-
..default_styles
21793-
};
21794-
21795-
let button = appearance
21796-
.ui_builder()
21797-
.button_with_custom_styles(
21798-
ButtonVariant::Text,
21799-
self.mouse_states.sign_up_button.clone(),
21800-
default_styles,
21801-
Some(hovered_styles),
21802-
Some(hovered_styles),
21803-
None,
21804-
)
21805-
.with_centered_text_label(String::from("Sign up"));
21806-
21807-
Align::new(
21808-
button
21809-
.build()
21810-
.on_click(|ctx, _, _| {
21811-
ctx.dispatch_typed_action(WorkspaceAction::SignupAnonymousUser)
21812-
})
21813-
.finish(),
21814-
)
21815-
.finish()
21816-
}
21817-
2181821732
fn render_offline_button(&self, appearance: &Appearance) -> Box<dyn Element> {
2181921733
let ui_builder = appearance.ui_builder().clone();
2182021734

0 commit comments

Comments
 (0)