PR with too many features #58
No files matched your search
+14
-1
@@ -1,4 +1,4 @@
|
|||||||
use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage};
|
use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage, StudentShell, StudentHomePage, StudentDemographicsPage};
|
||||||
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;
|
||||||
@@ -65,6 +65,7 @@ pub fn AppWithRoutes() -> impl IntoView {
|
|||||||
<ProviderRoutes />
|
<ProviderRoutes />
|
||||||
<LoanerRoutes />
|
<LoanerRoutes />
|
||||||
<AdminRoutes />
|
<AdminRoutes />
|
||||||
|
<StudentRoutes />
|
||||||
</Routes>
|
</Routes>
|
||||||
</ToastList>
|
</ToastList>
|
||||||
</main>
|
</main>
|
||||||
@@ -115,6 +116,18 @@ fn AdminRoutes() -> impl MatchNestedRoutes + Clone {
|
|||||||
.into_any_nested_route()
|
.into_any_nested_route()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[component(transparent)]
|
||||||
|
fn StudentRoutes() -> impl MatchNestedRoutes + Clone {
|
||||||
|
view! {
|
||||||
|
<ParentRoute path=path!("students") view=StudentShell>
|
||||||
|
<Route path=path!("home") view=StudentHomePage />
|
||||||
|
<Route path=path!("demographics") view=StudentDemographicsPage />
|
||||||
|
</ParentRoute>
|
||||||
|
}
|
||||||
|
.into_inner()
|
||||||
|
.into_any_nested_route()
|
||||||
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn AuthErrorView() -> impl IntoView {
|
pub fn AuthErrorView() -> impl IntoView {
|
||||||
let auth = use_context::<AuthSignal>().expect("AuthError: RwSignal<AuthStore> was not found");
|
let auth = use_context::<AuthSignal>().expect("AuthError: RwSignal<AuthStore> was not found");
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use leptos_router::components::Outlet;
|
|
||||||
use super::setup::provide_auth_context;
|
use super::setup::provide_auth_context;
|
||||||
|
|
||||||
///# Student Login Context Component
|
///# Student Login Context Component
|
||||||
@@ -16,7 +15,9 @@ use super::setup::provide_auth_context;
|
|||||||
/// </StudentLoginContext>
|
/// </StudentLoginContext>
|
||||||
/// }
|
/// }
|
||||||
#[component]
|
#[component]
|
||||||
pub fn StudentLoginContext() -> impl IntoView {
|
pub fn StudentLoginContext(
|
||||||
|
children: Children,
|
||||||
|
) -> impl IntoView {
|
||||||
provide_auth_context(
|
provide_auth_context(
|
||||||
crate::utils::use_origin(),
|
crate::utils::use_origin(),
|
||||||
"https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Lfjuy5zaM",
|
"https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Lfjuy5zaM",
|
||||||
@@ -24,5 +25,5 @@ pub fn StudentLoginContext() -> impl IntoView {
|
|||||||
"/students/callback"
|
"/students/callback"
|
||||||
);
|
);
|
||||||
|
|
||||||
view! { <Outlet /> }
|
view! { {children()} }
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ pub fn TabSidebarList(
|
|||||||
</For>
|
</For>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="flex flex-1">
|
<div class="flex flex-1 overflow-y-scroll">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-1
@@ -11,9 +11,10 @@ mod provider_contact;
|
|||||||
mod auth_callback;
|
mod auth_callback;
|
||||||
mod provider_applicants;
|
mod provider_applicants;
|
||||||
mod admin;
|
mod admin;
|
||||||
|
mod student;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
about_page::*, comparison_test::*, home_page::*, loaner_page::*, provider_portal::*,
|
about_page::*, comparison_test::*, home_page::*, loaner_page::*, provider_portal::*,
|
||||||
test_page::*, unauthenticated_page::*, scholarship_info::*, provider_contact::*,
|
test_page::*, unauthenticated_page::*, scholarship_info::*, provider_contact::*,
|
||||||
auth_callback::*, provider_applicants::*, admin::*
|
auth_callback::*, provider_applicants::*, admin::*, student::*,
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use leptos::prelude::*;
|
||||||
|
use crate::components::{OutlinedTextField, Select, TextFieldType, ValidatedForm};
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn StudentDemographicsPage() -> impl IntoView {
|
||||||
|
// This page should show a form that the students need to fill out.
|
||||||
|
// It's a simple form, really nothing more than a contact form.
|
||||||
|
// I'm going to test out creating this form without using a panel - we'll just use the page as
|
||||||
|
// it is with a specially spaced invisible div instead of a shaded container.
|
||||||
|
|
||||||
|
let data_map = RwSignal::new(HashMap::new());
|
||||||
|
|
||||||
|
view! {
|
||||||
|
<div class="flex flex-1" />
|
||||||
|
<div class="flex flex-col flex-2 mt-6">
|
||||||
|
<ValidatedForm title="Student Demographic Form" on_submit=move || {}>
|
||||||
|
// Inputs here.
|
||||||
|
<OutlinedTextField
|
||||||
|
label="First Name:"
|
||||||
|
data_map=data_map
|
||||||
|
data_member="first_name"
|
||||||
|
placeholder="John"
|
||||||
|
input_type=TextFieldType::Text
|
||||||
|
required=true
|
||||||
|
/>
|
||||||
|
<OutlinedTextField
|
||||||
|
label="Last Name:"
|
||||||
|
data_map=data_map
|
||||||
|
data_member="last_name"
|
||||||
|
placeholder="Smith"
|
||||||
|
input_type=TextFieldType::Text
|
||||||
|
required=true
|
||||||
|
/>
|
||||||
|
// There must be a date of birth selection field here.
|
||||||
|
<OutlinedTextField
|
||||||
|
label="Student ID Number:"
|
||||||
|
data_map=data_map
|
||||||
|
data_member="id_number"
|
||||||
|
placeholder="Your 7 digit number..."
|
||||||
|
input_type=TextFieldType::Number
|
||||||
|
required=true
|
||||||
|
/>
|
||||||
|
<OutlinedTextField
|
||||||
|
label="Preferred Email:"
|
||||||
|
data_map=data_map
|
||||||
|
data_member="email"
|
||||||
|
placeholder="me@example.com"
|
||||||
|
input_type=TextFieldType::Email(vec!["*".to_string()])
|
||||||
|
required=true
|
||||||
|
/>
|
||||||
|
<OutlinedTextField
|
||||||
|
label="Preferred Phone Number:"
|
||||||
|
data_map=data_map
|
||||||
|
data_member="phone_number"
|
||||||
|
placeholder="000-000-0000"
|
||||||
|
input_type=TextFieldType::Text
|
||||||
|
required=true
|
||||||
|
/>
|
||||||
|
<OutlinedTextField
|
||||||
|
label="Street Address:"
|
||||||
|
data_map=data_map
|
||||||
|
data_member="street_address"
|
||||||
|
placeholder="234 Judd Rd"
|
||||||
|
input_type=TextFieldType::Text
|
||||||
|
required=true
|
||||||
|
/>
|
||||||
|
<Select
|
||||||
|
label="Town:"
|
||||||
|
value_list=vec!["Southbury".to_string(), "Middlebury".to_string()]
|
||||||
|
data_map=data_map
|
||||||
|
data_member="town"
|
||||||
|
required=true
|
||||||
|
/>
|
||||||
|
</ValidatedForm>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-1" />
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
use leptos::prelude::*;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn StudentHomePage() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="flex flex-1 flex-col gap-4 items-center m-4">
|
||||||
|
<div class="font-bold text-3xl">"Student Home Page"</div>
|
||||||
|
<div class="text-lg">"This is just a placeholder for now. We'll show some redirect buttons."</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
mod shell;
|
||||||
|
mod home_page;
|
||||||
|
mod demographics_page;
|
||||||
|
|
||||||
|
pub use shell::*;
|
||||||
|
pub use home_page::*;
|
||||||
|
pub use demographics_page::*;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
use leptos::prelude::*;
|
||||||
|
use crate::common::TabInfo;
|
||||||
|
use crate::components::{Banner, TabSidebarList};
|
||||||
|
use crate::components::login::StudentLoginContext;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn StudentShell() -> impl IntoView {
|
||||||
|
// Create login context
|
||||||
|
view! {
|
||||||
|
<StudentLoginContext>
|
||||||
|
<Banner title="R15 Student Scholarship Application" logo="/PHS_Stacked_Acronym.png" />
|
||||||
|
// We'll put the tabs here.
|
||||||
|
<TabSidebarList tabs=vec![
|
||||||
|
TabInfo::new("Home", "/students/home"),
|
||||||
|
TabInfo::new("Demographics", "/students/demographics"),
|
||||||
|
TabInfo::new("Additional Info", "/students/additional"),
|
||||||
|
] />
|
||||||
|
</StudentLoginContext>
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user