Brand glyphs in home Continue + Recent activity rows

Replace the rounded-square initial in the Continue history rows and the
generic Globe icon in the Recent activity rows with brand glyphs derived
from each entry's URL host. Unknown hosts still use the gradient initial
fallback so unbranded sites stay legible. Adds a hover opacity feedback
to both rows so the click affordance matches the rest of the home tiles.
This commit is contained in:
2026-05-09 18:39:19 -04:00
parent cd6d8dea32
commit 967e5cb3d9
+12 -29
View File
@@ -8,11 +8,11 @@ use gpui::{
StatefulInteractiveElement, Styled, div, hsla, linear_color_stop, linear_gradient, px, rgb, StatefulInteractiveElement, Styled, div, hsla, linear_color_stop, linear_gradient, px, rgb,
rgba, rgba,
}; };
use gpui_component::IconName;
use crate::shell::ElyShell; use crate::shell::ElyShell;
use crate::shell::chrome::render_glyph_for;
use super::style::{CARD_BG, CARD_BG_HOVER, card_shadow}; use super::style::{CARD_BG, card_shadow};
use super::time::relative_time_label; use super::time::relative_time_label;
pub(crate) fn render_recap( pub(crate) fn render_recap(
@@ -113,9 +113,10 @@ fn render_history_row(
) -> AnyElement { ) -> AnyElement {
let url = entry.url().clone(); let url = entry.url().clone();
let title = entry.title().to_string(); let title = entry.title().to_string();
let host = entry.url().host().unwrap_or_default().to_string(); let host = entry.url().host().map(|host| host.to_string());
let host_label = host.clone().unwrap_or_default();
let when = relative_time_label(now, entry.visited_at()); let when = relative_time_label(now, entry.visited_at());
let initial = title.chars().next().unwrap_or('?').to_uppercase().to_string(); let initial = title.chars().next().unwrap_or('?').to_string();
div() div()
.id(SharedString::from(format!("continue-row-{index}"))) .id(SharedString::from(format!("continue-row-{index}")))
@@ -124,22 +125,11 @@ fn render_history_row(
.gap(px(12.0)) .gap(px(12.0))
.py(px(4.0)) .py(px(4.0))
.cursor_pointer() .cursor_pointer()
.hover(|style| style.opacity(0.85))
.on_click(cx.listener(move |shell, _, window, cx| { .on_click(cx.listener(move |shell, _, window, cx| {
shell.open_internal_tab(url.as_str(), window, cx); shell.open_internal_tab(url.as_str(), window, cx);
})) }))
.child( .child(render_glyph_for(host.as_deref(), &initial, 26.0))
div()
.size(px(26.0))
.rounded(px(7.0))
.bg(rgba(CARD_BG_HOVER))
.flex()
.items_center()
.justify_center()
.text_size(px(12.0))
.font_weight(FontWeight(600.0))
.text_color(rgb(colors::INK_2))
.child(initial),
)
.child( .child(
div() div()
.min_w_0() .min_w_0()
@@ -160,7 +150,7 @@ fn render_history_row(
.text_size(px(11.5)) .text_size(px(11.5))
.text_color(rgb(colors::INK_4)) .text_color(rgb(colors::INK_4))
.truncate() .truncate()
.child(format!("{host} · {when}")), .child(format!("{host_label} · {when}")),
), ),
) )
.into_any_element() .into_any_element()
@@ -297,6 +287,8 @@ fn render_activity_row(
let url = entry.url().clone(); let url = entry.url().clone();
let title = entry.title().to_string(); let title = entry.title().to_string();
let display_url = entry.url().as_str().to_string(); let display_url = entry.url().as_str().to_string();
let host = entry.url().host().map(|host| host.to_string());
let initial = title.chars().next().unwrap_or('?').to_string();
let when = relative_time_label(now, entry.visited_at()); let when = relative_time_label(now, entry.visited_at());
div() div()
@@ -305,20 +297,11 @@ fn render_activity_row(
.items_start() .items_start()
.gap(px(10.0)) .gap(px(10.0))
.cursor_pointer() .cursor_pointer()
.hover(|style| style.opacity(0.85))
.on_click(cx.listener(move |shell, _, window, cx| { .on_click(cx.listener(move |shell, _, window, cx| {
shell.open_internal_tab(url.as_str(), window, cx); shell.open_internal_tab(url.as_str(), window, cx);
})) }))
.child( .child(render_glyph_for(host.as_deref(), &initial, 24.0))
div()
.size(px(24.0))
.rounded(px(6.0))
.bg(rgba(CARD_BG_HOVER))
.flex()
.items_center()
.justify_center()
.text_color(rgb(colors::INK_3))
.child(IconName::Globe),
)
.child( .child(
div() div()
.min_w_0() .min_w_0()