feat: implement other field for radio buttons
This commit is contained in:
1 parent
1d58e99878
commit
b19b696490
4 files changed
+149
-38
No files matched your search
@@ -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
|
||||
|
||||
@@ -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")]
|
||||
|
||||
+2
-24
@@ -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::<String, Vec<ComparisonData>>::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! {
|
||||
<AuthLoaded fallback=Loading>
|
||||
<Authenticated unauthenticated=UnauthenticatedPage>
|
||||
@@ -331,6 +308,7 @@ pub fn HomePage() -> impl IntoView {
|
||||
data_member="town"
|
||||
data_map=form_data
|
||||
required=true
|
||||
other_prompt="Other..."
|
||||
/>
|
||||
</Row>
|
||||
<Row>
|
||||
|
||||
Reference in new issue
Block a user