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
+94 -89

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_meta::{MetaTags, Stylesheet, Title, provide_meta_context};
use leptos_oidc::AuthSignal;
@@ -61,10 +61,6 @@ pub fn AppWithRoutes() -> impl IntoView {
<ToastList>
// TODO Create a 404 page
<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 />
<LoanerRoutes />
</Routes>
+1 -1
View File
@@ -8,7 +8,7 @@ pub fn ActionButton(
) -> impl IntoView {
view! {
<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-gray-600", "pointer-events-none"], move || disabled.get())
r#type=button_type
+1 -1
View File
@@ -26,7 +26,7 @@ pub fn Header(
});
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">
{title}
</div>
+1 -1
View File
@@ -96,7 +96,7 @@ pub fn ChipsList(
view! {
<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>
<div class="flex flex-row flex-wrap gap-2 mb-1">
{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
// 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
[&>span]:opacity-0 peer-checked:[&>span]:opacity-100
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
// 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
[&>span]:opacity-0 peer-checked:[&>span]:opacity-100
peer-disabled:bg-gray-600/33 peer-disabled:border-gray-600
+1 -1
View File
@@ -3,7 +3,7 @@ use leptos::prelude::*;
#[component]
pub fn Loading() -> impl IntoView {
view! {
<div>
<div class="size-20 mx-auto">
<img src="/loading.gif" />
</div>
}
+5 -1
View File
@@ -149,7 +149,11 @@ pub fn ValidatedForm(
};
view! {
<form novalidate on:submit=submit_success_event>
<form
class="flex flex-col gap-2"
novalidate
on:submit=submit_success_event
>
<Header
title=title
description=description
+1 -1
View File
@@ -31,7 +31,7 @@ pub fn AuthCallbackPage() -> impl IntoView {
view! {
<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>
}
}
-11
View File
@@ -214,17 +214,6 @@ pub fn ProviderContactPage() -> impl IntoView {
required=true
/>
</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>
}
})
}}
+81 -65
View File
@@ -5,11 +5,11 @@ use leptos::logging::log;
use leptos::prelude::*;
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, Toast, ToastContext, ToastList, ValidatedForm};
use crate::common::{ComparisonData, ExpandableInfo, ScholarshipFormParams, SubmitStatus, ValueType};
use crate::components::{ActionButton, Banner, ChipsList, Header, Loading, OutlinedTextField, Panel, RadioList, Row, TextFieldType, Toast, ToastContext, ToastList, ValidatedForm};
use super::UnauthenticatedPage;
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
@@ -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! {
<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>
<p>
<p class="mb-3">
"Are you sure you want to delete "
{move || {
pending_delete
@@ -189,28 +206,16 @@ fn ScholarshipList(
.unwrap_or(&ValueType::String(None))
.as_string()
.unwrap_or_default()
.unwrap_or("<no name found>".to_string())
.unwrap_or("this unnamed scholarship".to_string())
})
}} "?"
</p>
<ActionButton
on:click=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(),
});
}
disabled=modal_disabled
>
"Confirm"
</ActionButton>
<ActionButton on:click=move |_| pending_delete.set(None)>"Cancel"</ActionButton>
<div class="flex mx-auto items-center justify-center">
<ActionButton on:click=modal_on_click_continue disabled=modal_disabled>
"Yes"
</ActionButton>
<ActionButton on:click=move |_| pending_delete.set(None)>"No"</ActionButton>
</div>
</dialog>
<div class="w-75">
<Panel>
@@ -298,7 +303,7 @@ fn ScholarshipListEntry(
let name = scholarship.data.get("name")
.unwrap_or(&ValueType::String(None))
.as_string().unwrap_or_default()
.unwrap_or("<no name found>".to_string());
.unwrap_or("Unnamed Scholarship".to_string());
// Button click handlers
let edit_click = {
@@ -403,18 +408,26 @@ fn ScholarshipForm(
}
);
Effect::new(move || {
let comparison_lists_sorted = Signal::derive(move || {
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| {
if let Some(Ok(map)) = comparison_lists.get() {
map.get(category).unwrap_or(&Vec::new()).clone()
} else {
Vec::new()
}
comparison_lists_sorted.get()
.get(category)
.cloned()
.unwrap_or(Vec::new())
};
let get_comp_ids = move |category: &str| {
@@ -519,8 +532,6 @@ fn ScholarshipForm(
//#endregion
let create_comps = ServerAction::<CreateTestComparisons>::new();
view! {
<Panel>
<Show
@@ -530,19 +541,19 @@ fn ScholarshipForm(
}
>
<Suspense fallback=Loading>
<ValidatedForm
on_submit=Callback::new(on_submit)
title="Scholarship Info Form"
description="Create or edit a scholarship. Input all information and click Submit."
>
{move || {
scholarship_info
.get()
.map(|res_scholarship| {
match res_scholarship {
Ok(_) => {
Either::Left(
view! {
{move || {
scholarship_info
.get()
.map(|res_scholarship| {
match res_scholarship {
Ok(_) => {
Either::Left(
view! {
<ValidatedForm
on_submit=Callback::new(on_submit)
title="Scholarship Info Form"
description="Create or edit a scholarship. Input all information and click Submit."
>
<Row>
<OutlinedTextField
label="Scholarship Name"
@@ -604,7 +615,7 @@ fn ScholarshipForm(
<RadioList
data_member="award_to"
data_map=form_data
items=vec!["School".to_string(), "Student".to_string()]
items=vec!["University".to_string(), "Student".to_string()]
disabled=elements_disabled
label="Will the award be made to the school or the student?"
/>
@@ -626,6 +637,11 @@ fn ScholarshipForm(
other_prompt="Custom prompt..."
/>
</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>
<ChipsList
label="GPA Requirements"
@@ -633,6 +649,7 @@ fn ScholarshipForm(
data_map=chips_data
values=gpa_ids
displayed_text=gpa_text
allows_multiple=false
/>
</Row>
<Row>
@@ -651,6 +668,7 @@ fn ScholarshipForm(
data_map=chips_data
values=comm_ids
displayed_text=comm_text
allows_multiple=false
/>
</Row>
<Row>
@@ -660,6 +678,7 @@ fn ScholarshipForm(
data_map=chips_data
values=res_ids
displayed_text=res_text
allows_multiple=false
/>
</Row>
<Row>
@@ -680,24 +699,21 @@ fn ScholarshipForm(
displayed_text=misc_text
/>
</Row>
},
)
}
Err(err) => {
Either::Right(
view! {
<p>"Error while getting scholarship: "{err.to_string()}</p>
},
)
}
</ValidatedForm>
},
)
}
})
.collect_view()
}}
</ValidatedForm>
<ActionButton on:click=move |_| {
create_comps.dispatch(CreateTestComparisons {});
}>"Create Comparisons"</ActionButton>
Err(err) => {
Either::Right(
view! {
<p>"Error while getting scholarship: "{err.to_string()}</p>
},
)
}
}
})
.collect_view()
}}
</Suspense>
</Show>
</Panel>