feat(yahweh-widget-app-header): promover header standard de explorers
Iter 16. Patrón con 4 consumers idénticos: nakui-explorer, nouser-explorer, minga-explorer, brahman-broker-explorer todos declaraban un header flex_row + flex_grow(label) + theme_switcher + bg(panel) + border-bottom + text_size(14) + padding(16/12). Ahora es 1 línea. crates/modules/ui_engine/widgets/app-header/: - pub fn app_header(cx, label: impl Into<SharedString>) -> impl IntoElement. - pub fn app_header_with(cx, label_child: impl IntoElement) — variante para left side no-text. - 3 tests #[gpui::test]. Migración 4 consumers: - Cada uno: bloque de ~13 líneas → 1 línea app_header(cx, text). - Borra dep yahweh-widget-theme-switcher (incluida vía app-header). - Reemplaza import. Ahorro ~50 líneas UI hardcoded. Cambios visuales del header (padding, border, text_size) en un solo lugar. Decisión: sidebar header del MetaApp NO se migra — es de sidebar, no de app top, styling distinto. Diferente patrón → diferente widget. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ minga-store = { path = "../../modules/semantic_dht/minga-store" }
|
||||
yahweh-theme = { path = "../../modules/ui_engine/libs/theme" }
|
||||
yahweh-widget-banner = { path = "../../modules/ui_engine/widgets/banner" }
|
||||
yahweh-widget-stat-card = { path = "../../modules/ui_engine/widgets/stat-card" }
|
||||
yahweh-widget-theme-switcher = { path = "../../modules/ui_engine/widgets/theme-switcher" }
|
||||
yahweh-widget-app-header = { path = "../../modules/ui_engine/widgets/app-header" }
|
||||
gpui = { workspace = true }
|
||||
|
||||
[[bin]]
|
||||
|
||||
@@ -34,7 +34,7 @@ use minga_store::PersistentRepo;
|
||||
use yahweh_theme::Theme;
|
||||
use yahweh_widget_banner::{banner_themed, Banner};
|
||||
use yahweh_widget_stat_card::stat_card;
|
||||
use yahweh_widget_theme_switcher::theme_switcher;
|
||||
use yahweh_widget_app_header::app_header;
|
||||
|
||||
const REFRESH_INTERVAL: Duration = Duration::from_secs(2);
|
||||
const REPO_DIRNAME: &str = "repo";
|
||||
@@ -224,19 +224,8 @@ impl Render for Explorer {
|
||||
None => format!("Buscando repo en {}…", self.repo_path.display()),
|
||||
};
|
||||
|
||||
let header = div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.items_center()
|
||||
.px(px(16.))
|
||||
.py(px(12.))
|
||||
.bg(theme.bg_panel.clone())
|
||||
.border_b_1()
|
||||
.border_color(theme.border)
|
||||
.text_color(text)
|
||||
.text_size(px(14.))
|
||||
.child(div().flex_grow().child(header_text))
|
||||
.child(theme_switcher(cx));
|
||||
// Header standard via widget compartido.
|
||||
let header = app_header(cx, header_text);
|
||||
|
||||
let error_banner = self.error.as_ref().map(|e| {
|
||||
banner_themed(cx, Banner::Error, e.clone())
|
||||
|
||||
Reference in New Issue
Block a user