From db70ca142c2a7ced018af1a4ef9170648d3a3a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sat, 9 May 2026 18:44:30 -0400 Subject: [PATCH] Extract command footer into chrome::command_footer command_overlay.rs grew past 500 lines after wiring brand glyphs. Move the footer renderer, the keyboard hint chunks, and the kbd chip helper into their own module so the overlay file stays under budget without changing any rendered output. --- .../src/shell/chrome/command_footer.rs | 62 +++++++++++++++++++ .../src/shell/chrome/command_overlay.rs | 59 +----------------- crates/ely_app/src/shell/chrome/mod.rs | 1 + 3 files changed, 65 insertions(+), 57 deletions(-) create mode 100644 crates/ely_app/src/shell/chrome/command_footer.rs diff --git a/crates/ely_app/src/shell/chrome/command_footer.rs b/crates/ely_app/src/shell/chrome/command_footer.rs new file mode 100644 index 0000000..bfa8e1c --- /dev/null +++ b/crates/ely_app/src/shell/chrome/command_footer.rs @@ -0,0 +1,62 @@ +use ely_design_system::colors; +use gpui::{ + AnyElement, IntoElement, ParentElement, Styled, div, px, rgb, rgba, +}; +use gpui_component::IconName; + +pub(crate) fn render_command_footer() -> AnyElement { + div() + .flex() + .items_center() + .gap(px(14.0)) + .px(px(16.0)) + .py(px(10.0)) + .border_t_1() + .border_color(rgba(colors::DIVIDER)) + .text_size(px(10.5)) + .text_color(rgb(colors::INK_3)) + .bg(rgba(FOOTER_BG)) + .child(footer_chunk("↑↓", "navigate")) + .child(footer_chunk("↵", "open")) + .child(footer_chunk("⌘↵", "open in split")) + .child(footer_chunk("⇥", "filter")) + .child( + div() + .ml_auto() + .flex() + .items_center() + .gap(px(6.0)) + .child( + div() + .text_color(rgb(colors::ACCENT)) + .child(IconName::Asterisk), + ) + .child("Powered by ELY"), + ) + .into_any_element() +} + +fn footer_chunk(keys: &'static str, label: &'static str) -> AnyElement { + div() + .flex() + .items_center() + .gap(px(4.0)) + .child(render_kbd(keys)) + .child(label) + .into_any_element() +} + +pub(crate) fn render_kbd(label: &'static str) -> AnyElement { + div() + .px(px(5.0)) + .py(px(1.0)) + .rounded(px(4.0)) + .bg(rgba(KBD_BG)) + .text_size(px(10.0)) + .text_color(rgb(colors::INK_3)) + .child(label) + .into_any_element() +} + +const KBD_BG: u32 = 0xffffffd9; +const FOOTER_BG: u32 = 0xffffff8c; diff --git a/crates/ely_app/src/shell/chrome/command_overlay.rs b/crates/ely_app/src/shell/chrome/command_overlay.rs index 0693fa1..6b85488 100644 --- a/crates/ely_app/src/shell/chrome/command_overlay.rs +++ b/crates/ely_app/src/shell/chrome/command_overlay.rs @@ -8,6 +8,7 @@ use gpui::{ use gpui_component::IconName; use crate::shell::ElyShell; +use crate::shell::chrome::command_footer::{render_command_footer, render_kbd}; use crate::shell::chrome::render_glyph_for; const COMMAND_PREFIX: &str = ">"; @@ -65,7 +66,7 @@ fn render_panel( .flex_col() .child(render_header(query_label.clone(), needle.is_empty())) .child(render_results(snapshot, needle, cx)) - .child(render_footer()) + .child(render_command_footer()) .into_any_element() } @@ -413,60 +414,6 @@ fn render_empty_state() -> AnyElement { .into_any_element() } -fn render_footer() -> AnyElement { - div() - .flex() - .items_center() - .gap(px(14.0)) - .px(px(16.0)) - .py(px(10.0)) - .border_t_1() - .border_color(rgba(colors::DIVIDER)) - .text_size(px(10.5)) - .text_color(rgb(colors::INK_3)) - .bg(rgba(FOOTER_BG)) - .child(footer_chunk("↑↓", "navigate")) - .child(footer_chunk("↵", "open")) - .child(footer_chunk("⌘↵", "open in split")) - .child(footer_chunk("⇥", "filter")) - .child( - div() - .ml_auto() - .flex() - .items_center() - .gap(px(6.0)) - .child( - div() - .text_color(rgb(colors::ACCENT)) - .child(IconName::Asterisk), - ) - .child("Powered by ELY"), - ) - .into_any_element() -} - -fn footer_chunk(keys: &'static str, label: &'static str) -> AnyElement { - div() - .flex() - .items_center() - .gap(px(4.0)) - .child(render_kbd(keys)) - .child(label) - .into_any_element() -} - -fn render_kbd(label: &'static str) -> AnyElement { - div() - .px(px(5.0)) - .py(px(1.0)) - .rounded(px(4.0)) - .bg(rgba(KBD_BG)) - .text_size(px(10.0)) - .text_color(rgb(colors::INK_3)) - .child(label) - .into_any_element() -} - fn matching_tabs<'a>( snapshot: &'a BrowserSnapshot, needle: &str, @@ -514,8 +461,6 @@ const BACKDROP_BG: u32 = 0x140f0a3d; const ROW_HOVER_BG: u32 = 0xc9644214; const ROW_ICON_BG: u32 = 0xffffffd9; const BADGE_BG: u32 = 0x281e140f; -const KBD_BG: u32 = 0xffffffd9; -const FOOTER_BG: u32 = 0xffffff8c; fn panel_shadow() -> Vec { vec![BoxShadow { diff --git a/crates/ely_app/src/shell/chrome/mod.rs b/crates/ely_app/src/shell/chrome/mod.rs index b36dc69..084abf7 100644 --- a/crates/ely_app/src/shell/chrome/mod.rs +++ b/crates/ely_app/src/shell/chrome/mod.rs @@ -1,4 +1,5 @@ pub(crate) mod brand_glyph; +pub(crate) mod command_footer; pub(crate) mod command_overlay; pub(crate) mod home; pub(crate) mod settings_layout;