@@ -131,15 +123,6 @@ pub fn StudentEligibilityPage() -> impl IntoView {
}
})
.collect::
>();
-
- // Each scholarship will return Some(itself), or None. This is will be automatically
- // filtered based on the information. Invalid scholarships are None, along with those
- // that fail validation for any reason. Scholarships that are valid or did not choose
- // any requirements are Some(scholarship).
-
- // We want to cast to a list, and then map the list to a new
- // one that contains the correct ComparisonData.
-
view! {
{format!("Valid scholarships: {}", valid_list.len())}
impl IntoView {
key=|scholarship| { scholarship.subject.clone() }
children=move |scholarship| {
let scholarship = StoredValue::new(scholarship);
- let scholarship_name = Memo::new(move |_| {
- scholarship
- .read_value()
- .data
- .get("name")
- .unwrap_or(&ValueType::String(None))
- .as_string()
- .ok()
- .flatten()
- .unwrap_or_default()
- });
- let scholarship_essay_prompt = Memo::new(move |_| {
- scholarship
- .read_value()
- .data
- .get("essay_prompt")
- .unwrap_or(&ValueType::String(None))
- .as_string()
- .ok()
- .flatten()
- .unwrap_or_default()
- });
- let essay_required = Memo::new(move |_| {
- !scholarship_essay_prompt.get().is_empty()
- });
+ let display_schema = SchemaNode::new(SchemaType::Map)
+ .header("Eligible Scholarship")
+ .child(
+ "name",
+ SchemaNode::new(SchemaType::String)
+ .header("Scholarship Name"),
+ )
+ .child(
+ "essay_prompt",
+ SchemaNode::new(SchemaType::String).header("Essay Prompt"),
+ );
view! {
-
-
{scholarship_name}
-
- {scholarship_essay_prompt}
-
-
+
}
}
/>
diff --git a/src/pages/student/test_display.rs b/src/pages/student/test_display.rs
index a0fa461..a66d8eb 100644
--- a/src/pages/student/test_display.rs
+++ b/src/pages/student/test_display.rs
@@ -1,22 +1,38 @@
+use crate::common::{SchemaNode, SchemaType};
use crate::components::{Loading, ValueDisplay};
use crate::pages::api::students::get_all_student_data;
use crate::utils::get_user_claims;
use leptos::prelude::*;
-use crate::common::{SchemaNode, SchemaType};
#[component]
pub fn StudentTestDisplay() -> impl IntoView {
let create_student_display_schema = move || {
SchemaNode::new(SchemaType::Map)
- .header("Student Information:")
- .child("first_name", SchemaNode::new(SchemaType::String).header("First Name:"))
- .child("last_name", SchemaNode::new(SchemaType::String).header("Last Name:"))
- .child("sports_participation", SchemaNode::new(SchemaType::List)
- .header("List of Sports Activities")
- .item_template(SchemaNode::new(SchemaType::Map)
- .child("sport_name", SchemaNode::new(SchemaType::String).header("Sport Name:"))
- .child("achievements", SchemaNode::new(SchemaType::String).header("Special Achievements"))
- )
+ .header("Student Information")
+ .child(
+ "first_name",
+ SchemaNode::new(SchemaType::String).header("First Name"),
+ )
+ .child(
+ "last_name",
+ SchemaNode::new(SchemaType::String).header("Last Name"),
+ )
+ .child(
+ "sports_participation",
+ SchemaNode::new(SchemaType::List)
+ .header("Sports Activities")
+ .item_template(
+ SchemaNode::new(SchemaType::Map)
+ .header("Sport")
+ .child(
+ "sport_name",
+ SchemaNode::new(SchemaType::String).header("Sport Name"),
+ )
+ .child(
+ "achievements",
+ SchemaNode::new(SchemaType::String).header("Special Achievements"),
+ ),
+ ),
)
};
@@ -31,8 +47,9 @@ pub fn StudentTestDisplay() -> impl IntoView {
let schema = StoredValue::new(create_student_display_schema());
view! {
+
-
+
{move || {
resource
.get()
@@ -55,5 +72,6 @@ pub fn StudentTestDisplay() -> impl IntoView {
}}
+
}
}