Merge pull request #55 from R15-Software-Dev/ci/remove-debug-info

Release preparation for forms
This commit was merged in pull request #55.
This commit is contained in:
Lucas Vas authored and GitHub committed 2026-01-16 23:18:48 -05:00
commit 444e5ffb72
10 files changed
+95 -90

No files matched your search

+1 -5
View File
@@ -1,4 +1,4 @@
use crate::pages::{AboutPage, HomePage, ProviderPortal, ComparisonTestPage, ScholarshipInfoPage, TestPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage}; use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage};
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::AuthSignal; use leptos_oidc::AuthSignal;
@@ -61,10 +61,6 @@ pub fn AppWithRoutes() -> impl IntoView {
<ToastList> <ToastList>
// TODO Create a 404 page // TODO Create a 404 page
<Routes fallback=|| "Page not found.".into_view()> <Routes fallback=|| "Page not found.".into_view()>
<Route path=path!("") view=HomePage />
<Route path=path!("/about") view=AboutPage />
<Route path=path!("/test_page") view=TestPage />
<Route path=path!("/comparison") view=ComparisonTestPage />
<ProviderRoutes /> <ProviderRoutes />
<LoanerRoutes /> <LoanerRoutes />
</Routes> </Routes>
+1 -1
View File
@@ -8,7 +8,7 @@ pub fn ActionButton(
) -> impl IntoView { ) -> impl IntoView {
view! { view! {
<button <button
class="m-1.5 p-2.5 rounded-lg font-semibold text-white transition-all duration-400 cursor-pointer" class="m-1.5 p-2.5 min-w-20 rounded-lg font-semibold text-white transition-all duration-400 cursor-pointer"
class=(["bg-red-800", "hover:bg-red-900"], move || !disabled.get()) class=(["bg-red-800", "hover:bg-red-900"], move || !disabled.get())
class=(["bg-gray-600", "pointer-events-none"], move || disabled.get()) class=(["bg-gray-600", "pointer-events-none"], move || disabled.get())
r#type=button_type r#type=button_type
+1 -1
View File
@@ -26,7 +26,7 @@ pub fn Header(
}); });
view! { view! {
<div class="m-1.5 mb-5"> <div class="flex flex-col gap-2 m-1.5 mt-3 mb-5">
<div class="text-3xl font-bold"> <div class="text-3xl font-bold">
{title} {title}
</div> </div>
+1 -1
View File
@@ -96,7 +96,7 @@ pub fn ChipsList(
view! { view! {
<div class="flex flex-col"> <div class="flex flex-col">
<div class="m-1.5 mt-0 mb-0"> <div class="flex flex-col gap-2 m-1.5 mt-0 mb-0">
<span class="font-bold">{label}</span> <span class="font-bold">{label}</span>
<div class="flex flex-row flex-wrap gap-2 mb-1"> <div class="flex flex-row flex-wrap gap-2 mb-1">
{move || { {move || {
+2 -2
View File
@@ -31,7 +31,7 @@ pub fn Radio(
/> />
// This div displays the box for the checkbox, and applies some styling to the child // This div displays the box for the checkbox, and applies some styling to the child
// span element. // span element.
<div class="relative inline-block h-5 w-5 m-1 mr-2 rounded-full border border-gray-300 bg-white <div class="relative inline-block h-5 w-5 m-1 mr-2 rounded-full border border-gray-400 bg-white
transition-bg duration-200 peer-checked:bg-red-700 peer-checked:border-red-700 transition-bg duration-200 peer-checked:bg-red-700 peer-checked:border-red-700
[&>span]:opacity-0 peer-checked:[&>span]:opacity-100 [&>span]:opacity-0 peer-checked:[&>span]:opacity-100
peer-disabled:bg-gray-600/33 peer-disabled:border-gray-600 peer-disabled:bg-gray-600/33 peer-disabled:border-gray-600
@@ -107,7 +107,7 @@ fn RadioOther(
/> />
// This div displays the box for the checkbox, and applies some styling to the child // This div displays the box for the checkbox, and applies some styling to the child
// span element. // span element.
<div class="relative inline-block min-h-5 min-w-5 h-5 w-5 m-1 mr-2 rounded-full border border-gray-300 bg-white <div class="relative inline-block min-h-5 min-w-5 h-5 w-5 m-1 mr-2 rounded-full border border-gray-400 bg-white
transition-bg duration-200 peer-checked:bg-red-700 peer-checked:border-red-700 transition-bg duration-200 peer-checked:bg-red-700 peer-checked:border-red-700
[&>span]:opacity-0 peer-checked:[&>span]:opacity-100 [&>span]:opacity-0 peer-checked:[&>span]:opacity-100
peer-disabled:bg-gray-600/33 peer-disabled:border-gray-600 peer-disabled:bg-gray-600/33 peer-disabled:border-gray-600
+1 -1
View File
@@ -3,7 +3,7 @@ use leptos::prelude::*;
#[component] #[component]
pub fn Loading() -> impl IntoView { pub fn Loading() -> impl IntoView {
view! { view! {
<div> <div class="size-20 mx-auto">
<img src="/loading.gif" /> <img src="/loading.gif" />
</div> </div>
} }
+5 -1
View File
@@ -149,7 +149,11 @@ pub fn ValidatedForm(
}; };
view! { view! {
<form novalidate on:submit=submit_success_event> <form
class="flex flex-col gap-2"
novalidate
on:submit=submit_success_event
>
<Header <Header
title=title title=title
description=description description=description
+1 -1
View File
@@ -31,7 +31,7 @@ pub fn AuthCallbackPage() -> impl IntoView {
view! { view! {
<div class="flex flex-col w-full mx-auto items-center justify-center"> <div class="flex flex-col w-full mx-auto items-center justify-center">
<p>"Completing the login process..."</p> <p class="text-xl font-bold mt-10 mx-auto">"Logging you in..."</p>
</div> </div>
} }
} }
-11
View File
@@ -214,17 +214,6 @@ pub fn ProviderContactPage() -> impl IntoView {
required=true required=true
/> />
</Row> </Row>
<Row>
<OutlinedTextField
label="Testing Number"
placeholder="Just put a number"
disabled=elements_disabled
data_member="testing_number"
data_map=contact_info
input_type=TextFieldType::Number
required=true
/>
</Row>
} }
}) })
}} }}
+82 -66
View File
@@ -5,11 +5,11 @@ use leptos::logging::log;
use leptos::prelude::*; use leptos::prelude::*;
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::{ComparisonData, ExpandableInfo, ScholarshipFormParams, SubmitStatus, ValueType};
use crate::components::{ActionButton, Banner, ChipsList, Loading, OutlinedTextField, Panel, RadioList, Row, TextFieldType, Toast, ToastContext, ToastList, ValidatedForm}; use crate::components::{ActionButton, Banner, ChipsList, Header, Loading, OutlinedTextField, Panel, RadioList, Row, TextFieldType, Toast, ToastContext, ToastList, ValidatedForm};
use super::UnauthenticatedPage; use super::UnauthenticatedPage;
use crate::utils::get_user_claims; use crate::utils::get_user_claims;
use super::api::{get_provider_scholarships, get_scholarship_info, CreateScholarshipInfo, RegisterScholarship, DeleteProviderScholarship, get_comparisons_categorized, CreateTestComparisons}; use super::api::{get_provider_scholarships, get_scholarship_info, CreateScholarshipInfo, RegisterScholarship, DeleteProviderScholarship, get_comparisons_categorized};
/// # Scholarship Info Page /// # Scholarship Info Page
@@ -175,10 +175,27 @@ fn ScholarshipList(
} }
}); });
let modal_on_click_continue = move |_| {
let subject = pending_delete
.get()
.map(|s| s.subject.clone())
.unwrap_or_default();
log!("Deleting scholarship with subject {}", subject);
delete_action
.dispatch(DeleteProviderScholarship {
scholarship_id: subject,
provider_id: provider_id.get().unwrap_or_default(),
});
};
view! { view! {
<dialog node_ref=delete_dialog_ref class="m-auto p-2"> <dialog
node_ref=delete_dialog_ref
class="m-auto p-5 rounded-lg shadow-xl/50
backdrop:backdrop-blur-xs backdrop:transition-backdrop-filter"
>
<h2 class="text-2xl font-bold">"Confirm Deletion"</h2> <h2 class="text-2xl font-bold">"Confirm Deletion"</h2>
<p> <p class="mb-3">
"Are you sure you want to delete " "Are you sure you want to delete "
{move || { {move || {
pending_delete pending_delete
@@ -189,28 +206,16 @@ fn ScholarshipList(
.unwrap_or(&ValueType::String(None)) .unwrap_or(&ValueType::String(None))
.as_string() .as_string()
.unwrap_or_default() .unwrap_or_default()
.unwrap_or("<no name found>".to_string()) .unwrap_or("this unnamed scholarship".to_string())
}) })
}} "?" }} "?"
</p> </p>
<ActionButton <div class="flex mx-auto items-center justify-center">
on:click=move |_| { <ActionButton on:click=modal_on_click_continue disabled=modal_disabled>
let subject = pending_delete "Yes"
.get() </ActionButton>
.map(|s| s.subject.clone()) <ActionButton on:click=move |_| pending_delete.set(None)>"No"</ActionButton>
.unwrap_or_default(); </div>
log!("Deleting scholarship with subject {}", subject);
delete_action
.dispatch(DeleteProviderScholarship {
scholarship_id: subject,
provider_id: provider_id.get().unwrap_or_default(),
});
}
disabled=modal_disabled
>
"Confirm"
</ActionButton>
<ActionButton on:click=move |_| pending_delete.set(None)>"Cancel"</ActionButton>
</dialog> </dialog>
<div class="w-75"> <div class="w-75">
<Panel> <Panel>
@@ -298,7 +303,7 @@ fn ScholarshipListEntry(
let name = scholarship.data.get("name") let name = scholarship.data.get("name")
.unwrap_or(&ValueType::String(None)) .unwrap_or(&ValueType::String(None))
.as_string().unwrap_or_default() .as_string().unwrap_or_default()
.unwrap_or("<no name found>".to_string()); .unwrap_or("Unnamed Scholarship".to_string());
// Button click handlers // Button click handlers
let edit_click = { let edit_click = {
@@ -402,19 +407,27 @@ fn ScholarshipForm(
get_comparisons_categorized().await get_comparisons_categorized().await
} }
); );
Effect::new(move || { let comparison_lists_sorted = Signal::derive(move || {
if let Some(Ok(map)) = comparison_lists.get() { if let Some(Ok(map)) = comparison_lists.get() {
log!("Available categories: {:?}", map.keys()); let mut map = map.clone();
map
.into_iter()
.map(|(cat, mut list)| {
list.sort_by_key(|comp| comp.display_text.clone());
(cat, list)
})
.collect::<HashMap<String, Vec<ComparisonData>>>()
} else {
HashMap::new()
} }
}); });
let get_comp_category = move |category: &str| { let get_comp_category = move |category: &str| {
if let Some(Ok(map)) = comparison_lists.get() { comparison_lists_sorted.get()
map.get(category).unwrap_or(&Vec::new()).clone() .get(category)
} else { .cloned()
Vec::new() .unwrap_or(Vec::new())
}
}; };
let get_comp_ids = move |category: &str| { let get_comp_ids = move |category: &str| {
@@ -519,8 +532,6 @@ fn ScholarshipForm(
//#endregion //#endregion
let create_comps = ServerAction::<CreateTestComparisons>::new();
view! { view! {
<Panel> <Panel>
<Show <Show
@@ -530,19 +541,19 @@ fn ScholarshipForm(
} }
> >
<Suspense fallback=Loading> <Suspense fallback=Loading>
<ValidatedForm {move || {
on_submit=Callback::new(on_submit) scholarship_info
title="Scholarship Info Form" .get()
description="Create or edit a scholarship. Input all information and click Submit." .map(|res_scholarship| {
> match res_scholarship {
{move || { Ok(_) => {
scholarship_info Either::Left(
.get() view! {
.map(|res_scholarship| { <ValidatedForm
match res_scholarship { on_submit=Callback::new(on_submit)
Ok(_) => { title="Scholarship Info Form"
Either::Left( description="Create or edit a scholarship. Input all information and click Submit."
view! { >
<Row> <Row>
<OutlinedTextField <OutlinedTextField
label="Scholarship Name" label="Scholarship Name"
@@ -604,7 +615,7 @@ fn ScholarshipForm(
<RadioList <RadioList
data_member="award_to" data_member="award_to"
data_map=form_data data_map=form_data
items=vec!["School".to_string(), "Student".to_string()] items=vec!["University".to_string(), "Student".to_string()]
disabled=elements_disabled disabled=elements_disabled
label="Will the award be made to the school or the student?" label="Will the award be made to the school or the student?"
/> />
@@ -626,6 +637,11 @@ fn ScholarshipForm(
other_prompt="Custom prompt..." other_prompt="Custom prompt..."
/> />
</Row> </Row>
<Header
title="Eligibility Requirements"
description="Choose any requirements that this scholarship may have. If there are no extra requirements,
leave all options blank, however please note that this will apply all students to your scholarship."
/>
<Row> <Row>
<ChipsList <ChipsList
label="GPA Requirements" label="GPA Requirements"
@@ -633,6 +649,7 @@ fn ScholarshipForm(
data_map=chips_data data_map=chips_data
values=gpa_ids values=gpa_ids
displayed_text=gpa_text displayed_text=gpa_text
allows_multiple=false
/> />
</Row> </Row>
<Row> <Row>
@@ -651,6 +668,7 @@ fn ScholarshipForm(
data_map=chips_data data_map=chips_data
values=comm_ids values=comm_ids
displayed_text=comm_text displayed_text=comm_text
allows_multiple=false
/> />
</Row> </Row>
<Row> <Row>
@@ -660,6 +678,7 @@ fn ScholarshipForm(
data_map=chips_data data_map=chips_data
values=res_ids values=res_ids
displayed_text=res_text displayed_text=res_text
allows_multiple=false
/> />
</Row> </Row>
<Row> <Row>
@@ -680,24 +699,21 @@ fn ScholarshipForm(
displayed_text=misc_text displayed_text=misc_text
/> />
</Row> </Row>
}, </ValidatedForm>
) },
} )
Err(err) => {
Either::Right(
view! {
<p>"Error while getting scholarship: "{err.to_string()}</p>
},
)
}
} }
}) Err(err) => {
.collect_view() Either::Right(
}} view! {
</ValidatedForm> <p>"Error while getting scholarship: "{err.to_string()}</p>
<ActionButton on:click=move |_| { },
create_comps.dispatch(CreateTestComparisons {}); )
}>"Create Comparisons"</ActionButton> }
}
})
.collect_view()
}}
</Suspense> </Suspense>
</Show> </Show>
</Panel> </Panel>