From 15b675a5959921ed8b5ecd6f428576addf8ad684 Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Wed, 4 Feb 2026 21:41:38 -0500 Subject: [PATCH] fix: correct some styling issues --- src/components/banner.rs | 52 +++++++++++++-------------- src/components/multi_entry.rs | 65 +++++++++++++++++----------------- src/components/tabs/sidebar.rs | 6 ++-- src/pages/student/shell.rs | 60 +++++++++++++++++-------------- 4 files changed, 94 insertions(+), 89 deletions(-) diff --git a/src/components/banner.rs b/src/components/banner.rs index d82b994..b6baa0c 100644 --- a/src/components/banner.rs +++ b/src/components/banner.rs @@ -39,36 +39,34 @@ pub fn Banner( }; view! { -
-
-
-
- icon -
-
-

{title.clone()}

-
+
+
+
+ icon
-
- - - - "Back to Dashboard" - - +
+

{title.clone()}

+
} } diff --git a/src/components/multi_entry.rs b/src/components/multi_entry.rs index 41ad518..4bebba6 100644 --- a/src/components/multi_entry.rs +++ b/src/components/multi_entry.rs @@ -2,6 +2,7 @@ use crate::common::{InputType, ValueType}; use crate::components::ActionButton; use leptos::prelude::*; use std::collections::HashMap; +use leptos::logging::log; use uuid::Uuid; // region Helper Functions @@ -69,7 +70,7 @@ pub fn MultiEntry( #[prop(optional, into)] description: Signal, /// The data member that contains the list of entries within the `data_map`. #[prop(into)] - data_member: String, + data_member: Signal, /// The data map that contains all the information. Data is found within this map using the /// component's `data_member` input. #[prop()] @@ -80,26 +81,31 @@ pub fn MultiEntry( ) -> impl IntoView { // Make the values within the list reactive. Each of these values should be a ValueType::Map, // so we can pass these directly to the application. - let data_reactive = RwSignal::new( - data_map - .get_untracked() - .get(&data_member) - .unwrap_or(&ValueType::List(None)) - .as_list().ok().flatten() - .unwrap_or(Vec::new()) - ); - - // This effect updates the data_map with any new values from the data_reactive list, every time - // the data_reactive list is changed. This allows changes from within the Entry component to - // bubble up to the data_map effectively. - Effect::new(move |_| { - let entry_list = data_reactive.get(); - data_map.update(|map| { - map.insert(data_member.clone(), ValueType::List(Some(entry_list))); - }); + let data_list = Memo::new(move |_| { + data_map.with(|map| { + map.get(&data_member.get()) + .and_then(|v| v.as_list().ok().flatten()) + .unwrap_or_default() + }) }); + + // This effect updates the data_map with any new values from the data_list, every time + // the data_list is changed. This allows changes from within the Entry component to + // bubble up to the data_map effectively. + let update_parent_list = move |list| { + log!("Updating parent list using child list {:?}", list); + data_map.update(|map| { + map.insert(data_member.get(), ValueType::List(Some(list))); + }); + }; - let add_entry = move |_| data_reactive.update(|list| list.push(new_entry())); + let add_entry = move |_| data_map.update(|map| { + log!("Adding new entry."); + let mut list = data_list.get_untracked(); + + list.push(new_entry()); + map.insert(data_member.get(), ValueType::List(Some(list))); + }); view! {
@@ -112,33 +118,26 @@ pub fn MultiEntry(
// Render the entries "You haven't added any entries yet."
} } > } } diff --git a/src/components/tabs/sidebar.rs b/src/components/tabs/sidebar.rs index 4ecaf33..4a2b7f0 100644 --- a/src/components/tabs/sidebar.rs +++ b/src/components/tabs/sidebar.rs @@ -54,8 +54,8 @@ pub fn TabSidebarList( // Create a series of tabs based on a given list of names and paths. view! { -
-