diff --git a/src/pages/api/comparisons.rs b/src/pages/api/comparisons.rs
index b60acef..daf1339 100644
--- a/src/pages/api/comparisons.rs
+++ b/src/pages/api/comparisons.rs
@@ -15,6 +15,7 @@ use crate::common::{
use leptos::prelude::ServerFnError;
use leptos::server;
+#[cfg(feature = "ssr")]
static COMPARISONS_TABLE: &str = "leptos-comparison-test";
/// Helper function to create all sports comparisons. Only used to create initial
diff --git a/src/pages/api/scholarships.rs b/src/pages/api/scholarships.rs
index aaf5d47..d467a2e 100644
--- a/src/pages/api/scholarships.rs
+++ b/src/pages/api/scholarships.rs
@@ -17,6 +17,7 @@ use crate::common::ExpandableInfo;
use leptos::prelude::ServerFnError;
use leptos::server;
+#[cfg(feature = "ssr")]
static SCHOLARSHIPS_TABLE: &str = "leptos-scholarship-test";
#[server(GetScholarshipInfo, endpoint = "/scholarship/info/get")]
diff --git a/src/pages/home_page.rs b/src/pages/home_page.rs
index 6c47dcc..3481a5b 100644
--- a/src/pages/home_page.rs
+++ b/src/pages/home_page.rs
@@ -8,7 +8,7 @@ use std::process::{Command, Stdio};
#[cfg(feature = "ssr")]
use std::io::Write;
-use crate::common::{ComparisonData, ExpandableInfo};
+use crate::common::ExpandableInfo;
use crate::pages::UnauthenticatedPage;
use crate::pages::utils::get_user_claims;
use crate::components::{ActionButton, CheckboxList, Loading, MultiEntry, OutlinedTextField, Panel, RadioList, Row, Select, TextFieldType, ValidatedForm};
@@ -22,7 +22,6 @@ use leptos::task::spawn_local;
use leptos::web_sys::HtmlAnchorElement;
use leptos::wasm_bindgen::JsCast;
use std::collections::HashMap;
-use crate::pages::api::get_comparisons_categorized;
/// # Get Student Info
/// Gets a student's information given their `subject`.
@@ -210,28 +209,6 @@ pub fn HomePage() -> impl IntoView {
};
//#endregion
- let comparison_resource = Resource::new(
- move || user_subject.get(),
- async move |_| get_comparisons_categorized().await
- );
-
- let comparison_info = RwSignal::new(HashMap::
>::new());
-
- Effect::new(move || {
- match comparison_resource.get() {
- Some(Ok(comparisons)) => {
- log!("Found comparison info: {:?}", comparisons);
- comparison_info.set(comparisons);
- }
- Some(Err(err)) => {
- log!("Error while getting comparisons: {:?}", err);
- }
- _ => {
- log!("An unknown error occurred.");
- }
- }
- });
-
view! {
@@ -333,6 +310,7 @@ pub fn HomePage() -> impl IntoView {
data_member="town"
data_map=form_data
required=true
+ other_prompt="Other..."
/>
diff --git a/src/pages/scholarship_info.rs b/src/pages/scholarship_info.rs
index df41afd..69130ac 100644
--- a/src/pages/scholarship_info.rs
+++ b/src/pages/scholarship_info.rs
@@ -361,42 +361,7 @@ fn ScholarshipForm(
/// submission fails, this function is not run.
#[prop(into)] on_submit: Callback<()>
) -> impl IntoView {
- let submit_action = ServerAction::::new();
-
- let submit_status = RwSignal::new(SubmitStatus::Idle);
- let elements_disabled = Signal::derive(move || {
- matches!(submit_action.pending().get(), true)
- });
-
- Effect::new(move || {
- if submit_action.pending().get() {
- submit_status.set(SubmitStatus::Sending);
- return;
- }
-
- if let Some(result) = submit_action.value().get() {
- match result {
- Ok(()) => {
- submit_status.set(SubmitStatus::Success);
- on_submit.run(());
- },
- Err(_err) => submit_status.set(SubmitStatus::Error(()))
- }
- }
- });
-
- let comparison_lists = Resource::new(
- move || scholarship_id.get().is_some(),
- async move |_| {
- get_comparisons_categorized().await
- }
- );
-
- Effect::new(move || {
- if let Some(Ok(map)) = comparison_lists.get() {
- log!("Available categories: {:?}", map.keys());
- }
- });
+ //#region Form Data Setup
let scholarship_info = Resource::new(
move || scholarship_id.get(),
@@ -428,6 +393,22 @@ fn ScholarshipForm(
}
});
+ //#endregion
+ //#region Comparison Logic
+
+ let comparison_lists = Resource::new(
+ move || scholarship_id.get().is_some(),
+ async move |_| {
+ get_comparisons_categorized().await
+ }
+ );
+
+ Effect::new(move || {
+ if let Some(Ok(map)) = comparison_lists.get() {
+ log!("Available categories: {:?}", map.keys());
+ }
+ });
+
let get_comp_category = move |category: &str| {
if let Some(Ok(map)) = comparison_lists.get() {
map.get(category).unwrap_or(&Vec::new()).clone()
@@ -469,6 +450,33 @@ fn ScholarshipForm(
let major_ids = Signal::derive(move || get_comp_ids("Majors"));
let major_text = Signal::derive(move || get_comp_text("Majors"));
+ //#endregion
+ //#region Submission Logic
+
+ let submit_action = ServerAction::::new();
+
+ let submit_status = RwSignal::new(SubmitStatus::Idle);
+ let elements_disabled = Signal::derive(move || {
+ matches!(submit_action.pending().get(), true)
+ });
+
+ Effect::new(move || {
+ if submit_action.pending().get() {
+ submit_status.set(SubmitStatus::Sending);
+ return;
+ }
+
+ if let Some(result) = submit_action.value().get() {
+ match result {
+ Ok(()) => {
+ submit_status.set(SubmitStatus::Success);
+ on_submit.run(());
+ },
+ Err(_err) => submit_status.set(SubmitStatus::Error(()))
+ }
+ }
+ });
+
let mut toasts = expect_context::();
let on_submit = move |_| {
@@ -481,7 +489,7 @@ fn ScholarshipForm(
info
});
};
-
+
Effect::new(move || {
submit_action.value().get().is_some()
.then(|| {
@@ -496,6 +504,8 @@ fn ScholarshipForm(
});
});
+ //#endregion
+
let create_comps = ServerAction::::new();
view! {
@@ -586,25 +596,21 @@ fn ScholarshipForm(
label="Will the award be made to the school or the student?"
/>
-
-
-