From 46dd9cdfab8de0be7d43a0594333206e436d60a3 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Apr 2026 02:38:16 +0000 Subject: [PATCH] feat(engine): achievements screen shows reward and unlock date per entry Each achievement row now displays: - "Reward: Card Back #N / Background #N / +N XP / Badge" (green, all entries) - "Unlocked YYYY-MM-DD" (dim, unlocked entries only) Helps players understand what they earn and when they earned it. Co-Authored-By: Claude Sonnet 4.6 --- solitaire_engine/src/achievement_plugin.rs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/solitaire_engine/src/achievement_plugin.rs b/solitaire_engine/src/achievement_plugin.rs index 2903994..6c177d6 100644 --- a/solitaire_engine/src/achievement_plugin.rs +++ b/solitaire_engine/src/achievement_plugin.rs @@ -326,12 +326,37 @@ fn spawn_achievements_screen(commands: &mut Commands, records: &[AchievementReco TextColor(desc_color), )); } + // Reward line + if let Some(reward_str) = def.and_then(|d| d.reward).map(format_reward) { + row.spawn(( + Text::new(format!(" Reward: {reward_str}")), + TextFont { font_size: 12.0, ..default() }, + TextColor(Color::srgb(0.45, 0.75, 0.45)), + )); + } + // Unlock date for unlocked achievements + if let Some(date) = record.unlock_date { + row.spawn(( + Text::new(format!(" Unlocked {}", date.format("%Y-%m-%d"))), + TextFont { font_size: 11.0, ..default() }, + TextColor(Color::srgb(0.40, 0.40, 0.45)), + )); + } }); } }); }); } +fn format_reward(reward: Reward) -> String { + match reward { + Reward::CardBack(idx) => format!("Card Back #{idx}"), + Reward::Background(idx) => format!("Background #{idx}"), + Reward::BonusXp(xp) => format!("+{xp} XP"), + Reward::Badge => "Badge".to_string(), + } +} + #[cfg(test)] mod tests { use super::*;