diff --git a/src/api.rs b/src/api.rs index 40847aa..d22f0cc 100644 --- a/src/api.rs +++ b/src/api.rs @@ -53,7 +53,7 @@ async fn open_shift(State(state): State) -> impl IntoResponse { .unwrap() }; - render!(crate::templates::home_html, shift) + render!(crate::templates::components::home_fragment_html, shift) } async fn close_shift(State(state): State, Path(id): Path) -> impl IntoResponse { diff --git a/templates/components/home_fragment.rs.html b/templates/components/home_fragment.rs.html new file mode 100644 index 0000000..2dac436 --- /dev/null +++ b/templates/components/home_fragment.rs.html @@ -0,0 +1,22 @@ +@use super::shift_button_html; +@use cm_lib::models::Shift; + +@(open_shift: Option) + +
+
+ @:shift_button_html(open_shift.as_ref()) +
+ @if open_shift.is_some() { + + } + +
diff --git a/templates/home.rs.html b/templates/home.rs.html index 4859dc8..85dc9bc 100644 --- a/templates/home.rs.html +++ b/templates/home.rs.html @@ -1,27 +1,11 @@ @use super::base_html; -@use super::components::shift_button_html; +@use super::components::home_fragment_html; @use cm_lib::models::Shift; @(open_shift: Option) @:base_html({ -
-
- @:shift_button_html(open_shift.as_ref()) -
- @if open_shift.is_some() { - - } - -
+ @:home_fragment_html(open_shift) })