feat: add Phase 3 Workout UI — auth, profiles, workout viewer, exercise browser
Build the core user-facing experience with admin login (bcrypt + signed session cookies), profile switcher, workout day viewer with warmups and exercise cards, and HTMX-powered exercise browser with search/filter. - AuthService with bcrypt password verification and itsdangerous session tokens - Auth dependency redirects to /login (303) for unauthenticated requests - NavContextMiddleware injects admin/profiles/active_profile into all templates - Profile management (list, switch, edit) with cookie-based active profile - Workout day viewer shows warmups + exercises + per-user programming targets - Exercise browser with HTMX filter dropdowns (no page reloads) - Flash message partial for success/error feedback - 12 new tests (66 total passing) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
app/templates/partials/exercise_card.html
Normal file
28
app/templates/partials/exercise_card.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<article>
|
||||
<header>
|
||||
<hgroup>
|
||||
<h3>{{ exercise.name }}</h3>
|
||||
<p>{{ exercise.muscle_group }} | {{ exercise.sets }} sets | Tempo: {{ exercise.tempo }}</p>
|
||||
</hgroup>
|
||||
</header>
|
||||
|
||||
{% if program %}
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small>Week 1</small>
|
||||
<p>{{ program.wk1_reps }} reps @ {{ program.wk1_weight }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<small>Week 4</small>
|
||||
<p>{{ program.wk4_reps }} reps @ {{ program.wk4_weight }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<details>
|
||||
<summary>Form Cues</summary>
|
||||
<p>{{ exercise.form_cues }}</p>
|
||||
</details>
|
||||
|
||||
<!-- Phase 4 adds: inline logging form here -->
|
||||
</article>
|
||||
16
app/templates/partials/exercise_list.html
Normal file
16
app/templates/partials/exercise_list.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% for exercise in exercises %}
|
||||
<article>
|
||||
<header>
|
||||
<hgroup>
|
||||
<h3>{{ exercise.name }}</h3>
|
||||
<p>{{ exercise.muscle_group }} | {{ exercise.workout_day }} Day | {{ exercise.sets }} sets | Tempo: {{ exercise.tempo }}</p>
|
||||
</hgroup>
|
||||
</header>
|
||||
<details>
|
||||
<summary>Form Cues</summary>
|
||||
<p>{{ exercise.form_cues }}</p>
|
||||
</details>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>No exercises found matching your filters.</p>
|
||||
{% endfor %}
|
||||
6
app/templates/partials/flash_message.html
Normal file
6
app/templates/partials/flash_message.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% if flash_success %}
|
||||
<div class="flash-success" role="status">{{ flash_success }}</div>
|
||||
{% endif %}
|
||||
{% if flash_error %}
|
||||
<div class="flash-error" role="alert">{{ flash_error }}</div>
|
||||
{% endif %}
|
||||
35
app/templates/partials/nav.html
Normal file
35
app/templates/partials/nav.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{% set admin = request.state.admin %}
|
||||
{% set profiles = request.state.profiles %}
|
||||
{% set active_profile = request.state.active_profile %}
|
||||
{% if admin %}
|
||||
<li>
|
||||
<details class="dropdown">
|
||||
<summary>
|
||||
{% if active_profile %}
|
||||
{{ active_profile.display_name }}
|
||||
{% else %}
|
||||
Select Profile
|
||||
{% endif %}
|
||||
</summary>
|
||||
<ul dir="rtl">
|
||||
{% for profile in profiles %}
|
||||
<li>
|
||||
<form method="POST" action="/profiles/switch" style="margin:0;">
|
||||
<input type="hidden" name="profile_id" value="{{ profile.id }}">
|
||||
<button type="submit" class="outline secondary"
|
||||
style="width:100%; text-align:left; border:none;">
|
||||
{{ profile.display_name }}
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
<li><a href="/workouts">Workouts</a></li>
|
||||
<li><a href="/exercises">Exercises</a></li>
|
||||
<li><a href="/profiles">Profiles</a></li>
|
||||
<li><a href="/logout">Logout</a></li>
|
||||
{% else %}
|
||||
<li><a href="/login">Login</a></li>
|
||||
{% endif %}
|
||||
12
app/templates/partials/profile_card.html
Normal file
12
app/templates/partials/profile_card.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<article>
|
||||
<header>
|
||||
<hgroup>
|
||||
<h3>{{ profile.display_name }}</h3>
|
||||
<p>{{ profile.height }} | {{ profile.weight }}</p>
|
||||
</hgroup>
|
||||
</header>
|
||||
<p>{{ profile.goals or "No goals set" }}</p>
|
||||
<footer>
|
||||
<a href="/profiles/{{ profile.id }}/edit" role="button" class="outline">Edit</a>
|
||||
</footer>
|
||||
</article>
|
||||
23
app/templates/partials/warmup_list.html
Normal file
23
app/templates/partials/warmup_list.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Exercise</th>
|
||||
<th>Type</th>
|
||||
<th>Reps</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for warmup in warmups %}
|
||||
<tr>
|
||||
<td>
|
||||
<details>
|
||||
<summary>{{ warmup.name }}</summary>
|
||||
<p>{{ warmup.form_cues }}</p>
|
||||
</details>
|
||||
</td>
|
||||
<td>{{ warmup.type }}</td>
|
||||
<td>{{ warmup.reps }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user