diff --git a/Cargo.lock b/Cargo.lock index db3a98b..7b7a06a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,12 +26,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -704,17 +698,16 @@ checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", "wasm-bindgen", - "windows-link", + "windows-link 0.2.0", ] [[package]] @@ -2945,6 +2938,7 @@ dependencies = [ "aws-config", "aws-sdk-dynamodb", "axum", + "chrono", "console_error_panic_hook", "leptos", "leptos_axum", @@ -3965,7 +3959,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -3998,13 +3992,19 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + [[package]] name = "windows-result" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4013,7 +4013,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4065,7 +4065,7 @@ version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/Cargo.toml b/Cargo.toml index 57d7b92..017d911 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ url = "2.5.4" macros = { path = "./macros" } traits = { path = "./traits" } +chrono = { version = "0.4.42", features = ["serde"] } [features] hydrate = [ diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 08dbc4d..324e386 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, Data, Ident}; +use syn::{Data, Ident, parse_macro_input}; /// Derives the `AsReactive` and `ReactiveCapture` traits for a struct, while also /// providing a new reactive struct with the same field names, but they are wrapped diff --git a/src/app.rs b/src/app.rs index ba349be..2dc3611 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,11 +1,9 @@ use leptos::prelude::*; -use leptos_meta::{provide_meta_context, MetaTags, Stylesheet, Title}; -use leptos_oidc::{ - Auth, AuthParameters, AuthSignal, Challenge, LoginLink, -}; +use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context}; +use leptos_oidc::{Auth, AuthParameters, AuthSignal, Challenge, LoginLink}; use leptos_router::{ - components::{Route, Router, Routes}, StaticSegment, + components::{Route, Router, Routes}, }; use url::Url; @@ -47,7 +45,7 @@ pub fn App() -> impl IntoView { let auth = Auth::signal(); provide_context(auth); // allows use of this signal in lower areas of the tree without - // explicitly passing it through the html tree + // explicitly passing it through the html tree let _ = Auth::init(parameters); diff --git a/src/common/student_info.rs b/src/common/student_info.rs index db955e9..1533782 100644 --- a/src/common/student_info.rs +++ b/src/common/student_info.rs @@ -1,6 +1,8 @@ +use crate::components::MultiEntryData; use macros::Reactive; use serde::{Deserialize, Serialize}; use std::default::Default; +use chrono::{DateTime, Utc}; /// Represents information about a student. #[derive(Serialize, Deserialize, Debug, Clone, Reactive, Default)] @@ -22,4 +24,22 @@ pub struct StudentInfo { /// The student's desired contact email. #[serde(default)] pub contact_email: String, + /// The student's address. + #[serde(default)] + pub address: String, + /// The student's town of residence. + #[serde(default)] + pub town: String, + /// The student's entered phone number. + #[serde(default)] + pub phone_number: String, // May be stored as a straight number in the future. + /// The student's birthdate. + #[serde(default)] + pub birth_date: DateTime, + /// The student's gender. + #[serde(default)] + pub gender: String, + /// The student's athletic information. + #[serde(default)] + pub athletic_info: Vec, } diff --git a/src/components/checkbox.rs b/src/components/checkbox.rs index 579614e..2a3bb53 100644 --- a/src/components/checkbox.rs +++ b/src/components/checkbox.rs @@ -45,9 +45,11 @@ pub fn CheckboxList( #[prop(default = RwSignal::new(vec![]))] selected: RwSignal>, #[prop()] items: Vec, #[prop(default = RwSignal::new(false))] disabled: RwSignal, + #[prop(optional, into)] label: String, ) -> impl IntoView { view! { -
+
+ {label} {items .into_iter() .map(|item| { diff --git a/src/components/multi_entry.rs b/src/components/multi_entry.rs index 9cb9c4a..ec8476a 100644 --- a/src/components/multi_entry.rs +++ b/src/components/multi_entry.rs @@ -87,14 +87,14 @@ pub fn Entry( #[prop()] info_member: Signal, ) -> impl IntoView { - let nameData = entry_data.data.get(&name_member.get().member_name).unwrap(); - let infoData = entry_data.data.get(&info_member.get().member_name).unwrap(); + let name_data = entry_data.data.get(&name_member.get().member_name).unwrap(); + let info_data = entry_data.data.get(&info_member.get().member_name).unwrap(); view! { // This div MUST have the same spacing CSS as the second-level header div
- {nameData.as_string()} - {infoData.as_string()} + {name_data.as_string()} + {info_data.as_string()}
} } diff --git a/src/components/panel.rs b/src/components/panel.rs index 33e54de..83c32e7 100644 --- a/src/components/panel.rs +++ b/src/components/panel.rs @@ -2,11 +2,11 @@ use leptos::prelude::*; /// A panel for use in visual separation of a group of components. A `Panel` arranges /// a series of elements within a shaded rectangle using the flexbox column layout. -/// +/// /// It takes a series of children. Usually these would be in the form of a `Row` element, /// which will arrange its own children in a row within the panel, however it can be any /// HTML element. -/// +/// /// Example: /// ``` /// view! { @@ -24,14 +24,16 @@ use leptos::prelude::*; /// ``` #[component] pub fn Panel( - children: Children + #[prop(optional, default = false)] hidden: bool, + #[prop(optional)] children: Option ) -> impl IntoView { view! {
- {children()} + rounded-md shadow-[0_0_6px_rgba(0,0,0,0.50)]" + class=(["hidden"], hidden) > + {children.and_then(move |t| {Some(t())})}
} } diff --git a/src/components/radio.rs b/src/components/radio.rs index ad94b92..0123571 100644 --- a/src/components/radio.rs +++ b/src/components/radio.rs @@ -45,9 +45,11 @@ pub fn RadioList( #[prop(default = RwSignal::new(String::new()))] selected: RwSignal, #[prop()] items: Vec, #[prop(default = RwSignal::new(false))] disabled: RwSignal, + #[prop(optional, into)] label: String, ) -> impl IntoView { view! { -
+
+ {label} {items .into_iter() .map(|item| { diff --git a/src/components/row.rs b/src/components/row.rs index da12adb..7bcbc19 100644 --- a/src/components/row.rs +++ b/src/components/row.rs @@ -1,9 +1,7 @@ use leptos::prelude::*; #[component] -pub fn Row( - children: Children -) -> impl IntoView { +pub fn Row(children: Children) -> impl IntoView { view! {
{children()} diff --git a/src/components/select.rs b/src/components/select.rs index a5ad616..20c6f60 100644 --- a/src/components/select.rs +++ b/src/components/select.rs @@ -8,15 +8,15 @@ use leptos::prelude::*; pub fn Select( #[prop(default = vec!["Test Value".into()])] value_list: Vec, #[prop(default = RwSignal::new("".into()))] value: RwSignal, - #[prop(default = RwSignal::new("".into()))] label: RwSignal, + #[prop(optional, into)] label: String, #[prop(default = RwSignal::new(false))] disabled: RwSignal, ) -> impl IntoView { view! { -
-