This commit is contained in:
itsscb 2025-08-20 00:24:10 +02:00
parent 889b3d08e0
commit 686c740b7e
8 changed files with 2522 additions and 0 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ Cargo.lock
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
/target

2352
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

12
Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "muttermilch"
version = "0.1.0"
edition = "2024"
[dependencies]
askama = "0.14.0"
axum = "0.8.4"
sqlx = { version = "0.8.6", features = ["sqlite", "derive", "runtime-tokio", "tls-rustls", "macros", "uuid", "time"] }
tokio = { version = "1.47.1", features = ["macros", "rt-multi-thread"] }
tower-http = { version = "0.6.6", features = ["fs"] }
uuid = { version = "1.18.0", features = ["v4"] }

103
index.html Normal file
View File

@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{% block title %}Start{% endblock %} - Muttermilch Tracker</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="Muttermilch Tracker" />
<link rel="stylesheet" type="text/css" href="static/simple.min.css" />
<link rel="icon" href="favicon.png">
<style>
<!-- CUSTOM STYLING BELOW -->
<!-- :root { -->
<!-- --bg: red; -->
<!-- --accent-bg: #2b2b2b; -->
<!-- --text: #dcdcdc; -->
<!-- --text-light: #ababab; -->
<!-- --accent: #ffb300; -->
<!-- --accent-hover: #ffe099; -->
<!-- --accent-text: var(--bg); -->
<!-- --code: #f06292; -->
<!-- --preformatted: #ccc; -->
<!-- --disabled: #111; -->
<!-- } -->
table {
width: 100%;
}
tr {
vertical-align: baseline;
}
.summary-row {
background-color: var(--accent-text);
color: var(--accent);
}
.summary-row td {
border-left: none;
border-right: none;
}
.summary-row td:first-child
{
border-left: 1px solid var(--border);
}
.summary-row td:last-child
{
font-weight: bold;
border-right: 1px solid var(--border);
}
</style>
</head>
<body>
<header>
<nav>
<h1>Muttermilch Tracker</h1>
<a href="/">Start</a>
<!-- <a href="#">Export</a> -->
</nav>
</header>
<main>
<table>
<thead>
<tr>
<th><img><svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 -960 960 960" width="18px" fill="#212121"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Zm280 240q-17 0-28.5-11.5T440-440q0-17 11.5-28.5T480-480q17 0 28.5 11.5T520-440q0 17-11.5 28.5T480-400Zm-160 0q-17 0-28.5-11.5T280-440q0-17 11.5-28.5T320-480q17 0 28.5 11.5T360-440q0 17-11.5 28.5T320-400Zm320 0q-17 0-28.5-11.5T600-440q0-17 11.5-28.5T640-480q17 0 28.5 11.5T680-440q0 17-11.5 28.5T640-400ZM480-240q-17 0-28.5-11.5T440-280q0-17 11.5-28.5T480-320q17 0 28.5 11.5T520-280q0 17-11.5 28.5T480-240Zm-160 0q-17 0-28.5-11.5T280-280q0-17 11.5-28.5T320-320q17 0 28.5 11.5T360-280q0 17-11.5 28.5T320-240Zm320 0q-17 0-28.5-11.5T600-280q0-17 11.5-28.5T640-320q17 0 28.5 11.5T680-280q0 17-11.5 28.5T640-240Z"></svg></img> Datum</th>
<th>Linke Brust</th>
<th>Rechte Brust</th>
<th>Gesamt</th>
</tr>
</thead>
<tbody>
<tr>
<td>19.08.2025 05:15</td>
<td>20 ml</td>
<td>30 ml</td>
<td>50 ml</td>
</tr>
<tr>
<td>19.08.2025 15:15</td>
<td>20 ml</td>
<td>30 ml</td>
<td>50 ml</td>
</tr>
<tr class="summary-row">
<td></td>
<td></td>
<td></td>
<td>100 ml</td>
</tr>
<tr>
<td>18.08.2025 15:15</td>
<td>10 ml</td>
<td>20 ml</td>
<td>30 ml</td>
</tr>
</tbody>
</table>
</main>
</body>
</html>

31
src/main.rs Normal file
View File

@ -0,0 +1,31 @@
use askama::Template;
use axum::{
Router,
response::{Html, IntoResponse},
routing::get,
};
use tower_http::services::ServeDir;
#[tokio::main]
async fn main() {
let app = Router::new()
.route("/", get(root))
.nest_service("/static", ServeDir::new("./static"));
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
async fn root() -> impl IntoResponse {
let template = Index {};
Html(
template
.render()
.expect("template index.html should always render"),
)
}
#[derive(Template)]
#[template(path = "pages/index.html")]
struct Index {}

1
static/simple.min.css vendored Normal file

File diff suppressed because one or more lines are too long

17
templates/base.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{% block title %}Start{% endblock %} - Muttermilch Tracker</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="Muttermilch Tracker" />
<link rel="stylesheet" type="text/css" href="static/simple.min.css" />
<link rel="icon" href="favicon.png">
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>

View File

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h1>Muttermilch Tracker</h1>
{% endblock %}