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:
@@ -6,6 +6,47 @@ ratio/diff ver `git show <sha>`.
|
||||
|
||||
## 2026-05-10
|
||||
|
||||
### feat(yahweh-widget-app-header): promover el 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.
|
||||
|
||||
Crate nuevo `crates/modules/ui_engine/widgets/app-header/`
|
||||
(`yahweh-widget-app-header`):
|
||||
- **Deps**: `gpui`, `yahweh-theme`, `yahweh-widget-theme-switcher`.
|
||||
El switcher se incluye automáticamente.
|
||||
- **`pub fn app_header(cx: &mut App, label: impl Into<SharedString>)
|
||||
-> impl IntoElement`**: caso simple con texto plano.
|
||||
- **`pub fn app_header_with(cx, label_child: impl IntoElement)`**:
|
||||
variante para cuando el lado izquierdo no es texto plano (icon
|
||||
+ text, múltiples spans, etc.).
|
||||
- 3 tests `#[gpui::test]`: smoke con string label, con custom
|
||||
child IntoElement, type-check de label con literal/owned/format!.
|
||||
|
||||
Migración de los 4 consumers:
|
||||
- Cada uno reemplaza un bloque `let header = div().flex().flex_row()...
|
||||
.child(theme_switcher(cx))` (~13 líneas) por
|
||||
`let header = app_header(cx, header_text)` (~1 línea).
|
||||
- Cada uno borra dep `yahweh-widget-theme-switcher` (ya no la
|
||||
necesita directo — el `app_header` la incluye internamente).
|
||||
- Cada uno reemplaza `use yahweh_widget_theme_switcher::theme_switcher`
|
||||
por `use yahweh_widget_app_header::app_header`.
|
||||
|
||||
Total ahorro: ~50 líneas de código UI hardcoded en consumers.
|
||||
Cambios visuales en el header (padding, border, text_size) ahora
|
||||
viven en un solo lugar.
|
||||
|
||||
Tests stack: 3 nuevos en app-header; suites de los 4 consumers
|
||||
intactas. Todo verde.
|
||||
|
||||
Decisión: el sidebar header del `MetaApp` (que también incluye
|
||||
theme_switcher) NO se migra — es un header de sidebar, no de app
|
||||
top, y tiene styling distinto (px(12/10/13), sin bg/border-bottom
|
||||
porque ya está dentro del panel). Diferente patrón → diferente
|
||||
widget si emerge segundo consumer.
|
||||
|
||||
### feat(yahweh-widget-stat-card): promover el patrón stat card como widget
|
||||
Iter 15. El patrón "tarjeta de dashboard con border-l accent +
|
||||
label + valor grande + descripción + listing opcional" tenía 2
|
||||
|
||||
Reference in New Issue
Block a user