Port index page to Page

This commit is contained in:
Joscha 2024-05-13 00:37:28 +02:00
parent 37b34aac37
commit f532c55772

View file

@ -6,8 +6,8 @@ use sqlx::SqlitePool;
use crate::{ use crate::{
config::ServerConfig, config::ServerConfig,
server::web::{ server::web::{
base::{Base, Tab},
components, components,
page::{Page, Tab},
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRefsUpdate, PathIndex}, paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRefsUpdate, PathIndex},
server_config_ext::ServerConfigExt, server_config_ext::ServerConfigExt,
}, },
@ -25,8 +25,6 @@ pub async fn get_index(
State(config): State<&'static ServerConfig>, State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>, State(db): State<SqlitePool>,
) -> somehow::Result<impl IntoResponse> { ) -> somehow::Result<impl IntoResponse> {
let base = Base::new(config, Tab::Index);
let refs = sqlx::query!( let refs = sqlx::query!(
"\ "\
SELECT name, hash, message, reachable, tracked \ SELECT name, hash, message, reachable, tracked \
@ -54,10 +52,10 @@ pub async fn get_index(
} }
} }
Ok(base.html( let html = Page::new(config)
"overview", .title("overview")
html! {}, .nav(Tab::Index)
html! { .body(html! {
h2 { "Refs" } h2 { "Refs" }
details .refs-list open { details .refs-list open {
summary { "Tracked (" (tracked_refs.len()) ")" } summary { "Tracked (" (tracked_refs.len()) ")" }
@ -92,6 +90,8 @@ pub async fn get_index(
form method="post" action=(config.path(PathAdminRefsUpdate {})) { form method="post" action=(config.path(PathAdminRefsUpdate {})) {
button { "Update" } button { "Update" }
} }
}, })
)) .build();
Ok(html)
} }