Reorganize workout view for desktop and compact session details
This commit is contained in:
+69
-100
@@ -1,9 +1,8 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<nav class="flex md:pb-0 pb-4" aria-label="Breadcrumb">
|
||||
<div class="workout-workspace">
|
||||
<nav class="flex md:pb-0 pb-4" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse">
|
||||
<li class="inline-flex items-center">
|
||||
<a hx-get="{{ url_for('dashboard') }}" hx-push-url="true" hx-target="#container"
|
||||
@@ -23,8 +22,8 @@
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="m1 9 4-4-4-4" />
|
||||
</svg>
|
||||
{% set hx_current_url = request.headers.get('HX-Current-URL') %}
|
||||
<a hx-get="{{ hx_current_url if hx_current_url else url_for('calendar.get_calendar', person_id=person_id) }}"
|
||||
|
||||
<a hx-get="{{ url_for('calendar.get_calendar', person_id=person_id) }}"
|
||||
hx-push-url="true" hx-target="#container"
|
||||
class="ms-1 text-sm font-medium text-gray-700 hover:text-blue-600 md:ms-2 dark:text-gray-400 dark:hover:text-white cursor-pointer">{{person_name}}</a>
|
||||
</div>
|
||||
@@ -41,107 +40,77 @@
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<header class="workout-header">
|
||||
<div>
|
||||
<p class="workout-eyebrow">Training log</p>
|
||||
<h1>{{ person_name }}<span> / Workout</span></h1>
|
||||
{{ render_partial('partials/start_date.html', person_id=person_id, workout_id=workout_id, start_date=start_date) }}
|
||||
</div>
|
||||
<details class="workout-menu">
|
||||
<summary class="workout-button">Session options <span aria-hidden="true">···</span></summary>
|
||||
<div class="workout-menu-content">
|
||||
<button type="button" class="workout-delete"
|
||||
hx-get="{{ url_for('workout.delete_workout', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-confirm="Are you sure you wish to delete this workout?" hx-push-url="true" hx-target="#container">Delete workout</button>
|
||||
</div>
|
||||
</details>
|
||||
</header>
|
||||
|
||||
<div class='p-0 md:p-4 m-0 md:m-2'>
|
||||
<div class="relative w-full h-full">
|
||||
<!-- Modal content -->
|
||||
<div class="relative bg-white rounded-lg shadow overflow-hidden">
|
||||
<!-- Modal header -->
|
||||
<div class="p-4 md:p-6 border-b relative">
|
||||
<div class="flex flex-col w-full pr-8">
|
||||
<h3 class="text-2xl font-black text-gray-900 leading-tight">{{ person_name }}</h3>
|
||||
{{ render_partial('partials/workout_tags.html', person_id=person_id, workout_id=workout_id,
|
||||
tags=tags) }}
|
||||
<div class="workout-layout">
|
||||
<div class="workout-main">
|
||||
<section class="workout-card workout-logger" aria-labelledby="log-heading">
|
||||
<div class="workout-section-heading">
|
||||
<div><p class="workout-eyebrow">Log your training</p><h2 id="log-heading">Add a top set</h2></div>
|
||||
<span class="workout-subtle">Reps × weight</span>
|
||||
</div>
|
||||
{{ render_partial('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercises=exercises, has_value=False) }}
|
||||
</section>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
|
||||
{{ render_partial('partials/start_date.html', person_id=person_id, workout_id=workout_id,
|
||||
start_date=start_date) }}
|
||||
{{ render_partial('partials/workout_note.html', person_id=person_id, workout_id=workout_id,
|
||||
note=note) }}
|
||||
</div>
|
||||
<section class="workout-card workout-results" aria-labelledby="sets-heading">
|
||||
<div class="workout-section-heading">
|
||||
<div><h2 id="sets-heading">Session exercises</h2><p class="workout-subtle">Your top sets, records and progress.</p></div>
|
||||
</div>
|
||||
<table class="workout-table">
|
||||
<thead><tr><th scope="col">Exercise</th><th scope="col">Top set</th><th scope="col"><span class="sr-only">Actions</span></th></tr></thead>
|
||||
<tbody id="new-workout" hx-target="closest tr" hx-swap="outerHTML swap:0.5s">
|
||||
{% for top_set in top_sets %}
|
||||
{{ render_partial('partials/topset.html', person_id=person_id, workout_id=workout_id, **top_set) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="workout-empty" id="no-workouts"><strong>Your session starts here</strong><p>Add your first top set above. Progress and records will appear here.</p></div>
|
||||
<div id="exercise-progress"></div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<button type="button"
|
||||
class="absolute top-4 right-4 text-gray-400 bg-transparent hover:bg-gray-100 hover:text-gray-900 rounded-lg text-sm p-2 transition-colors inline-flex items-center"
|
||||
hx-get="{{ url_for('workout.delete_workout', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-confirm="Are you sure you wish to delete this workout?" hx-push-url="true"
|
||||
hx-target="#container">
|
||||
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="sr-only">Delete workout</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Multi-Category Breakdown Stripes -->
|
||||
<div class="bg-gray-50/50 border-b divide-y divide-gray-100">
|
||||
{{ render_partial('partials/workout_breakdown.html', person_id=person_id, workout_id=workout_id,
|
||||
distribution=muscle_distribution, category_name='Muscle Group') }}
|
||||
|
||||
{{ render_partial('partials/workout_breakdown.html', person_id=person_id, workout_id=workout_id,
|
||||
distribution=equipment_distribution, category_name='Machine vs Free Weight') }}
|
||||
|
||||
{{ render_partial('partials/workout_breakdown.html', person_id=person_id, workout_id=workout_id,
|
||||
distribution=movement_distribution, category_name='Compound vs Isolation') }}
|
||||
</div>
|
||||
|
||||
<!-- Workout Content Card -->
|
||||
<div class="p-0">
|
||||
<div class="p-2 md:p-4 border-0 md:border-b">
|
||||
<!-- Modal footer / New Set Form -->
|
||||
<div class="flex items-center p-1 md:p-2 rounded-b">
|
||||
{{ render_partial('partials/new_set_form.html', person_id=person_id,
|
||||
workout_id=workout_id,
|
||||
exercises=exercises,
|
||||
has_value=False) }}
|
||||
</div>
|
||||
|
||||
<!-- Modal body / Top Sets Table -->
|
||||
<div class="p-3 md:p-6 space-y-6">
|
||||
<table class="items-center w-full bg-transparent border-collapse table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th
|
||||
class="px-4 bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap">
|
||||
Exercise</th>
|
||||
<th
|
||||
class="px-4 bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap">
|
||||
Top Set</th>
|
||||
<th
|
||||
class="bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap w-9 sm:w-20">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100" id="new-workout" hx-target="closest tr"
|
||||
hx-swap="outerHTML swap:0.5s">
|
||||
{% for top_set in top_sets %}
|
||||
{{ render_partial('partials/topset.html', person_id=person_id,
|
||||
workout_id=workout_id, **top_set) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if top_sets|length == 0 %}
|
||||
<div class="bg-purple-100 rounded-lg py-5 px-6 mb-4 text-base text-purple-700 mb-3" role="alert"
|
||||
id="no-workouts">
|
||||
No sets recorded for this session.
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div id="exercise-progress" class="mx-0 md:mx-5">
|
||||
</div>
|
||||
<aside class="workout-sidebar" aria-label="Session information">
|
||||
{{ render_partial('partials/workout_summary.html', person_id=person_id, workout_id=workout_id, top_sets=top_sets) }}
|
||||
<details class="workout-card workout-disclosure" open>
|
||||
<summary>Training balance <span class="workout-subtle">Muscles & equipment</span></summary>
|
||||
<div class="workout-disclosure-body">
|
||||
{{ render_partial('partials/workout_breakdown.html', person_id=person_id, workout_id=workout_id, distribution=muscle_distribution, category_name='Muscle Group') }}
|
||||
<details class="workout-secondary-details">
|
||||
<summary>Equipment & movement</summary>
|
||||
{{ render_partial('partials/workout_breakdown.html', person_id=person_id, workout_id=workout_id, distribution=equipment_distribution, category_name='Machine vs Free Weight') }}
|
||||
{{ render_partial('partials/workout_breakdown.html', person_id=person_id, workout_id=workout_id, distribution=movement_distribution, category_name='Compound vs Isolation') }}
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
<details class="workout-card workout-disclosure" {% if note %}open{% endif %}>
|
||||
<summary>Session notes <span class="workout-subtle">Cues, energy, how it felt</span></summary>
|
||||
<div class="workout-disclosure-body">
|
||||
{{ render_partial('partials/workout_note.html', person_id=person_id, workout_id=workout_id, note=note or '') }}
|
||||
</div>
|
||||
</details>
|
||||
<details class="workout-card workout-disclosure">
|
||||
<summary>Tags <span class="workout-subtle">Organize this session</span></summary>
|
||||
<div class="workout-disclosure-body">
|
||||
{{ render_partial('partials/workout_tags.html', person_id=person_id, workout_id=workout_id, tags=tags) }}
|
||||
</div>
|
||||
</details>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden" hx-get="{{ url_for('get_stats') }}" hx-vals='{"person_id": "{{ person_id }}"}' hx-trigger="load"
|
||||
hx-target="#stats" hx-swap="innerHTML">
|
||||
</div>
|
||||
<div class="hidden" hx-get="{{ url_for('get_stats') }}" hx-vals='{"person_id": "{{ person_id }}"}' hx-trigger="load" hx-target="#stats" hx-swap="innerHTML"></div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user