chore: remove testing dates list
This commit is contained in:
1 parent
7d7c96e642
commit
bde15de634
1 file changed
+1
-94
+1
-94
@@ -5,96 +5,7 @@ use leptos::prelude::*;
|
|||||||
use crate::pages::api::{get_important_dates, CreateDates};
|
use crate::pages::api::{get_important_dates, CreateDates};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn TestPage() -> impl IntoView {
|
pub fn TestPage() -> impl IntoView {
|
||||||
let reload_signal = RwSignal::new(0);
|
|
||||||
|
|
||||||
let dates_resource = Resource::new(
|
|
||||||
move || reload_signal.get(),
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let create_dates = ServerAction::<CreateDates>::new();
|
|
||||||
|
|
||||||
let on_click = move |_| {
|
|
||||||
let dates_list = vec![
|
|
||||||
DateInfo {
|
|
||||||
id: uuid::Uuid::new_v4().to_string(),
|
|
||||||
title: "Open Example".to_string(),
|
|
||||||
date: DateRange::Range(
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-15T07:15:00-05:00")
|
|
||||||
.unwrap_or_default(),
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-30T14:05:00-05:00")
|
|
||||||
.unwrap_or_default()
|
|
||||||
),
|
|
||||||
description: "This is a test".to_string(),
|
|
||||||
},
|
|
||||||
DateInfo {
|
|
||||||
id: uuid::Uuid::new_v4().to_string(),
|
|
||||||
title: "Closed Example".to_string(),
|
|
||||||
date: DateRange::Range(
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-01T07:15:00-05:00")
|
|
||||||
.unwrap_or_default(),
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-14T14:05:00-05:00")
|
|
||||||
.unwrap_or_default()
|
|
||||||
),
|
|
||||||
description: "".to_string(),
|
|
||||||
},
|
|
||||||
DateInfo {
|
|
||||||
id: uuid::Uuid::new_v4().to_string(),
|
|
||||||
title: "Deadline Example".to_string(),
|
|
||||||
date: DateRange::Range(
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-15T07:15:00-05:00")
|
|
||||||
.unwrap_or_default(),
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-20T14:05:00-05:00")
|
|
||||||
.unwrap_or_default()
|
|
||||||
),
|
|
||||||
description: "This is a test".to_string(),
|
|
||||||
},
|
|
||||||
DateInfo {
|
|
||||||
id: uuid::Uuid::new_v4().to_string(),
|
|
||||||
title: "Upcoming Example".to_string(),
|
|
||||||
date: DateRange::Range(
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-30T07:15:00-05:00")
|
|
||||||
.unwrap_or_default(),
|
|
||||||
DateTime::parse_from_rfc3339("2026-02-20T14:05:00-05:00")
|
|
||||||
.unwrap_or_default()
|
|
||||||
),
|
|
||||||
description: "This is a test".to_string(),
|
|
||||||
},
|
|
||||||
DateInfo {
|
|
||||||
id: uuid::Uuid::new_v4().to_string(),
|
|
||||||
title: "Single Date (Blank)".to_string(),
|
|
||||||
date: DateRange::Single(
|
|
||||||
DateTime::parse_from_rfc3339("2026-01-15T14:05:00-05:00")
|
|
||||||
.unwrap_or_default()
|
|
||||||
),
|
|
||||||
description: "".to_string(),
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
create_dates.dispatch(CreateDates {
|
|
||||||
dates: dates_list
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Effect::new(move || {
|
|
||||||
if let Some(Ok(_)) = create_dates.value().get() {
|
|
||||||
create_dates.clear();
|
|
||||||
reload_signal.update(|v| *v += 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<div class="mx-auto px-6">
|
<div class="mx-auto px-6">
|
||||||
<div class="container mx-auto px-6 py-8 space-y-8">
|
<div class="container mx-auto px-6 py-8 space-y-8">
|
||||||
@@ -126,14 +37,10 @@ pub fn TestPage() -> impl IntoView {
|
|||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<div class="flex flex-col p-3 gap-3">
|
<div class="flex flex-col p-3 gap-3">
|
||||||
<DateList dates=dates_list />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
|
||||||
<ActionButton on:click=on_click>"Create Dates List"</ActionButton>
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user