sort the plan dates in descending order in the ui

This commit is contained in:
Jeremy Wall 2023-01-18 21:09:28 -05:00
parent 5d0ace233b
commit 80e93fa476

View File

@ -23,12 +23,14 @@ use sycamore::prelude::*;
#[component] #[component]
pub fn SelectPage<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View<G> { pub fn SelectPage<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View<G> {
let plan_dates = sh.get_selector(cx, |state| { let plan_dates = sh.get_selector(cx, |state| {
state let mut plans = state
.get() .get()
.plan_dates .plan_dates
.iter() .iter()
.cloned() .cloned()
.collect::<Vec<NaiveDate>>() .collect::<Vec<NaiveDate>>();
plans.sort_unstable_by(|d1, d2| d2.cmp(d1));
plans
}); });
view! {cx, view! {cx,
PlanningPage( PlanningPage(