Significant progress. Performing cleanup now

This commit is contained in:
Ryan Ward
2026-05-11 14:31:02 -05:00
parent fe105e0369
commit 140da74f99
37 changed files with 843 additions and 1220 deletions
+1 -179
View File
@@ -30,7 +30,6 @@ use appearance_page::{AppearancePageAction, AppearanceSettingsPageView};
use billing_and_usage_page::{BillingAndUsagePageEvent, BillingAndUsagePageView};
use code_page::CodeSubpage;
use code_page::{CodeSettingsPageAction, CodeSettingsPageEvent};
use environments_page::EnvironmentsPageView;
use features_page::{FeaturesPageView, FeaturesSettingsPageEvent};
use itertools::Itertools as _;
use keybindings::KeybindingsView;
@@ -39,17 +38,14 @@ use mcp_servers_page::MCPServersSettingsPageView;
use nav::{SettingsNavItem, SettingsUmbrella};
use pathfinder_geometry::vector::Vector2F;
use privacy_page::{PrivacyPageView, PrivacyPageViewEvent};
use referrals_page::{ReferralsPageEvent, ReferralsPageView};
use settings_file_footer::{render_footer, SettingsFooterKind, SettingsFooterMouseStates};
use settings_page::{
MatchData, SettingsPage, SettingsPageEvent, SettingsPageMeta, SettingsPageViewHandle,
HEADER_PADDING,
};
use show_blocks_view::{ShowBlocksEvent, ShowBlocksView};
use std::collections::HashMap;
use std::path::PathBuf;
use std::str::FromStr;
use teams_page::{TeamsPageView, TeamsPageViewEvent};
use galaxy_core::send_telemetry_from_ctx;
use galaxy_core::{
channel::ChannelState, context_flag::ContextFlag, features::FeatureFlag,
@@ -97,10 +93,8 @@ mod platform;
mod platform_page;
mod privacy;
mod privacy_page;
mod referrals_page;
mod settings_file_footer;
pub(crate) mod settings_page;
mod show_blocks_view;
mod tab_menu;
mod teams_page;
mod telemetry;
@@ -195,9 +189,6 @@ pub enum SettingsSection {
Features,
Keybindings,
Privacy,
Referrals,
SharedBlocks,
Teams,
WarpDrive,
Warpify,
/// Internal backing-page identifier for AISettingsPageView. Multiple subpages
@@ -220,9 +211,6 @@ pub enum SettingsSection {
// ── Code umbrella subpages ──
CodeIndexing,
EditorAndCodeReview,
// ── Cloud platform umbrella subpages ──
CloudEnvironments,
OzCloudAPIKeys,
}
use crate::util::bindings::custom_tag_to_keystroke;
@@ -233,7 +221,6 @@ impl Display for SettingsSection {
match self {
SettingsSection::BillingAndUsage => write!(f, "Billing and usage"),
SettingsSection::Keybindings => write!(f, "Keyboard shortcuts"),
SettingsSection::SharedBlocks => write!(f, "Shared blocks"),
SettingsSection::MCPServers => write!(f, "MCP Servers"),
SettingsSection::WarpDrive => write!(f, "Galaxy Drive"),
SettingsSection::WarpAgent => write!(f, "Galaxy Agent"),
@@ -244,8 +231,6 @@ impl Display for SettingsSection {
SettingsSection::Bedrock => write!(f, "AWS Bedrock"),
SettingsSection::CodeIndexing => write!(f, "Indexing and projects"),
SettingsSection::EditorAndCodeReview => write!(f, "Editor and Code Review"),
SettingsSection::CloudEnvironments => write!(f, "Environments"),
SettingsSection::OzCloudAPIKeys => write!(f, "Oz Cloud API Keys"),
_ => write!(f, "{self:?}"),
}
}
@@ -254,7 +239,7 @@ impl Display for SettingsSection {
impl SettingsSection {
/// Returns true if this section is a subpage under any umbrella.
pub fn is_subpage(&self) -> bool {
self.is_ai_subpage() || self.is_code_subpage() || self.is_cloud_platform_subpage()
self.is_ai_subpage() || self.is_code_subpage()
}
/// Returns true if this section is a subpage under the "Agents" umbrella.
@@ -275,11 +260,6 @@ impl SettingsSection {
matches!(self, Self::CodeIndexing | Self::EditorAndCodeReview)
}
/// Returns true if this section is a subpage under the "Cloud platform" umbrella.
pub fn is_cloud_platform_subpage(&self) -> bool {
matches!(self, Self::CloudEnvironments | Self::OzCloudAPIKeys)
}
/// Maps subpage sections back to their parent page section for page lookup.
/// Non-subpage sections return themselves.
pub fn parent_page_section(&self) -> Self {
@@ -290,8 +270,6 @@ impl SettingsSection {
s if s.is_ai_subpage() => Self::AI,
// Code subpages render within the Code page.
s if s.is_code_subpage() => Self::Code,
// CloudEnvironments and OzCloudAPIKeys ARE their own backing pages
// (1:1 mapping), so they return themselves.
other => *other,
}
}
@@ -312,11 +290,6 @@ impl SettingsSection {
pub fn code_subpages() -> &'static [Self] {
&[Self::CodeIndexing, Self::EditorAndCodeReview]
}
/// The ordered list of Cloud platform subpage sections.
pub fn cloud_platform_subpages() -> &'static [Self] {
&[Self::CloudEnvironments, Self::OzCloudAPIKeys]
}
}
impl FromStr for SettingsSection {
@@ -334,9 +307,6 @@ impl FromStr for SettingsSection {
"Features" => Ok(Self::Features),
"Keyboard shortcuts" => Ok(Self::Keybindings),
"Privacy" => Ok(Self::Privacy),
"Referrals" => Ok(Self::Referrals),
"Shared blocks" => Ok(Self::SharedBlocks),
"Teams" => Ok(Self::Teams),
"Warpify" => Ok(Self::Warpify),
"WarpDrive" | "Warp Drive" | "Galaxy Drive" => Ok(Self::WarpDrive),
// This page was called "Oz" at one point, keep for backward compatibility.
@@ -348,8 +318,6 @@ impl FromStr for SettingsSection {
"AWS Bedrock" | "Bedrock" => Ok(Self::Bedrock),
"Indexing and projects" | "CodeIndexing" => Ok(Self::CodeIndexing),
"Editor and Code Review" | "EditorAndCodeReview" => Ok(Self::EditorAndCodeReview),
"CloudEnvironments" => Ok(Self::CloudEnvironments),
"Oz Cloud API Keys" | "OzCloudAPIKeys" => Ok(Self::OzCloudAPIKeys),
_ => Err(()),
}
}
@@ -961,15 +929,10 @@ macro_rules! update_page {
SettingsPageViewHandle::Main(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Appearance(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Features(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::SharedBlocks(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Keybindings(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Teams(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Warpify(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::OzCloudAPIKeys(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Privacy(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Referrals(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::AI(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::CloudEnvironments(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::About(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::Code(handle) => $ctx.update_view(handle, $update),
SettingsPageViewHandle::BillingAndUsage(handle) => $ctx.update_view(handle, $update),
@@ -989,7 +952,6 @@ pub struct SettingsView {
clipped_scroll_state: ClippedScrollStateHandle,
context_menu: ViewHandle<Menu<SettingsAction>>,
context_menu_state: Option<Vector2F>,
environments_page_handle: ViewHandle<EnvironmentsPageView>,
/// Sidebar navigation items (pages + umbrellas).
nav_items: Vec<SettingsNavItem>,
/// Handle to the AI settings page, used to switch subpage modes.
@@ -1038,20 +1000,6 @@ impl SettingsView {
me.handle_features_page_event(event, ctx);
});
// Shared blocks page
let block_client = ServerApiProvider::as_ref(ctx).get_block_client();
let show_blocks_view_handle =
ctx.add_typed_action_view(|ctx| ShowBlocksView::new(block_client, ctx));
ctx.subscribe_to_view(&show_blocks_view_handle, |_, _, event, ctx| match event {
ShowBlocksEvent::ShowToast { message, flavor } => {
ctx.emit(SettingsViewEvent::ShowToast {
message: message.clone(),
flavor: *flavor,
})
}
});
// About page
let about_page_handle = ctx.add_view(AboutPageView::new);
@@ -1062,12 +1010,6 @@ impl SettingsView {
me.handle_ai_page_event(event, ctx);
});
// Environments page
let environments_page_handle = ctx.add_typed_action_view(EnvironmentsPageView::new);
ctx.subscribe_to_view(&environments_page_handle, |me, _, event, ctx| {
me.handle_environments_page_event(event, ctx);
});
// Billing and usage page
let billing_and_usage_page_handle = ctx.add_typed_action_view(BillingAndUsagePageView::new);
ctx.subscribe_to_view(&billing_and_usage_page_handle, |me, _, event, ctx| {
@@ -1084,20 +1026,6 @@ impl SettingsView {
me.handle_code_page_event(event, ctx);
});
// Teams page, adding unconditionally, as `should_render` later on decides whether it
// should be shown to the user or not
let teams_page_handle = ctx.add_typed_action_view(TeamsPageView::new);
ctx.subscribe_to_view(&teams_page_handle, |_, _, event, ctx| match event {
TeamsPageViewEvent::TeamsChanged => ctx.notify(),
TeamsPageViewEvent::OpenWarpDrive => ctx.emit(SettingsViewEvent::OpenWarpDrive),
TeamsPageViewEvent::ShowToast { message, flavor } => {
ctx.emit(SettingsViewEvent::ShowToast {
message: message.clone(),
flavor: *flavor,
})
}
});
let warpify_page_handle = ctx.add_typed_action_view(WarpifyPageView::new);
ctx.subscribe_to_view(&warpify_page_handle, |me, _, event, ctx| {
me.handle_warpify_page_event(event, ctx);
@@ -1109,13 +1037,6 @@ impl SettingsView {
me.handle_privacy_page_event(event, ctx);
});
let referrals_client = ServerApiProvider::as_ref(ctx).get_referrals_client();
let referrals_page_handle =
ctx.add_typed_action_view(|ctx| ReferralsPageView::new(referrals_client, ctx));
ctx.subscribe_to_view(&referrals_page_handle, |me, _, event, ctx| {
me.handle_referrals_page_event(event, ctx);
});
// Warp Drive page
let warp_drive_page_handle =
ctx.add_typed_action_view(warp_drive_page::WarpDriveSettingsPageView::new);
@@ -1167,20 +1088,16 @@ impl SettingsView {
SettingsPage::new(ai_page_handle),
SettingsPage::new(billing_and_usage_page_handle),
SettingsPage::new(code_page_handle),
SettingsPage::new(teams_page_handle),
SettingsPage::new(appearance_page_handle),
SettingsPage::new(features_page_handle),
SettingsPage::new(keybindings_handle),
SettingsPage::new(platform_page_handle),
SettingsPage::new(warpify_page_handle),
SettingsPage::new(referrals_page_handle),
SettingsPage::new(show_blocks_view_handle),
SettingsPage::new(warp_drive_page_handle),
];
settings_pages.extend(vec![
SettingsPage::new(mcp_servers_page_handle),
SettingsPage::new(environments_page_handle.clone()),
SettingsPage::new(privacy_page_handle),
SettingsPage::new(about_page_handle),
]);
@@ -1199,20 +1116,10 @@ impl SettingsView {
SettingsSection::EditorAndCodeReview,
],
)),
SettingsNavItem::Umbrella(SettingsUmbrella::new(
"Cloud platform",
vec![
SettingsSection::CloudEnvironments,
SettingsSection::OzCloudAPIKeys,
],
)),
SettingsNavItem::Page(SettingsSection::Teams),
SettingsNavItem::Page(SettingsSection::Appearance),
SettingsNavItem::Page(SettingsSection::Features),
SettingsNavItem::Page(SettingsSection::Keybindings),
SettingsNavItem::Page(SettingsSection::Warpify),
SettingsNavItem::Page(SettingsSection::Referrals),
SettingsNavItem::Page(SettingsSection::SharedBlocks),
SettingsNavItem::Page(SettingsSection::WarpDrive),
SettingsNavItem::Page(SettingsSection::Privacy),
SettingsNavItem::Page(SettingsSection::About),
@@ -1250,7 +1157,6 @@ impl SettingsView {
clipped_scroll_state: Default::default(),
context_menu,
context_menu_state: Default::default(),
environments_page_handle,
nav_items,
ai_page_handle: ai_page_handle_for_nav,
code_page_handle: code_page_handle_for_nav,
@@ -1635,24 +1541,6 @@ impl SettingsView {
}
}
fn handle_environments_page_event(
&mut self,
event: &SettingsPageEvent,
ctx: &mut ViewContext<Self>,
) {
match event {
SettingsPageEvent::FocusModal => ctx.focus(&self.search_editor),
SettingsPageEvent::EnvironmentSetupModeSelectorToggled { .. }
| SettingsPageEvent::AgentAssistedEnvironmentModalToggled { .. } => {
// Re-render so the modal overlay is shown/hidden.
ctx.notify();
}
SettingsPageEvent::Pane(_) => {
// Not applicable in standalone settings view.
}
}
}
fn handle_features_page_event(
&mut self,
event: &FeaturesSettingsPageEvent,
@@ -1748,25 +1636,6 @@ impl SettingsView {
}
}
fn handle_referrals_page_event(
&mut self,
event: &ReferralsPageEvent,
ctx: &mut ViewContext<Self>,
) {
match event {
ReferralsPageEvent::SignupAnonymousUser => {
ctx.emit(SettingsViewEvent::SignupAnonymousUser)
}
ReferralsPageEvent::FocusModal => ctx.focus(&self.search_editor),
ReferralsPageEvent::ShowToast { message, flavor } => {
ctx.emit(SettingsViewEvent::ShowToast {
message: message.clone(),
flavor: *flavor,
})
}
}
}
fn handle_warp_drive_page_event(
&mut self,
event: &warp_drive_page::WarpDriveSettingsPageEvent,
@@ -1881,9 +1750,6 @@ impl SettingsView {
self.clear_search_query(ctx);
}
self.current_settings_page = section;
if previous_section != section && section == SettingsSection::CloudEnvironments {
send_telemetry_from_ctx!(SettingsTelemetryEvent::EnvironmentsPageOpened, ctx);
}
// When navigating to a subpage, update the backing page's active subpage mode
// and auto-expand the umbrella containing it.
@@ -1949,40 +1815,20 @@ impl SettingsView {
fn should_render_page(&self, settings_page: &SettingsPage, app: &AppContext) -> bool {
match &settings_page.view_handle {
SettingsPageViewHandle::Main(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Teams(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::SharedBlocks(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Keybindings(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Features(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Appearance(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::BillingAndUsage(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::About(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::OzCloudAPIKeys(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Privacy(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Warpify(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Referrals(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::AI(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::CloudEnvironments(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::MCPServers(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::Code(v) => v.as_ref(app).should_render(app),
SettingsPageViewHandle::WarpDrive(v) => v.as_ref(app).should_render(app),
}
}
/// Open the invite section of the teams page, optionally with an email to invite.
pub fn open_teams_page_email_invite(
&mut self,
email: Option<&String>,
ctx: &mut ViewContext<Self>,
) {
if let Some(team_page) = self.settings_page(SettingsSection::Teams) {
if let SettingsPageViewHandle::Teams(view) = &team_page.view_handle {
view.update(ctx, |view, ctx| {
view.open_team_members(email, ctx);
})
}
}
}
/// Open the MCP servers page, optionally to list page or edit page.
/// If `autoinstall_gallery_title` is provided, triggers auto-install of the specified gallery MCP.
pub fn open_mcp_servers_page(
@@ -2115,9 +1961,6 @@ impl SettingsView {
SettingsPageViewHandle::Keybindings(view_handle) => {
view_handle.update(ctx, |view, ctx| view.on_tab_pressed(ctx));
}
SettingsPageViewHandle::Teams(view_handle) => {
view_handle.update(ctx, |view, ctx| view.on_tab_pressed(ctx));
}
_ => (),
};
}
@@ -2178,9 +2021,6 @@ impl SettingsView {
SettingsPageViewHandle::Privacy(view) => {
view.read(app, |view, _| view.get_modal_content())
}
SettingsPageViewHandle::OzCloudAPIKeys(view) => {
view.read(app, |view, _| view.get_modal_content())
}
SettingsPageViewHandle::MCPServers(view) => {
view.read(app, |view, _| view.get_modal_content(app))
}
@@ -2481,24 +2321,6 @@ impl View for SettingsView {
);
}
// Render environment setup mode selector overlay when open.
if let Some(selector_handle) = self
.environments_page_handle
.as_ref(app)
.environment_setup_mode_selector_handle()
{
stack.add_child(ChildView::new(selector_handle).finish());
}
// Render agent-assisted environment modal overlay when open.
if let Some(modal_handle) = self
.environments_page_handle
.as_ref(app)
.agent_assisted_environment_modal_handle(app)
{
stack.add_child(ChildView::new(modal_handle).finish());
}
SavePosition::new(stack.finish(), POSITION_ID).finish()
}
}