Co-authored-by: jkassman <jkassman@users.noreply.github.com>
All checks were successful
Build Crate / build (push) Successful in 8m23s
All checks were successful
Build Crate / build (push) Successful in 8m23s
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
use crate::{components::layout::Layout, templates::global_state::AppStateRx};
|
||||
use crate::{components::layout::Layout, templates::global_state::AppStateRx, data::user::PlayerId};
|
||||
|
||||
use perseus::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sycamore::prelude::*;
|
||||
|
||||
use crate::data::pool_match::PoolMatch;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, ReactiveState)]
|
||||
#[rx(alias = "PageStateRx")]
|
||||
struct PageState {}
|
||||
|
||||
fn format_list_or_single(to_format: &Vec<PlayerId>) -> String{
|
||||
match to_format.len() {
|
||||
1 => to_format[0].to_string(),
|
||||
_ => format!("{:?}", to_format),
|
||||
}
|
||||
}
|
||||
|
||||
fn overall_board_page<'a, G: Html>(cx: BoundedScope<'_, 'a>, _state: &'a PageStateRx) -> View<G> {
|
||||
let global_state = Reactor::<G>::from_cx(cx).get_global_state::<AppStateRx>(cx);
|
||||
|
||||
@@ -19,12 +28,16 @@ fn overall_board_page<'a, G: Html>(cx: BoundedScope<'_, 'a>, _state: &'a PageSta
|
||||
.pool_matches
|
||||
.iter()
|
||||
.rev()
|
||||
.enumerate()
|
||||
.map(|(_index, item)| {
|
||||
.map(|item: &PoolMatch| {
|
||||
let game = item.clone();
|
||||
|
||||
view! { cx,
|
||||
li {
|
||||
li (class = "text-blue-700", id = "ha",) {
|
||||
(game.id)
|
||||
(" ")
|
||||
(format_list_or_single(&game.data.winners))
|
||||
(" ")
|
||||
(format_list_or_single(&game.data.losers))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user