diff --git a/frontend/src/demo/perround.rs b/frontend/src/demo/perround.rs index a339ddb..6a7e0c5 100644 --- a/frontend/src/demo/perround.rs +++ b/frontend/src/demo/perround.rs @@ -68,6 +68,16 @@ pub fn per_round() -> impl leptos::IntoView { p.round_entry { margin: 0px; } + + .won.ct_won { + background-color: #1111ff77; + } + .won.t_won { + background-color: #dd111177; + } + .lose { + background-color: #22222277; + } }; let (round, set_round) = create_signal(0); @@ -99,28 +109,52 @@ pub fn per_round() -> impl leptos::IntoView { let round = perround_resource.get().map(|rs| rs.get(r).cloned()).flatten(); let reason = round.map(|r| r.reason); - // Upper is CT by default and lower is T by default - let mut upper_symbol = match &reason { - Some(common::demo_analysis::RoundWinReason::TKilled) => view! { Killed Ts }.into_view(), - Some(common::demo_analysis::RoundWinReason::BombDefused) => view! { Defused }.into_view(), - Some(common::demo_analysis::RoundWinReason::TimeRanOut) => view! { Out of Time }.into_view(), - _ => view! {}.into_view(), + let (ct_won, t_won) = match &reason { + Some(common::demo_analysis::RoundWinReason::TKilled) => (true, false), + Some(common::demo_analysis::RoundWinReason::BombDefused) => (true, false), + Some(common::demo_analysis::RoundWinReason::TimeRanOut) => (true, false), + Some(common::demo_analysis::RoundWinReason::CTKilled) => (false, true), + Some(common::demo_analysis::RoundWinReason::BombExploded) => (false, true), + _ => (false, false) }; - let mut lower_symbol = match &reason { - Some(common::demo_analysis::RoundWinReason::CTKilled) => view! { Killed CTs }.into_view(), - Some(common::demo_analysis::RoundWinReason::BombExploded) => view! { Exploded }.into_view(), - _ => view! {}.into_view(), + + // Upper is CT by default and lower is T by default + let (mut upper_symbol, mut upper_won) = match &reason { + Some(common::demo_analysis::RoundWinReason::TKilled) => (view! { Killed Ts }.into_view(), true), + Some(common::demo_analysis::RoundWinReason::BombDefused) => (view! { Defused }.into_view(), true), + Some(common::demo_analysis::RoundWinReason::TimeRanOut) => (view! { Out of Time }.into_view(), true), + _ => (view! {}.into_view(), false), + }; + let (mut lower_symbol, mut lower_won) = match &reason { + Some(common::demo_analysis::RoundWinReason::CTKilled) => (view! { Killed CTs }.into_view(), true), + Some(common::demo_analysis::RoundWinReason::BombExploded) => (view! { Exploded }.into_view(), true), + _ => (view! {}.into_view(), false), }; if (12..27).contains(&r) { core::mem::swap(&mut upper_symbol, &mut lower_symbol); + core::mem::swap(&mut upper_won, &mut lower_won); } view! { class=style, -
{ r + 1 }
-