add management page

This commit is contained in:
Zynh0722 2023-11-05 06:42:19 -08:00
parent 478de6f90a
commit bd2c3055d1
4 changed files with 38 additions and 0 deletions

View file

@ -1,6 +1,7 @@
mod api;
mod axum_ructe;
mod sse_handler;
mod management;
use axum_ructe::render;
@ -93,6 +94,7 @@ async fn main() {
// build our application with a route
let app = Router::new()
.nest("/api", api::router())
.nest("/management", management::router())
.route("/", get(root))
.route("/ada", get(ada))
.route("/shift_reports", get(shift_reports))

12
src/management.rs Normal file
View file

@ -0,0 +1,12 @@
use axum::{routing::get, response::IntoResponse};
use crate::{AppState, axum_ructe::render};
pub(crate) fn router() -> axum::Router<AppState> {
axum::Router::new()
.route("/", get(home))
}
async fn home() -> impl IntoResponse {
render!(crate::templates::management_html)
}

View file

@ -0,0 +1,14 @@
@()
<main>
<div hx-boost="true">
<a href="/">
<button>Return Home</button>
</a>
</div>
<div hx-boost="true">
<a href="/shift_reports">
<button>Shift Reports</button>
</a>
</div>
</main>

View file

@ -0,0 +1,10 @@
@use super::base_html;
@use super::components::management_fragment_html;
@()
@:base_html({
@:management_fragment_html()
})