Improve look of exercise list in settings page

This commit is contained in:
Peter Stockings
2026-02-08 16:23:31 +11:00
parent 0cd74f7207
commit 31f738cfb3
3 changed files with 135 additions and 119 deletions

View File

@@ -169,19 +169,19 @@
<thead class="bg-gray-50">
<tr>
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">
Name
class="p-4 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
Exercise Name
</th>
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/2">
class="p-4 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider hidden sm:table-cell">
Attributes
</th>
<th scope="col"
class="p-4 text-right text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">
class="p-4 text-right text-xs font-semibold text-gray-500 uppercase tracking-wider">
<div class="relative max-w-xs ml-auto">
<div
class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="w-4 h-4 text-gray-500" aria-hidden="true"
<svg class="w-4 h-4 text-gray-400" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 20 20">
<path stroke="currentColor" stroke-linecap="round"
@@ -190,14 +190,14 @@
</svg>
</div>
<input type="search" id="exercise-search"
class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-cyan-500 focus:border-cyan-500 shadow-sm"
class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-cyan-500 focus:border-cyan-500 transition-all shadow-sm"
placeholder="Search exercises..."
_="on input show <tbody>tr/> in closest <table/> when its textContent.toLowerCase() contains my value.toLowerCase()">
</div>
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200" id="new-exercise"
<tbody class="bg-white divide-y divide-gray-100" id="new-exercise"
hx-target="closest tr" hx-swap="outerHTML swap:0.5s">
{% for exercise in exercises %}
{{ render_partial('partials/exercise.html', exercise_id=exercise.exercise_id,
@@ -210,29 +210,33 @@
</div>
</div>
<div class="mt-10">
<h4 class="text-lg font-semibold text-gray-900 mb-4">Add New Exercise</h4>
<form class="bg-gray-50 p-6 rounded-lg border border-gray-100"
hx-post="{{ url_for('exercises.create_exercise') }}" hx-swap="beforeend" hx-target="#new-exercise"
<div class="mt-12 bg-gray-50/50 p-6 rounded-2xl border border-gray-100 shadow-sm">
<div class="mb-6">
<h4 class="text-lg font-bold text-gray-900">Add New Exercise</h4>
<p class="text-sm text-gray-500">Create a new exercise with specific muscle groups and equipment.
</p>
</div>
<form hx-post="{{ url_for('exercises.create_exercise') }}" hx-swap="beforeend" hx-target="#new-exercise"
_="on htmx:afterRequest
render #notification-template with (message: 'Exercise added') then append it to #notifications-container
then call _hyperscript.processNode(#notifications-container)
then reset() me">
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6 items-start">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<div class="lg:col-span-1">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2">
<label class="block text-xs font-bold text-gray-700 uppercase mb-2">
Exercise Name
</label>
<input
class="appearance-none block w-full bg-white text-gray-700 border border-gray-300 rounded-lg py-3 px-4 leading-tight focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:border-transparent"
type="text" name="name" placeholder="e.g. Bench Press">
class="w-full bg-white text-gray-700 border border-gray-300 rounded-xl py-2.5 px-4 leading-tight focus:outline-none focus:ring-2 focus:ring-cyan-500/20 focus:border-cyan-500 transition-all"
type="text" name="name" placeholder="e.g. Bench Press" required>
</div>
<div class="lg:col-span-2 grid grid-cols-1 sm:grid-cols-3 gap-4">
<div class="md:col-span-2 grid grid-cols-1 sm:grid-cols-3 gap-4">
{% for cat_name, options in all_attributes.items() %}
<div>
<label class="block text-xs font-bold text-gray-500 uppercase mb-1">{{ cat_name
<label class="block text-xs font-bold text-gray-400 uppercase mb-2">{{ cat_name
}}</label>
{{ render_partial('partials/custom_select.html',
name='attribute_ids',
@@ -245,9 +249,9 @@
{% endfor %}
</div>
<div class="lg:col-span-1 pt-6">
<div class="lg:col-span-1 flex items-end">
<button
class="w-full flex items-center justify-center text-white bg-cyan-600 hover:bg-cyan-700 focus:ring-4 focus:ring-cyan-200 font-medium rounded-lg text-sm px-5 py-3 transition-colors h-12 cursor-pointer shadow-sm"
class="w-full flex items-center justify-center text-white bg-cyan-600 hover:bg-cyan-700 focus:ring-4 focus:ring-cyan-200 font-bold rounded-xl text-sm px-5 py-3 transition-all shadow-md active:scale-95 cursor-pointer"
type="submit">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">