From 9898af1bf774e1e46ae3083f69cfd5497525c135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asger=20Juul=20Brunsh=C3=B8j?= Date: Mon, 17 Mar 2025 15:08:50 +0100 Subject: [PATCH] feat: filter UI part 2 --- crates/ascend/src/lib.rs | 12 ++++++++++++ crates/ascend/src/pages/wall.rs | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/crates/ascend/src/lib.rs b/crates/ascend/src/lib.rs index e0a7d37..5629f05 100644 --- a/crates/ascend/src/lib.rs +++ b/crates/ascend/src/lib.rs @@ -20,6 +20,18 @@ pub mod components { pub mod outlined_box; pub mod problem; pub mod problem_info; + + use leptos::prelude::*; + + #[component] + pub fn OnHoverRed(children: Children) -> impl IntoView { + view! { +
+
{children()}
+
+
+ } + } } pub mod gradient; diff --git a/crates/ascend/src/pages/wall.rs b/crates/ascend/src/pages/wall.rs index 3f18733..37b1512 100644 --- a/crates/ascend/src/pages/wall.rs +++ b/crates/ascend/src/pages/wall.rs @@ -31,6 +31,7 @@ // +--------------------------------------+ use crate::codec::ron::RonEncoded; +use crate::components::OnHoverRed; use crate::components::ProblemInfo; use crate::components::attempt::Attempt; use crate::components::button::Button; @@ -125,7 +126,7 @@ fn WithWall(#[prop(into)] wall: Signal) -> impl IntoView { // Filter let (filter_holds, set_filter_holds) = signal(BTreeSet::new()); - let filter_add_hold = move |hold_pos: models::HoldPosition| { + let _filter_add_hold = move |hold_pos: models::HoldPosition| { set_filter_holds.update(move |set| { set.insert(hold_pos); }); @@ -189,7 +190,17 @@ fn WithWall(#[prop(into)] wall: Signal) -> impl IntoView { for hold_pos in filter_holds.get() { let w = &*wall.read(); if let Some(hold) = w.holds.get(&hold_pos).cloned() { - let v = view! { }; + let onclick = move |_| { + filter_remove_hold(hold_pos); + }; + + let v = view! { + + }; cells.push(v); } } @@ -201,7 +212,7 @@ fn WithWall(#[prop(into)] wall: Signal) -> impl IntoView {
{grid}
-
+
{filter}