diff --git a/src/app.rs b/src/app.rs index c7cc1ae..27d79fa 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,5 +1,4 @@ use crate::pages::{AboutPage, HomePage, LoanerPage, ProviderPortal, ComparisonTestPage, ScholarshipInfoPage, TestPage, ProviderContactPage}; -use leptos::leptos_dom::log; use leptos::prelude::*; use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context}; use leptos_oidc::{Auth, AuthParameters, AuthSignal, Challenge}; @@ -65,15 +64,12 @@ pub fn AppWithRoutes() -> impl IntoView { provide_meta_context(); let current_origin = use_origin(); - log!("Current origin: {}", current_origin); // Authentication setup let parameters = AuthParameters { issuer: "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Lfjuy5zaM".into(), client_id: "10jr2h3vtpu9n7gj46pvg5qo2q".into(), redirect_uri: format!("{}/", use_origin()), - // redirect_uri: Url::parse(format!("{}", current_origin).as_str()).unwrap().to_string(), - // redirect_uri: Url::parse("http://localhost:3000").unwrap().to_string(), post_logout_redirect_uri: current_origin, scope: Some("openid%20profile%20email".into()), audience: None, @@ -105,7 +101,7 @@ pub fn AppWithRoutes() -> impl IntoView { - + diff --git a/src/components/mod.rs b/src/components/mod.rs index d9d9084..2de29d8 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -9,9 +9,10 @@ mod text_field; mod utils; mod validated_form; mod lists; +mod toasts; pub use self::{ action_button::*, banner::*, dashboard_button::*, lists::*, loading::*, multi_entry::*, panel::*, row::*, text_field::*, - validated_form::* + validated_form::*, toasts::* }; diff --git a/src/pages/api/comparisons.rs b/src/pages/api/comparisons.rs index ab757b9..a037abb 100644 --- a/src/pages/api/comparisons.rs +++ b/src/pages/api/comparisons.rs @@ -207,21 +207,7 @@ fn make_comp_list() -> Vec { "Academic Information", "Math SAT Score > 650", ); - - let service_hours_25 = ComparisonData::new( - "map_sum_comp", - "community_involvement", - ComparisonType::MapList(MapListComparison::FlattenToNumberList( - "service_hours".to_string(), - Box::new(NumberListComparison::Sum(Box::new( - NumberComparison::GreaterThanOrEqual, - ))), - )), - ValueType::Number(Some(25.to_string())), - "Community Service", - "25 service hours", - ); - + let service_hours_20 = ComparisonData::new( "service_hours_20", "community_involvement", @@ -233,7 +219,21 @@ fn make_comp_list() -> Vec { )), ValueType::Number(Some(20.to_string())), "Community Service", - "20 service hours", + "20+ service hours", + ); + + let service_hours_25 = ComparisonData::new( + "service_hours_25", + "community_involvement", + ComparisonType::MapList(MapListComparison::FlattenToNumberList( + "service_hours".to_string(), + Box::new(NumberListComparison::Sum(Box::new( + NumberComparison::GreaterThanOrEqual, + ))), + )), + ValueType::Number(Some(25.to_string())), + "Community Service", + "25+ service hours", ); let service_hours_30 = ComparisonData::new( @@ -273,7 +273,7 @@ fn make_comp_list() -> Vec { "attended_bas", ComparisonType::Text(TextComparison::Matches), ValueType::String(Some("Yes".to_string())), - "Miscellaneous", + "Additional Eligibility Factors", "Attended BAS", ); @@ -282,7 +282,7 @@ fn make_comp_list() -> Vec { "middsouth_church", ComparisonType::Text(TextComparison::Matches), ValueType::String(Some("Yes".to_string())), - "Miscellaneous", + "Additional Eligibility Factors", "Member of Midd-South Church", ); @@ -291,7 +291,7 @@ fn make_comp_list() -> Vec { "family_military_service", ComparisonType::Text(TextComparison::Matches), ValueType::String(Some("Yes".to_string())), - "Miscellaneous", + "Additional Eligibility Factors", "Family with Military Service", ); diff --git a/src/pages/loaner_page.rs b/src/pages/loaner_page.rs index 095ed8e..ca12850 100644 --- a/src/pages/loaner_page.rs +++ b/src/pages/loaner_page.rs @@ -8,7 +8,7 @@ use serde_dynamo::{from_item, to_item}; use crate::common::ValueType; use crate::common::ExpandableInfo; -use crate::components::{ActionButton, Banner, DashboardButton, OutlinedTextField, Panel, Row, Select, TextFieldType, ValidatedForm}; +use crate::components::{ActionButton, Banner, DashboardButton, OutlinedTextField, Panel, Row, Select, TextFieldType, Toast, ToastContext, ToastList, ValidatedForm}; use chrono::{FixedOffset, TimeZone}; use leptos::Params; use leptos::either::{Either, EitherOf3}; @@ -212,6 +212,7 @@ pub fn LoanerPage() -> impl IntoView { // We'll create the page here - the sidebar contains all the buttons, while the form // container either shows forms or shows placeholder text. view! { + impl IntoView { + } } @@ -257,6 +259,20 @@ pub fn LoanerBorrowForm() -> impl IntoView { } }); }; + + //#region Toast Logic + let mut toast_context = expect_context::(); + Effect::new(move || { + if let Some(Ok(_)) = create_entry_action.value().get() { + create_entry_action.clear(); + toast_context.toast( + Toast::new() + .id(uuid::Uuid::new_v4().to_string()) + .msg("From the form!") + ); + } + }); + //#endregion view! { diff --git a/src/pages/provider_portal.rs b/src/pages/provider_portal.rs index ea833c0..145901b 100644 --- a/src/pages/provider_portal.rs +++ b/src/pages/provider_portal.rs @@ -17,7 +17,7 @@ pub fn ProviderPortal() -> impl IntoView { title="Profile" description="Edit user profile" icon="/Person_Black.png" - path="/" + path="/providers/profile" /> @@ -630,7 +629,7 @@ fn ScholarshipForm(