feat: cleanup admin setup and add utils page

This commit is contained in:
alphafetus committed 2026-01-30 21:27:24 -05:00
1 parent dfd1594395
commit b21887f82b
4 files changed
+86 -22

No files matched your search

+2 -1
View File
@@ -1,4 +1,4 @@
use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage, StudentShell, StudentHomePage, StudentDemographicsPage, AdditionalPage}; use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback, AdminShell, AdminHomePage, AdminProviderPage, AdminScholarshipPage, StudentShell, StudentHomePage, StudentDemographicsPage, AdditionalPage, AdminUtilsPage};
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;
@@ -110,6 +110,7 @@ fn AdminRoutes() -> impl MatchNestedRoutes + Clone {
<Route path=path!("home") view=AdminHomePage /> <Route path=path!("home") view=AdminHomePage />
<Route path=path!("providers") view=AdminProviderPage /> <Route path=path!("providers") view=AdminProviderPage />
<Route path=path!("scholarships") view=AdminScholarshipPage /> <Route path=path!("scholarships") view=AdminScholarshipPage />
<Route path=path!("utils") view=AdminUtilsPage />
</ParentRoute> </ParentRoute>
} }
.into_inner() .into_inner()
+6 -3
View File
@@ -1,8 +1,11 @@
mod shell; mod shell;
pub use shell::*;
mod home_page; mod home_page;
pub use home_page::*;
mod provider_page; mod provider_page;
pub use provider_page::*;
mod scholarship_page; mod scholarship_page;
mod utils_page;
pub use shell::*;
pub use home_page::*;
pub use provider_page::*;
pub use scholarship_page::*; pub use scholarship_page::*;
pub use utils_page::*;
+1 -18
View File
@@ -18,25 +18,8 @@ pub fn AdminShell() -> impl IntoView {
TabInfo::new("Home", "/admin/home", None), TabInfo::new("Home", "/admin/home", None),
TabInfo::new("Providers", "/admin/providers", None), TabInfo::new("Providers", "/admin/providers", None),
TabInfo::new("Scholarships", "/admin/scholarships", None), TabInfo::new("Scholarships", "/admin/scholarships", None),
TabInfo::new("Utilities", "/admin/utilities", None),
] /> ] />
</AdminLoginContext> </AdminLoginContext>
} }
} }
#[component]
pub fn AdminFallback() -> impl IntoView {
view! {
<div>
<p class="mx-auto">"This is a fallback page"</p>
</div>
}
}
#[component]
pub fn AdminTesting() -> impl IntoView {
view! {
<div>
<p class="mx-auto">"This is a testing page"</p>
</div>
}
}
+77
View File
@@ -0,0 +1,77 @@
use chrono::DateTime;
use crate::components::ActionButton;
use leptos::prelude::*;
use crate::common::{DateInfo, DateRange};
use crate::pages::api::{CreateDates, CreateTestComparisons};
fn get_important_dates() -> Vec<DateInfo> {
vec! [
DateInfo {
id: uuid::Uuid::new_v4().to_string(),
title: "Provider Forms Open".to_string(),
date: DateRange::Range(
DateTime::parse_from_rfc3339("2026-01-20T07:15:00-05:00").unwrap(),
DateTime::parse_from_rfc3339("2026-03-03T23:59:00-05:00").unwrap()
),
description: "".to_string(),
},
DateInfo {
id: uuid::Uuid::new_v4().to_string(),
title: "Student Forms Open".to_string(),
date: DateRange::Range(
DateTime::parse_from_rfc3339("2026-03-03T07:15:00-05:00").unwrap(),
DateTime::parse_from_rfc3339("2026-03-27T14:05:00-05:00").unwrap()
),
description: "".to_string(),
},
DateInfo {
id: uuid::Uuid::new_v4().to_string(),
title: "Scholarship Decision Window".to_string(),
date: DateRange::Range(
DateTime::parse_from_rfc3339("2026-04-10T07:15:00-05:00").unwrap(),
DateTime::parse_from_rfc3339("2026-05-01T23:59:00-05:00").unwrap()
),
description: "Start date may change if available sooner.".to_string(),
},
DateInfo {
id: uuid::Uuid::new_v4().to_string(),
title: "PHS Scholarship Committee".to_string(),
date: DateRange::Single(
DateTime::parse_from_rfc3339("2026-05-18T00:00:00-05:00").unwrap(),
),
description: "Time TBD".to_string(),
},
DateInfo {
id: uuid::Uuid::new_v4().to_string(),
title: "Scholarship and Awards Night".to_string(),
date: DateRange::Single(
DateTime::parse_from_rfc3339("2026-06-09T00:00:00-05:00").unwrap(),
),
description: "Time TBD".to_string(),
},
]
}
#[component]
pub fn AdminUtilsPage() -> impl IntoView {
let create_comparisons = ServerAction::<CreateTestComparisons>::new();
let create_dates = ServerAction::<CreateDates>::new();
let on_click_comparisons = move |_| {
create_comparisons.dispatch(CreateTestComparisons{});
};
let on_click_dates = move |_| {
create_dates.dispatch(CreateDates{dates: get_important_dates()});
};
view! {
<div class="mx-auto px-6">
<div class="flex flex-col gap-4">
<div class="self-centered text-lg mt-6">"This utility page provides buttons to initialize the corresponding lists of information."</div>
<ActionButton on:click=on_click_comparisons>"Create Comparisons"</ActionButton>
<ActionButton on:click=on_click_dates>"Create Dates"</ActionButton>
</div>
</div>
}.into_any()
}