Initial working state
This commit is contained in:
9 files changed
+1600
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Exercise Tracker{% endblock %}</title>
|
||||
<style>
|
||||
:root { color-scheme: light dark; }
|
||||
body {
|
||||
font-family: system-ui, sans-serif; max-width: 40rem; margin: 2rem auto; padding: 0 1rem;
|
||||
color: #1a1a1a; background: #fafafa;
|
||||
}
|
||||
h1 { font-size: 1.5rem; }
|
||||
nav { margin-bottom: 1.5rem; display: flex; align-items: center; gap: 1rem; }
|
||||
nav a { color: #4a5dff; text-decoration: none; font-weight: 600; }
|
||||
nav a:hover { text-decoration: underline; }
|
||||
nav form { margin: 0; }
|
||||
nav button { background: none; border: none; color: #666; cursor: pointer; font-size: 0.9rem; padding: 0; }
|
||||
|
||||
.card {
|
||||
background: #fff; border: 1px solid #e3e3e3; border-radius: 10px;
|
||||
padding: 1rem 1.25rem; margin-bottom: 1.25rem;
|
||||
}
|
||||
.card h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
|
||||
.stats { display: flex; gap: 1.75rem; margin-bottom: 1rem; }
|
||||
.stats .num { display: block; font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
|
||||
.stats .label { display: block; font-size: 0.75rem; color: #777; }
|
||||
.chart {
|
||||
display: flex; align-items: flex-end; gap: 2px;
|
||||
height: 70px; background: #f0f1f5; border-radius: 6px; padding: 6px;
|
||||
}
|
||||
.bar { flex: 1; min-height: 2px; background: #4a5dff; border-radius: 2px 2px 0 0; }
|
||||
|
||||
table { border-collapse: collapse; width: 100%; margin-bottom: 1.5rem; }
|
||||
th, td { text-align: left; padding: 0.4rem 0.8rem 0.4rem 0; border-bottom: 1px solid #ddd; }
|
||||
form { margin-bottom: 1.5rem; }
|
||||
label { display: block; margin-bottom: 0.3rem; }
|
||||
input, select {
|
||||
font-size: 1rem; padding: 0.4rem; margin-bottom: 0.6rem;
|
||||
border: 1px solid #ccc; border-radius: 6px;
|
||||
}
|
||||
button {
|
||||
font-size: 1rem; padding: 0.45rem 0.9rem; margin-bottom: 0.6rem;
|
||||
background: #4a5dff; color: #fff; border: none; border-radius: 6px; cursor: pointer;
|
||||
}
|
||||
button:hover { background: #3a4bdb; }
|
||||
.error { color: #b00020; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<a href="/">Stats</a>
|
||||
{% block nav_extra %}{% endblock %}
|
||||
</nav>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
{% block nav_extra %}<a href="/manage">Manage</a>{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Exercise Stats</h1>
|
||||
{% if exercises.is_empty() %}
|
||||
<p>No exercises yet.</p>
|
||||
{% else %}
|
||||
{% for e in exercises %}
|
||||
<section class="card">
|
||||
<h2>{{ e.name }}</h2>
|
||||
<div class="stats">
|
||||
<div><span class="num">{{ e.month }}</span><span class="label">this month</span></div>
|
||||
<div><span class="num">{{ e.year }}</span><span class="label">this year</span></div>
|
||||
<div><span class="num">{{ e.all_time }}</span><span class="label">all time</span></div>
|
||||
</div>
|
||||
<div class="chart">
|
||||
{% for bar in e.daily %}
|
||||
<div class="bar" style="height: {{ bar.pct }}%" title="Day {{ bar.day }}: {{ bar.reps }} reps"></div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Login</h1>
|
||||
{% if let Some(err) = error %}
|
||||
<p class="error">{{ err }}</p>
|
||||
{% endif %}
|
||||
<form method="post" action="/login">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" required autofocus>
|
||||
<button type="submit">Log in</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,31 @@
|
||||
{% extends "base.html" %}
|
||||
{% block nav_extra %}<form method="post" action="/logout" style="display:inline; margin:0;"><button type="submit">Log out</button></form>{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Manage</h1>
|
||||
|
||||
<h2>Add exercise</h2>
|
||||
<form method="post" action="/exercises">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" id="name" name="name" required>
|
||||
<button type="submit">Add exercise</button>
|
||||
</form>
|
||||
|
||||
<h2>Log reps</h2>
|
||||
{% if exercises.is_empty() %}
|
||||
<p>Add an exercise first.</p>
|
||||
{% else %}
|
||||
<form method="post" action="/entries">
|
||||
<label for="exercise">Exercise</label>
|
||||
<select id="exercise" name="exercise" required>
|
||||
{% for name in exercises %}
|
||||
<option value="{{ name }}">{{ name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<label for="date">Date</label>
|
||||
<input type="date" id="date" name="date" value="{{ today }}" required>
|
||||
<label for="reps">Reps</label>
|
||||
<input type="number" id="reps" name="reps" min="0" required>
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user