feat: some comparison naming and category changes

This commit is contained in:
alphafetus committed 2026-01-09 10:35:12 -05:00
1 parent 0401027e7d
commit f479fb8030
6 files changed
+46 -34

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 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 {
<Route path=path!("/test_page") view=TestPage/>
<Route path=path!("/comparison") view=ComparisonTestPage />
<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>
<Route path=path!(":id") view=ScholarshipInfoPage/>
<Route path=path!("") view=ScholarshipInfoPage/>
+2 -1
View File
@@ -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::*
};
+19 -19
View File
@@ -207,21 +207,7 @@ fn make_comp_list() -> Vec<ComparisonData> {
"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<ComparisonData> {
)),
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<ComparisonData> {
"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<ComparisonData> {
"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<ComparisonData> {
"family_military_service",
ComparisonType::Text(TextComparison::Matches),
ValueType::String(Some("Yes".to_string())),
"Miscellaneous",
"Additional Eligibility Factors",
"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::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! {
<ToastList>
<Banner
title="Chromebook Loaners"
logo="/PHS_Stacked_Acronym.png"
@@ -238,6 +239,7 @@ pub fn LoanerPage() -> impl IntoView {
</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! {
<ValidatedForm on_submit=Callback::new(on_submit)>
+1 -1
View File
@@ -17,7 +17,7 @@ pub fn ProviderPortal() -> impl IntoView {
title="Profile"
description="Edit user profile"
icon="/Person_Black.png"
path="/"
path="/providers/profile"
/>
<DashboardButton
title="Create Scholarship"
+6 -7
View File
@@ -3,14 +3,13 @@ use leptos::either::Either;
use leptos::html::Dialog;
use leptos::logging::log;
use leptos::prelude::*;
use leptos::task::spawn_local;
use leptos_oidc::{AuthLoaded, Authenticated};
use leptos_router::hooks::{use_navigate, use_params};
use crate::common::{ExpandableInfo, ScholarshipFormParams, SubmitStatus, ValueType};
use crate::components::{ActionButton, Banner, ChipsList, Loading, OutlinedTextField, Panel, RadioList, Row, TextFieldType, ValidatedForm};
use super::UnauthenticatedPage;
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
@@ -461,8 +460,8 @@ fn ScholarshipForm(
let sports_ids = Signal::derive(move || get_comp_ids("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_text = Signal::derive(move || get_comp_text("Miscellaneous"));
let misc_ids = Signal::derive(move || get_comp_ids("Additional Eligibility Factors"));
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_text = Signal::derive(move || get_comp_text("Community Service"));
@@ -539,7 +538,7 @@ fn ScholarshipForm(
</Row>
<Row>
<OutlinedTextField
label="Total amount of all awards:"
label="Total amount of all award(s): (estimates are acceptable)"
placeholder="Enter an amount..."
disabled=elements_disabled
data_member="total_awards"
@@ -553,7 +552,7 @@ fn ScholarshipForm(
data_map=form_data
items=vec!["Yes".to_string(), "No".to_string()]
disabled=elements_disabled
label="Do you require student financial information?"
label="Do you require student FAFSA information?"
/>
</Row>
<Row>
@@ -630,7 +629,7 @@ fn ScholarshipForm(
</Row>
<Row>
<ChipsList
label="Miscellaneous"
label="Additional Eligibility Factors"
data_member="misc"
data_map=chips_data
values=misc_ids