A massive, unorganized PR. #44

Merged
BobdaFett merged 15 commits from feature/categorize-chips into main 2026-01-13 09:50:27 +00:00
6 changed files with 46 additions and 34 deletions
Showing only changes of commit f479fb8030 - Show all commits

No files matched your search

+1 -5
View File
@@ -1,5 +1,4 @@
use crate::pages::{AboutPage, HomePage, LoanerPage, ProviderPortal, ComparisonTestPage, ScholarshipInfoPage, TestPage, ProviderContactPage}; use crate::pages::{AboutPage, HomePage, LoanerPage, ProviderPortal, ComparisonTestPage, ScholarshipInfoPage, TestPage, ProviderContactPage};
use leptos::leptos_dom::log;
use leptos::prelude::*; use leptos::prelude::*;
use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context}; use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context};
use leptos_oidc::{Auth, AuthParameters, AuthSignal, Challenge}; use leptos_oidc::{Auth, AuthParameters, AuthSignal, Challenge};
@@ -65,15 +64,12 @@ pub fn AppWithRoutes() -> impl IntoView {
provide_meta_context(); provide_meta_context();
let current_origin = use_origin(); let current_origin = use_origin();
log!("Current origin: {}", current_origin);
// Authentication setup // Authentication setup
let parameters = AuthParameters { let parameters = AuthParameters {
issuer: "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Lfjuy5zaM".into(), issuer: "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Lfjuy5zaM".into(),
client_id: "10jr2h3vtpu9n7gj46pvg5qo2q".into(), client_id: "10jr2h3vtpu9n7gj46pvg5qo2q".into(),
redirect_uri: format!("{}/", use_origin()), 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, post_logout_redirect_uri: current_origin,
scope: Some("openid%20profile%20email".into()), scope: Some("openid%20profile%20email".into()),
audience: None, audience: None,
@@ -105,7 +101,7 @@ pub fn AppWithRoutes() -> impl IntoView {
<Route path=path!("/test_page") view=TestPage/> <Route path=path!("/test_page") view=TestPage/>
<Route path=path!("/comparison") view=ComparisonTestPage /> <Route path=path!("/comparison") view=ComparisonTestPage />
<Route path=path!("/providers") view=ProviderPortal/> <Route path=path!("/providers") view=ProviderPortal/>
<Route path=path!("/providers/contact") view=ProviderContactPage /> <Route path=path!("/providers/profile") view=ProviderContactPage />
<ParentRoute path=path!("/providers/scholarships") view=ScholarshipInfoPage> <ParentRoute path=path!("/providers/scholarships") view=ScholarshipInfoPage>
<Route path=path!(":id") view=ScholarshipInfoPage/> <Route path=path!(":id") view=ScholarshipInfoPage/>
<Route path=path!("") view=ScholarshipInfoPage/> <Route path=path!("") view=ScholarshipInfoPage/>
+2 -1
View File
@@ -9,9 +9,10 @@ mod text_field;
mod utils; mod utils;
mod validated_form; mod validated_form;
mod lists; mod lists;
mod toasts;
pub use self::{ pub use self::{
action_button::*, banner::*, dashboard_button::*, lists::*, action_button::*, banner::*, dashboard_button::*, lists::*,
loading::*, multi_entry::*, panel::*, row::*, text_field::*, loading::*, multi_entry::*, panel::*, row::*, text_field::*,
validated_form::* validated_form::*, toasts::*
}; };
+19 -19
View File
@@ -207,21 +207,7 @@ fn make_comp_list() -> Vec<ComparisonData> {
"Academic Information", "Academic Information",
"Math SAT Score > 650", "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( let service_hours_20 = ComparisonData::new(
"service_hours_20", "service_hours_20",
"community_involvement", "community_involvement",
@@ -233,7 +219,21 @@ fn make_comp_list() -> Vec<ComparisonData> {
)), )),
ValueType::Number(Some(20.to_string())), ValueType::Number(Some(20.to_string())),
"Community Service", "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( let service_hours_30 = ComparisonData::new(
@@ -273,7 +273,7 @@ fn make_comp_list() -> Vec<ComparisonData> {
"attended_bas", "attended_bas",
ComparisonType::Text(TextComparison::Matches), ComparisonType::Text(TextComparison::Matches),
ValueType::String(Some("Yes".to_string())), ValueType::String(Some("Yes".to_string())),
"Miscellaneous", "Additional Eligibility Factors",
"Attended BAS", "Attended BAS",
); );
@@ -282,7 +282,7 @@ fn make_comp_list() -> Vec<ComparisonData> {
"middsouth_church", "middsouth_church",
ComparisonType::Text(TextComparison::Matches), ComparisonType::Text(TextComparison::Matches),
ValueType::String(Some("Yes".to_string())), ValueType::String(Some("Yes".to_string())),
"Miscellaneous", "Additional Eligibility Factors",
"Member of Midd-South Church", "Member of Midd-South Church",
); );
@@ -291,7 +291,7 @@ fn make_comp_list() -> Vec<ComparisonData> {
"family_military_service", "family_military_service",
ComparisonType::Text(TextComparison::Matches), ComparisonType::Text(TextComparison::Matches),
ValueType::String(Some("Yes".to_string())), ValueType::String(Some("Yes".to_string())),
"Miscellaneous", "Additional Eligibility Factors",
"Family with Military Service", "Family with Military Service",
); );
+17 -1
View File
@@ -8,7 +8,7 @@ use serde_dynamo::{from_item, to_item};
use crate::common::ValueType; use crate::common::ValueType;
use crate::common::ExpandableInfo; 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 chrono::{FixedOffset, TimeZone};
use leptos::Params; use leptos::Params;
use leptos::either::{Either, EitherOf3}; 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 // We'll create the page here - the sidebar contains all the buttons, while the form
// container either shows forms or shows placeholder text. // container either shows forms or shows placeholder text.
view! { view! {
<ToastList>
<Banner <Banner
title="Chromebook Loaners" title="Chromebook Loaners"
logo="/PHS_Stacked_Acronym.png" logo="/PHS_Stacked_Acronym.png"
@@ -238,6 +239,7 @@ pub fn LoanerPage() -> impl IntoView {
</div> </div>
</div> </div>
</div> </div>
</ToastList>
} }
} }
@@ -257,6 +259,20 @@ pub fn LoanerBorrowForm() -> impl IntoView {
} }
}); });
}; };
//#region Toast Logic
let mut toast_context = expect_context::<ToastContext>();
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! { view! {
<ValidatedForm on_submit=Callback::new(on_submit)> <ValidatedForm on_submit=Callback::new(on_submit)>
+1 -1
View File
@@ -17,7 +17,7 @@ pub fn ProviderPortal() -> impl IntoView {
title="Profile" title="Profile"
description="Edit user profile" description="Edit user profile"
icon="/Person_Black.png" icon="/Person_Black.png"
path="/" path="/providers/profile"
/> />
<DashboardButton <DashboardButton
title="Create Scholarship" title="Create Scholarship"
+6 -7
View File
@@ -3,14 +3,13 @@ use leptos::either::Either;
use leptos::html::Dialog; use leptos::html::Dialog;
use leptos::logging::log; use leptos::logging::log;
use leptos::prelude::*; use leptos::prelude::*;
use leptos::task::spawn_local;
use leptos_oidc::{AuthLoaded, Authenticated}; use leptos_oidc::{AuthLoaded, Authenticated};
use leptos_router::hooks::{use_navigate, use_params}; use leptos_router::hooks::{use_navigate, use_params};
use crate::common::{ExpandableInfo, ScholarshipFormParams, SubmitStatus, ValueType}; use crate::common::{ExpandableInfo, ScholarshipFormParams, SubmitStatus, ValueType};
use crate::components::{ActionButton, Banner, ChipsList, Loading, OutlinedTextField, Panel, RadioList, Row, TextFieldType, ValidatedForm}; use crate::components::{ActionButton, Banner, ChipsList, Loading, OutlinedTextField, Panel, RadioList, Row, TextFieldType, ValidatedForm};
use super::UnauthenticatedPage; use super::UnauthenticatedPage;
use crate::pages::utils::get_user_claims; use crate::pages::utils::get_user_claims;
use super::api::{get_comparison_info, get_provider_scholarships, get_scholarship_info, CreateScholarshipInfo, RegisterScholarship, DeleteProviderScholarship, get_comparisons_categorized, create_test_comparisons, CreateTestComparisons}; use super::api::{get_comparison_info, get_provider_scholarships, get_scholarship_info, CreateScholarshipInfo, RegisterScholarship, DeleteProviderScholarship, get_comparisons_categorized, CreateTestComparisons};
/// # Scholarship Info Page /// # Scholarship Info Page
@@ -461,8 +460,8 @@ fn ScholarshipForm(
let sports_ids = Signal::derive(move || get_comp_ids("Sports Participation")); let sports_ids = Signal::derive(move || get_comp_ids("Sports Participation"));
let sports_text = Signal::derive(move || get_comp_text("Sports Participation")); let sports_text = Signal::derive(move || get_comp_text("Sports Participation"));
let misc_ids = Signal::derive(move || get_comp_ids("Miscellaneous")); let misc_ids = Signal::derive(move || get_comp_ids("Additional Eligibility Factors"));
let misc_text = Signal::derive(move || get_comp_text("Miscellaneous")); let misc_text = Signal::derive(move || get_comp_text("Additional Eligibility Factors"));
let comm_ids = Signal::derive(move || get_comp_ids("Community Service")); let comm_ids = Signal::derive(move || get_comp_ids("Community Service"));
let comm_text = Signal::derive(move || get_comp_text("Community Service")); let comm_text = Signal::derive(move || get_comp_text("Community Service"));
@@ -539,7 +538,7 @@ fn ScholarshipForm(
</Row> </Row>
<Row> <Row>
<OutlinedTextField <OutlinedTextField
label="Total amount of all awards:" label="Total amount of all award(s): (estimates are acceptable)"
placeholder="Enter an amount..." placeholder="Enter an amount..."
disabled=elements_disabled disabled=elements_disabled
data_member="total_awards" data_member="total_awards"
@@ -553,7 +552,7 @@ fn ScholarshipForm(
data_map=form_data data_map=form_data
items=vec!["Yes".to_string(), "No".to_string()] items=vec!["Yes".to_string(), "No".to_string()]
disabled=elements_disabled disabled=elements_disabled
label="Do you require student financial information?" label="Do you require student FAFSA information?"
/> />
</Row> </Row>
<Row> <Row>
@@ -630,7 +629,7 @@ fn ScholarshipForm(
</Row> </Row>
<Row> <Row>
<ChipsList <ChipsList
label="Miscellaneous" label="Additional Eligibility Factors"
data_member="misc" data_member="misc"
data_map=chips_data data_map=chips_data
values=misc_ids values=misc_ids