feat(engine): Phase B home hierarchy — Continue card, hero New Game, deal-options disclosure #175

Merged
funman300 merged 3 commits from feat/home-hierarchy into master 2026-07-13 20:55:38 +00:00
2 changed files with 38 additions and 18 deletions
Showing only changes of commit fc87b13e5b - Show all commits
+31 -17
View File
@@ -569,20 +569,21 @@ fn build_home_context<'a>(
// additionally requires at least one move — a fresh untouched deal
// is indistinguishable from "New Game" and doesn't earn a card.
let game_live = game.is_some_and(|g| !g.0.is_won());
let continue_info = game
.filter(|g| game_live && g.0.move_count() > 0)
.map(|g| {
let g = &g.0;
let mut caption = format!(
"{} \u{2022} {}",
game_mode_label(g.mode),
format_elapsed(g.elapsed_seconds)
);
if g.mode != GameMode::Zen {
caption.push_str(&format!(" \u{2022} Score {}", format_compact(g.score() as u64)));
}
ContinueInfo { caption }
});
let continue_info = game.filter(|g| game_live && g.0.move_count() > 0).map(|g| {
let g = &g.0;
let mut caption = format!(
"{} \u{2022} {}",
game_mode_label(g.mode),
format_elapsed(g.elapsed_seconds)
);
if g.mode != GameMode::Zen {
caption.push_str(&format!(
" \u{2022} Score {}",
format_compact(g.score() as u64)
));
}
ContinueInfo { caption }
});
let wide = sources
.windows
@@ -1023,7 +1024,12 @@ fn handle_home_digit_keys(
}
if let Some(game_mode) = mode.to_game_mode() {
persist_last_mode(game_mode, &mut settings, storage_path.as_deref(), &mut changed);
persist_last_mode(
game_mode,
&mut settings,
storage_path.as_deref(),
&mut changed,
);
}
writers.dispatch(mode);
@@ -1325,7 +1331,11 @@ fn spawn_new_game_hero(parent: &mut ChildSpawnerCommands, ctx: &HomeContext<'_>)
HighContrastBorder::with_default(BORDER_STRONG),
))
.with_children(|c| {
c.spawn((Text::new("New Game"), font_title.clone(), TextColor(BG_BASE)));
c.spawn((
Text::new("New Game"),
font_title.clone(),
TextColor(BG_BASE),
));
c.spawn((Text::new(caption), font_caption.clone(), TextColor(BG_BASE)));
});
}
@@ -1381,7 +1391,11 @@ fn spawn_daily_callout(parent: &mut ChildSpawnerCommands, ctx: &HomeContext<'_>)
font_label.clone(),
TextColor(TEXT_SECONDARY),
));
c.spawn((Text::new(date_text), font_value.clone(), TextColor(date_color)));
c.spawn((
Text::new(date_text),
font_value.clone(),
TextColor(date_color),
));
if let Some(goal) = today.goal.as_ref() {
c.spawn((
Text::new(format!("Goal: {goal}")),
+7 -1
View File
@@ -181,7 +181,13 @@ pub fn spawn_modal<M: Component, F>(
where
F: FnOnce(&mut ChildSpawnerCommands),
{
spawn_modal_sized(commands, plugin_marker, z_panel, MODAL_CARD_MAX_WIDTH, build_card)
spawn_modal_sized(
commands,
plugin_marker,
z_panel,
MODAL_CARD_MAX_WIDTH,
build_card,
)
}
/// Default maximum card width in logical pixels — every [`spawn_modal`]