Add date list component #50

Merged
BobdaFett merged 37 commits from feat/date-component into main 2026-01-16 14:02:18 +00:00
Showing only changes of commit 6105fa3bd5 - Show all commits
+58 -29
View File
@@ -1,42 +1,71 @@
use crate::components::{Banner, DashboardButton}; use crate::components::{Banner, DashboardButton, DateList, Loading};
use leptos::prelude::*; use leptos::prelude::*;
use leptos_oidc::{AuthLoaded, Authenticated};
use crate::pages::api::get_important_dates;
use crate::pages::UnauthenticatedPage;
#[component] #[component]
pub fn ProviderPortal() -> impl IntoView { pub fn ProviderPortal() -> impl IntoView {
let dates_resource = OnceResource::new(async move {
get_important_dates().await
});
let dates_list = RwSignal::new(Vec::new());
Effect::new(move || {
if let Some(Ok(mut dates)) = dates_resource.get() {
dates.sort_by_key(|info| info.date.get_status());
dates_list.set(dates);
}
});
view! { view! {
<Banner <Banner
title="Provider Dashboard" title="Provider Dashboard"
logo="PHS_Stacked_Acronym.png" logo="PHS_Stacked_Acronym.png"
path="/" path="/"
/> />
<div class="mx-auto px-6"> <AuthLoaded fallback=Loading>
<div class="container mx-auto px-6 py-8 space-y-8"> <Authenticated unauthenticated=UnauthenticatedPage>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> <div class="mx-auto px-6">
<section class="space-y-4"> <div class="container mx-auto px-6 py-8 space-y-8">
<DashboardButton <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
title="Profile" <section class="space-y-4">
description="Edit user profile" <DashboardButton
icon="/Person_Black.png" title="Profile"
path="/providers/profile" description="Edit user profile"
/> icon="/Person_Black.png"
<DashboardButton path="/providers/profile"
title="Create Scholarship" />
description="Navigate to Scholarship Creation Page" <DashboardButton
icon="/Create_Black.png" title="Create Scholarship"
path="/providers/scholarships" description="Navigate to Scholarship Creation Page"
/> icon="/Create_Black.png"
<DashboardButton path="/providers/scholarships"
title="Applicants" />
description="View Scholarship Applicants" <DashboardButton
icon="/Form_Black.png" title="Applicants"
path="/" description="View Scholarship Applicants"
/> icon="/Form_Black.png"
</section> path="/"
<section class="space-y-4"> />
</section>
</section> <section class="space-y-4">
<div class="rounded-lg shadow-lg/25 overflow-hidden">
<div class="bg-red-900 text-white px-4 py-3 shadow-lg">
<h3 class="text-white font-bold">Important Dates</h3>
</div>
<div class="p-2">
<div class="flex flex-col p-3 gap-3">
<DateList dates=dates_list />
</div>
</div>
</div>
</section>
</div>
</div>
</div> </div>
</div> </Authenticated>
</div> </AuthLoaded>
} }
} }