PR with too many features #58
No files matched your search
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage, StudentShell, StudentHomePage, StudentDemographicsPage, AdditionalPage, AdminUtilsPage};
|
use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage, StudentShell, StudentHomePage, StudentDemographicsPage, AdditionalPage, AdminUtilsPage, StudentAthleticsPage};
|
||||||
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;
|
||||||
@@ -125,6 +125,7 @@ fn StudentRoutes() -> impl MatchNestedRoutes + Clone {
|
|||||||
<Route path=path!("home") view=StudentHomePage />
|
<Route path=path!("home") view=StudentHomePage />
|
||||||
<Route path=path!("demographics") view=StudentDemographicsPage />
|
<Route path=path!("demographics") view=StudentDemographicsPage />
|
||||||
<Route path=path!("additional") view=AdditionalPage/>
|
<Route path=path!("additional") view=AdditionalPage/>
|
||||||
|
<Route path=path!("additional/athletics") view=StudentAthleticsPage />
|
||||||
</ParentRoute>
|
</ParentRoute>
|
||||||
}
|
}
|
||||||
.into_inner()
|
.into_inner()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use leptos::prelude::*;
|
use leptos::logging::log;
|
||||||
|
use leptos::prelude::*;
|
||||||
use leptos_router::components::{Outlet, A};
|
use leptos_router::components::{Outlet, A};
|
||||||
use leptos_router::hooks::use_location;
|
use leptos_router::hooks::use_location;
|
||||||
use crate::common::{SubTabInfo, TabInfo};
|
use crate::common::{SubTabInfo, TabInfo};
|
||||||
@@ -48,6 +49,7 @@ use crate::common::{SubTabInfo, TabInfo};
|
|||||||
/// ```
|
/// ```
|
||||||
#[component]
|
#[component]
|
||||||
pub fn TabSidebarList(
|
pub fn TabSidebarList(
|
||||||
|
#[prop(into)] base_path: Signal<String>,
|
||||||
#[prop(into)] tabs: Signal<Vec<TabInfo>>,
|
#[prop(into)] tabs: Signal<Vec<TabInfo>>,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
// Create a series of tabs based on a given list of names and paths.
|
// Create a series of tabs based on a given list of names and paths.
|
||||||
@@ -60,7 +62,7 @@ pub fn TabSidebarList(
|
|||||||
key=|info| info.text.clone()
|
key=|info| info.text.clone()
|
||||||
let(TabInfo { text, path, sub_paths })
|
let(TabInfo { text, path, sub_paths })
|
||||||
>
|
>
|
||||||
<SidebarTab text=text path=path sub_paths=sub_paths />
|
<SidebarTab base_path=base_path text=text path=path sub_paths=sub_paths />
|
||||||
</For>
|
</For>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@@ -73,17 +75,22 @@ pub fn TabSidebarList(
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn SidebarTab(
|
fn SidebarTab(
|
||||||
|
#[prop(into)] base_path: Signal<String>,
|
||||||
#[prop(into)] text: Signal<String>,
|
#[prop(into)] text: Signal<String>,
|
||||||
#[prop(into)] path: Signal<String>,
|
#[prop(into)] path: Signal<String>,
|
||||||
#[prop(into)] sub_paths: Signal<Vec<SubTabInfo>>,
|
#[prop(into)] sub_paths: Signal<Vec<SubTabInfo>>,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
let location = use_location();
|
let location = use_location();
|
||||||
|
|
||||||
|
let full_path = Memo::new(move |_| {
|
||||||
|
format!("/{}/{}", base_path.get(), path.get())
|
||||||
|
});
|
||||||
|
|
||||||
let selected = Memo::new(move |_| {
|
let selected = Memo::new(move |_| {
|
||||||
let current_path = location.pathname.get();
|
let current_path = location.pathname.get();
|
||||||
|
|
||||||
// There's extra logic here as well, but for now this works.
|
// There's extra logic here as well, but for now this works.
|
||||||
current_path.starts_with(&path.get())
|
current_path.starts_with(&full_path.get())
|
||||||
});
|
});
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
@@ -109,7 +116,7 @@ fn SidebarTab(
|
|||||||
key=|info| info.text.clone()
|
key=|info| info.text.clone()
|
||||||
let(SubTabInfo { text, path })
|
let(SubTabInfo { text, path })
|
||||||
>
|
>
|
||||||
<SidebarSubTab text=text path=path visible=selected />
|
<SidebarSubTab parent_path=full_path text=text path=path />
|
||||||
</For>
|
</For>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -119,22 +126,17 @@ fn SidebarTab(
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn SidebarSubTab(
|
fn SidebarSubTab(
|
||||||
|
#[prop(into)] parent_path: Signal<String>,
|
||||||
#[prop(into)] text: Signal<String>,
|
#[prop(into)] text: Signal<String>,
|
||||||
#[prop(into)] path: Signal<String>,
|
#[prop(into)] path: Signal<String>,
|
||||||
#[prop(into)] visible: Signal<bool>,
|
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
let selected = Memo::new(move |_| {
|
let full_path = Memo::new(move |_| {
|
||||||
visible.get()
|
format!("{}/{}", parent_path.get(), path.get())
|
||||||
});
|
});
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<A href=move || path.get()>
|
<A href=move || full_path.get() {..} class="block p-3 pl-10 transition-all aria-[current]:font-bold">
|
||||||
<div
|
|
||||||
class="p-3 pl-10 transition-all"
|
|
||||||
class=(["font-bold"], move || selected.get())
|
|
||||||
>
|
|
||||||
{text}
|
{text}
|
||||||
</div>
|
|
||||||
</A>
|
</A>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,12 +14,15 @@ pub fn AdminShell() -> impl IntoView {
|
|||||||
<AdminLoginContext>
|
<AdminLoginContext>
|
||||||
<Banner title="R15 Scholarships Admin" logo="/PHS_Stacked_Acronym.png" />
|
<Banner title="R15 Scholarships Admin" logo="/PHS_Stacked_Acronym.png" />
|
||||||
// We'll put the tabs here.
|
// We'll put the tabs here.
|
||||||
<TabSidebarList tabs=vec![
|
<TabSidebarList
|
||||||
TabInfo::new("Home", "/admin/home", None),
|
base_path="admin"
|
||||||
TabInfo::new("Providers", "/admin/providers", None),
|
tabs=vec![
|
||||||
TabInfo::new("Scholarships", "/admin/scholarships", None),
|
TabInfo::new("Home", "home", None),
|
||||||
TabInfo::new("Utilities", "/admin/utilities", None),
|
TabInfo::new("Providers", "providers", None),
|
||||||
] />
|
TabInfo::new("Scholarships", "scholarships", None),
|
||||||
|
TabInfo::new("Utilities", "utilities", None),
|
||||||
|
]
|
||||||
|
/>
|
||||||
</AdminLoginContext>
|
</AdminLoginContext>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
use leptos::prelude::*;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn StudentAthleticsPage() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="flex flex-1 flex-col gap-4 items-center m-4">
|
||||||
|
<div class="font-bold text-3xl">"Student Athletics Form"</div>
|
||||||
|
<div class="text-lg">
|
||||||
|
"This is just a placeholder for now. This will display the athletics form."
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@ mod shell;
|
|||||||
mod home_page;
|
mod home_page;
|
||||||
mod demographics_page;
|
mod demographics_page;
|
||||||
mod additional_page;
|
mod additional_page;
|
||||||
|
mod athletics_page;
|
||||||
|
|
||||||
pub use shell::*;
|
pub use shell::*;
|
||||||
pub use home_page::*;
|
pub use home_page::*;
|
||||||
pub use demographics_page::*;
|
pub use demographics_page::*;
|
||||||
pub use additional_page::*;
|
pub use additional_page::*;
|
||||||
|
pub use athletics_page::*;
|
||||||
+14
-11
@@ -13,19 +13,22 @@ pub fn StudentShell() -> impl IntoView {
|
|||||||
<Banner title="R15 Student Scholarship Application" logo="/PHS_Stacked_Acronym.png" />
|
<Banner title="R15 Student Scholarship Application" logo="/PHS_Stacked_Acronym.png" />
|
||||||
<AuthLoaded fallback=Loading>
|
<AuthLoaded fallback=Loading>
|
||||||
<Authenticated unauthenticated=UnauthenticatedPage>
|
<Authenticated unauthenticated=UnauthenticatedPage>
|
||||||
<TabSidebarList tabs=vec![
|
<TabSidebarList
|
||||||
TabInfo::new("Home", "/students/home", None),
|
base_path="students"
|
||||||
TabInfo::new("Demographics", "/students/demographics",
|
tabs=vec![
|
||||||
|
TabInfo::new("Home", "home", None),
|
||||||
|
TabInfo::new("Demographics", "demographics", None),
|
||||||
|
TabInfo::new("Additional Info", "additional",
|
||||||
Some(vec![
|
Some(vec![
|
||||||
SubTabInfo::new("Testing", "/students/testing"),
|
SubTabInfo::new("Academics", "academics"),
|
||||||
SubTabInfo::new("Testing Again!", "/students/testing/again")
|
SubTabInfo::new("Athletics", "athletics"),
|
||||||
|
SubTabInfo::new("Work Experience", "work-experience"),
|
||||||
|
SubTabInfo::new("Extracurriculars", "extracurriculars"),
|
||||||
|
SubTabInfo::new("University Info", "university"),
|
||||||
|
SubTabInfo::new("Parent Info", "parent-info")
|
||||||
])),
|
])),
|
||||||
TabInfo::new("Additional Info", "/students/additional",
|
]
|
||||||
Some(vec![
|
/>
|
||||||
SubTabInfo::new("Testing", "/students/testing"),
|
|
||||||
SubTabInfo::new("Testing Again!", "/students/testing/again")
|
|
||||||
])),
|
|
||||||
] />
|
|
||||||
</Authenticated>
|
</Authenticated>
|
||||||
</AuthLoaded>
|
</AuthLoaded>
|
||||||
</StudentLoginContext>
|
</StudentLoginContext>
|
||||||
|
|||||||
Reference in new issue
Block a user