diff --git a/src/app.rs b/src/app.rs index 8ba19ad..5358b9c 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,4 +1,4 @@ -use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage, StudentShell, StudentHomePage, StudentDemographicsPage}; +use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage, StudentShell, StudentHomePage, StudentDemographicsPage, AdditionalPage}; use leptos::prelude::*; use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context}; use leptos_oidc::AuthSignal; @@ -123,6 +123,7 @@ fn StudentRoutes() -> impl MatchNestedRoutes + Clone { + } .into_inner() diff --git a/src/common/tab_info.rs b/src/common/tab_info.rs index f2d0872..e68fdc9 100644 --- a/src/common/tab_info.rs +++ b/src/common/tab_info.rs @@ -2,13 +2,34 @@ pub struct TabInfo { pub text: String, pub path: String, + pub sub_paths: Vec, } impl TabInfo { - pub fn new(text: impl Into, path: impl Into) -> Self { + pub fn new( + text: impl Into, + path: impl Into, + sub_paths: Option> + ) -> Self { Self { text: text.into(), path: path.into(), + sub_paths: sub_paths.unwrap_or_default() } } -} \ No newline at end of file +} + +#[derive(Debug, Clone)] +pub struct SubTabInfo { + pub text: String, + pub path: String, +} + +impl SubTabInfo { + pub fn new(text: impl Into, path: impl Into) -> Self { + Self { + text: text.into(), + path: path.into() + } + } +} diff --git a/src/components/tabs/sidebar.rs b/src/components/tabs/sidebar.rs index 5a577df..ea64648 100644 --- a/src/components/tabs/sidebar.rs +++ b/src/components/tabs/sidebar.rs @@ -1,34 +1,9 @@ use leptos::prelude::*; +use leptos_animate::animate; +use leptos_animate::animations::classes::{In, Out}; use leptos_router::components::{Outlet, A}; use leptos_router::hooks::use_location; -use crate::common::TabInfo; - -#[component] -fn SidebarTab( - #[prop(into)] text: Signal, - #[prop(into)] path: Signal -) -> impl IntoView { - let location = use_location(); - - let selected = Memo::new(move |_| { - let current_path = location.pathname.get(); - - // There's extra logic here as well, but for now this works. - current_path.starts_with(&path.get()) - }); - - view! { - -
- {text} -
-
- } -} +use crate::common::{SubTabInfo, TabInfo}; /// # Tab Sidebar Component /// @@ -85,9 +60,9 @@ pub fn TabSidebarList( - + @@ -97,3 +72,74 @@ pub fn TabSidebarList( } } + +#[component] +fn SidebarTab( + #[prop(into)] text: Signal, + #[prop(into)] path: Signal, + #[prop(into)] sub_paths: Signal>, +) -> impl IntoView { + let location = use_location(); + + let selected = Memo::new(move |_| { + let current_path = location.pathname.get(); + + // There's extra logic here as well, but for now this works. + current_path.starts_with(&path.get()) + }); + + view! { + +
+ {text} +
+
+ + + + } +} + +#[component] +fn SidebarSubTab( + #[prop(into)] text: Signal, + #[prop(into)] path: Signal, + #[prop(into)] visible: Signal, +) -> impl IntoView { + let selected = Memo::new(move |_| { + visible.get() + }); + + view! { +
+
+ {text} +
+
+ } +} diff --git a/src/pages/admin/shell.rs b/src/pages/admin/shell.rs index 56aacbb..c5d78a7 100644 --- a/src/pages/admin/shell.rs +++ b/src/pages/admin/shell.rs @@ -15,9 +15,9 @@ pub fn AdminShell() -> impl IntoView { // We'll put the tabs here. } diff --git a/src/pages/student/additional_page.rs b/src/pages/student/additional_page.rs new file mode 100644 index 0000000..f4843df --- /dev/null +++ b/src/pages/student/additional_page.rs @@ -0,0 +1,13 @@ +use leptos::prelude::*; + +#[component] +pub fn AdditionalPage() -> impl IntoView { + view! { +
+
"Student Additional Forms"
+
+ "This is just a placeholder for now. We'll show redirect buttons to each form." +
+
+ } +} \ No newline at end of file diff --git a/src/pages/student/home_page.rs b/src/pages/student/home_page.rs index d453684..3b5bf0e 100644 --- a/src/pages/student/home_page.rs +++ b/src/pages/student/home_page.rs @@ -5,7 +5,9 @@ pub fn StudentHomePage() -> impl IntoView { view! {
"Student Home Page"
-
"This is just a placeholder for now. We'll show some redirect buttons."
+
+ "This is just a placeholder for now. We'll show some redirect buttons." +
} } diff --git a/src/pages/student/mod.rs b/src/pages/student/mod.rs index 83765aa..8354f08 100644 --- a/src/pages/student/mod.rs +++ b/src/pages/student/mod.rs @@ -1,7 +1,9 @@ mod shell; mod home_page; mod demographics_page; +mod additional_page; pub use shell::*; pub use home_page::*; -pub use demographics_page::*; \ No newline at end of file +pub use demographics_page::*; +pub use additional_page::*; \ No newline at end of file diff --git a/src/pages/student/shell.rs b/src/pages/student/shell.rs index 94e3523..d006bd0 100644 --- a/src/pages/student/shell.rs +++ b/src/pages/student/shell.rs @@ -1,6 +1,6 @@ use leptos::prelude::*; use leptos_oidc::{AuthLoaded, Authenticated}; -use crate::common::TabInfo; +use crate::common::{SubTabInfo, TabInfo}; use crate::components::{Banner, Loading, TabSidebarList}; use crate::components::login::StudentLoginContext; use crate::pages::UnauthenticatedPage; @@ -14,9 +14,17 @@ pub fn StudentShell() -> impl IntoView {