Mirror omnibar value into the home search shortcut

The home page hero search showed a static "Search the web or ELY"
placeholder regardless of what the user had typed in the omnibar.
Click the home search → focus the omnibar → start typing → omnibar
shows the text but the home search still says "Search the web or
ELY". The user reasonably reads that as "my typing went nowhere."

Read `command_input.value()` from the home search renderer and echo
it (in INK when set, INK_4 placeholder when empty). Single Input
still owns the actual state — the home search is a click-to-focus
shortcut, this is a read-only echo so the user sees their typing
reflected here too. Truncate so long URLs don't blow the row.

Plumb `&ElyShell` through `render_home_page → render_hero →
render_search_bar`.
This commit is contained in:
2026-05-09 22:30:34 -04:00
parent 6cf2defca9
commit 2852ab63ee
3 changed files with 22 additions and 6 deletions
+19 -4
View File
@@ -15,6 +15,7 @@ use super::style::{
use super::time::DayPhase; use super::time::DayPhase;
pub(crate) fn render_hero( pub(crate) fn render_hero(
shell: &ElyShell,
greeting: String, greeting: String,
phase: DayPhase, phase: DayPhase,
cx: &mut Context<ElyShell>, cx: &mut Context<ElyShell>,
@@ -26,7 +27,7 @@ pub(crate) fn render_hero(
.gap(px(14.0)) .gap(px(14.0))
.child(render_greeting_row(greeting, phase)) .child(render_greeting_row(greeting, phase))
.child(render_serif_headline()) .child(render_serif_headline())
.child(render_search_bar(cx)) .child(render_search_bar(shell, cx))
.child(render_suggestion_pills(cx)) .child(render_suggestion_pills(cx))
.into_any_element() .into_any_element()
} }
@@ -71,7 +72,19 @@ fn render_serif_headline() -> AnyElement {
.into_any_element() .into_any_element()
} }
fn render_search_bar(cx: &mut Context<ElyShell>) -> AnyElement { fn render_search_bar(shell: &ElyShell, cx: &mut Context<ElyShell>) -> AnyElement {
// Reflect the omnibar's live value so typing into it from the
// home search shortcut isn't a black hole — the user sees the
// text they typed mirrored here. The home search itself stays a
// click-to-focus shortcut (single Input owns the actual state),
// so this is a read-only echo, not a parallel input.
let omnibar_value = shell.command_input.read(cx).value().to_string();
let (display_text, display_color) = if omnibar_value.is_empty() {
("Search the web or ELY".to_string(), colors::INK_4)
} else {
(omnibar_value, colors::INK)
};
div() div()
.id(SharedString::from("home-search")) .id(SharedString::from("home-search"))
.w(px(640.0)) .w(px(640.0))
@@ -97,9 +110,11 @@ fn render_search_bar(cx: &mut Context<ElyShell>) -> AnyElement {
.child( .child(
div() div()
.flex_1() .flex_1()
.min_w_0()
.truncate()
.text_size(px(14.0)) .text_size(px(14.0))
.text_color(rgb(colors::INK_4)) .text_color(rgb(display_color))
.child("Search the web or ELY"), .child(display_text),
) )
.child( .child(
div() div()
+2 -1
View File
@@ -14,6 +14,7 @@ mod style;
mod time; mod time;
pub(crate) fn render_home_page( pub(crate) fn render_home_page(
shell: &ElyShell,
snapshot: &BrowserSnapshot, snapshot: &BrowserSnapshot,
cx: &mut Context<ElyShell>, cx: &mut Context<ElyShell>,
) -> AnyElement { ) -> AnyElement {
@@ -33,7 +34,7 @@ pub(crate) fn render_home_page(
.pb(px(28.0)) .pb(px(28.0))
.flex() .flex()
.flex_col() .flex_col()
.child(hero::render_hero(greeting, phase, cx)) .child(hero::render_hero(shell, greeting, phase, cx))
.child(div().mt(px(48.0)).child(favorites::render_favorites_grid(snapshot, cx))) .child(div().mt(px(48.0)).child(favorites::render_favorites_grid(snapshot, cx)))
.child(div().mt(px(16.0)).child(recap::render_recap(snapshot, cx))), .child(div().mt(px(16.0)).child(recap::render_recap(snapshot, cx))),
) )
@@ -10,6 +10,6 @@ impl ElyShell {
snapshot: &BrowserSnapshot, snapshot: &BrowserSnapshot,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> AnyElement { ) -> AnyElement {
render_home_page(snapshot, cx) render_home_page(self, snapshot, cx)
} }
} }