Add queue tab
This commit is contained in:
parent
06e2f25107
commit
1eeee43f2c
4 changed files with 33 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
mod commit;
|
||||
mod commit_hash;
|
||||
mod index;
|
||||
mod queue;
|
||||
mod r#static;
|
||||
|
||||
use axum::{routing::get, Router, Server};
|
||||
|
|
@ -10,6 +11,7 @@ use crate::{config::Config, somehow, state::AppState};
|
|||
pub enum Tab {
|
||||
Index,
|
||||
Commit,
|
||||
Queue,
|
||||
}
|
||||
|
||||
pub struct Base {
|
||||
|
|
@ -23,6 +25,7 @@ impl Base {
|
|||
let current = match tab {
|
||||
Tab::Index => "index",
|
||||
Tab::Commit => "commit",
|
||||
Tab::Queue => "queue",
|
||||
};
|
||||
Self {
|
||||
root: config.web.base(),
|
||||
|
|
@ -39,6 +42,7 @@ pub async fn run(state: AppState) -> somehow::Result<()> {
|
|||
.route("/", get(index::get))
|
||||
.route("/commit/", get(commit::get))
|
||||
.route("/commit/:hash", get(commit_hash::get))
|
||||
.route("/queue/", get(queue::get))
|
||||
.fallback(get(r#static::static_handler))
|
||||
.with_state(state.clone());
|
||||
|
||||
|
|
|
|||
18
src/web/queue.rs
Normal file
18
src/web/queue.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use askama::Template;
|
||||
use axum::{extract::State, response::IntoResponse};
|
||||
|
||||
use crate::{config::Config, somehow};
|
||||
|
||||
use super::{Base, Tab};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "queue.html")]
|
||||
struct CommitTemplate {
|
||||
base: Base,
|
||||
}
|
||||
|
||||
pub async fn get(State(config): State<&'static Config>) -> somehow::Result<impl IntoResponse> {
|
||||
Ok(CommitTemplate {
|
||||
base: Base::new(config, Tab::Queue),
|
||||
})
|
||||
}
|
||||
|
|
@ -18,6 +18,9 @@
|
|||
<a href="{{ base.root }}/commit/" {% if base.current=="commit" %} class="current" {% endif %}>
|
||||
commit
|
||||
</a>
|
||||
<a href="{{ base.root }}/queue/" {% if base.current=="queue" %} class="current" {% endif %}>
|
||||
queue
|
||||
</a>
|
||||
</nav>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
|
|
|
|||
8
templates/queue.html
Normal file
8
templates/queue.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}queue{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h2>Queue</h2>
|
||||
<p>Sorry, nothing here yet.</p>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue