fix(brews): lay out action icons horizontally and merge temp into recipe

Wrap the brew-again form and delete button in an inline-flex container
to match the horizontal layout used in other tables. Fold water
temperature into the Recipe column as desktop subtext alongside the
ratio, reducing the table from 7 to 6 columns and eliminating the
horizontal scrollbar. Document the Actions column pattern in CLAUDE.md.
This commit is contained in:
Jon Seager 2026-02-03 13:08:07 +00:00
parent 2d27228059
commit 35e8460219
No known key found for this signature in database
2 changed files with 51 additions and 35 deletions

View file

@ -366,6 +366,21 @@ Every table has a sortable "Added" column as its **first column**, sorted by `cr
The `text-xs font-medium text-stone-600` classes give it a muted, compact appearance compared to the default `text-sm` body text. The `text-xs font-medium text-stone-600` classes give it a muted, compact appearance compared to the default `text-sm` body text.
### Actions Column
When a row has multiple action buttons/icons, wrap them in `<div class="inline-flex items-center gap-1">` inside the `<td>` to keep them horizontal. Without this wrapper, block-level elements like `<form>` will stack vertically.
```html
<td data-label="" class="px-4 py-3 text-right">
<div class="inline-flex items-center gap-1">
<form class="inline" ...>
<button type="submit" class="inline-flex h-8 w-8 ...">...</button>
</form>
<button type="button" class="inline-flex h-8 w-8 ...">...</button>
</div>
</td>
```
### Responsive Table Pattern ### Responsive Table Pattern
Tables use the `responsive-table` CSS class which converts rows to card-style layout on mobile (`max-width: 767px`). The CSS in `styles.css` hides `<thead>` and uses `data-label` attributes on `<td>` elements to show field labels. Tables use the `responsive-table` CSS class which converts rows to card-style layout on mobile (`max-width: 767px`). The CSS in `styles.css` hides `<thead>` and uses `data-label` attributes on `<td>` elements to show field labels.

View file

@ -14,7 +14,6 @@
<th scope="col" class="px-4 py-3">Coffee</th> <th scope="col" class="px-4 py-3">Coffee</th>
<th scope="col" class="px-4 py-3">Grind</th> <th scope="col" class="px-4 py-3">Grind</th>
<th scope="col" class="px-4 py-3">Recipe</th> <th scope="col" class="px-4 py-3">Recipe</th>
<th scope="col" class="px-4 py-3">Temp</th>
<th scope="col" class="px-4 py-3">Brewer</th> <th scope="col" class="px-4 py-3">Brewer</th>
{% if is_authenticated %} {% if is_authenticated %}
<th scope="col" class="px-4 py-3 text-center">Actions</th> <th scope="col" class="px-4 py-3 text-center">Actions</th>
@ -51,10 +50,10 @@
<td data-label="Grinder" class="px-4 py-3 whitespace-nowrap md:hidden">{{ brew.grinder_name }}</td> <td data-label="Grinder" class="px-4 py-3 whitespace-nowrap md:hidden">{{ brew.grinder_name }}</td>
<td data-label="Recipe" class="px-4 py-3 whitespace-nowrap"> <td data-label="Recipe" class="px-4 py-3 whitespace-nowrap">
<div>{{ brew.coffee_weight }} / {{ brew.water_volume }}</div> <div>{{ brew.coffee_weight }} / {{ brew.water_volume }}</div>
<div class="hidden md:block text-xs text-stone-500 font-mono">{{ brew.ratio }}</div> <div class="hidden md:block text-xs text-stone-500">{{ brew.ratio }} · {{ brew.water_temp }}</div>
</td> </td>
<td data-label="Ratio" class="px-4 py-3 whitespace-nowrap md:hidden">{{ brew.ratio }}</td> <td data-label="Ratio" class="px-4 py-3 whitespace-nowrap md:hidden">{{ brew.ratio }}</td>
<td data-label="Temp" class="px-4 py-3 whitespace-nowrap">{{ brew.water_temp }}</td> <td data-label="Temp" class="px-4 py-3 whitespace-nowrap md:hidden">{{ brew.water_temp }}</td>
<td data-label="Brewer" class="px-4 py-3 whitespace-nowrap"> <td data-label="Brewer" class="px-4 py-3 whitespace-nowrap">
<div>{{ brew.brewer_name }}</div> <div>{{ brew.brewer_name }}</div>
{% if let Some(fp_name) = brew.filter_paper_name %} {% if let Some(fp_name) = brew.filter_paper_name %}
@ -66,47 +65,49 @@
{% endif %} {% endif %}
{% if is_authenticated %} {% if is_authenticated %}
<td data-label="" class="px-4 py-3 text-right"> <td data-label="" class="px-4 py-3 text-right">
<form class="inline" data-on:submit="@post('/api/v1/brews?{{ navigator.query() }}', {contentType: 'form', responseOverrides: {selector: '#brew-list', mode: 'replace'}})"> <div class="inline-flex items-center gap-1">
<input type="hidden" name="bag_id" value="{{ brew.bag_id }}" /> <form class="inline" data-on:submit="@post('/api/v1/brews?{{ navigator.query() }}', {contentType: 'form', responseOverrides: {selector: '#brew-list', mode: 'replace'}})">
<input type="hidden" name="coffee_weight" value="{{ brew.coffee_weight_raw }}" /> <input type="hidden" name="bag_id" value="{{ brew.bag_id }}" />
<input type="hidden" name="grinder_id" value="{{ brew.grinder_id }}" /> <input type="hidden" name="coffee_weight" value="{{ brew.coffee_weight_raw }}" />
<input type="hidden" name="grind_setting" value="{{ brew.grind_setting_raw }}" /> <input type="hidden" name="grinder_id" value="{{ brew.grinder_id }}" />
<input type="hidden" name="brewer_id" value="{{ brew.brewer_id }}" /> <input type="hidden" name="grind_setting" value="{{ brew.grind_setting_raw }}" />
{% if let Some(fp_id) = brew.filter_paper_id %} <input type="hidden" name="brewer_id" value="{{ brew.brewer_id }}" />
<input type="hidden" name="filter_paper_id" value="{{ fp_id }}" /> {% if let Some(fp_id) = brew.filter_paper_id %}
{% endif %} <input type="hidden" name="filter_paper_id" value="{{ fp_id }}" />
<input type="hidden" name="water_volume" value="{{ brew.water_volume_raw }}" /> {% endif %}
<input type="hidden" name="water_temp" value="{{ brew.water_temp_raw }}" /> <input type="hidden" name="water_volume" value="{{ brew.water_volume_raw }}" />
<input type="hidden" name="water_temp" value="{{ brew.water_temp_raw }}" />
<button
type="submit"
class="inline-flex h-8 w-8 items-center justify-center rounded-md text-stone-500 transition hover:text-amber-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-500"
title="Brew again"
>
<span class="sr-only">Brew again</span>
<svg class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path
fill-rule="evenodd"
d="M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0v2.43l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389 5.5 5.5 0 0 1 9.2-2.466l.312.311h-2.433a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.22Z"
clip-rule="evenodd"
/>
</svg>
</button>
</form>
<button <button
type="submit" type="button"
class="inline-flex h-8 w-8 items-center justify-center rounded-md text-stone-500 transition hover:text-amber-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-500" class="inline-flex h-8 w-8 items-center justify-center rounded-md text-stone-500 transition hover:text-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500"
title="Brew again" title="Delete brew"
data-on:click="confirm('Delete this brew?') && @delete('/api/v1/brews/{{ brew.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#brew-list', mode: 'replace'}})"
> >
<span class="sr-only">Brew again</span> <span class="sr-only">Delete</span>
<svg class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> <svg class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path <path
fill-rule="evenodd" fill-rule="evenodd"
d="M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0v2.43l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389 5.5 5.5 0 0 1 9.2-2.466l.312.311h-2.433a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.22Z" d="M7.5 3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1H15a1 1 0 1 1 0 2h-.4l-.74 10.36A2 2 0 0 1 11.87 17H8.13a2 2 0 0 1-1.99-1.64L5.4 5H5a1 1 0 1 1 0-2h2.5Zm.9 4.5a.75.75 0 0 1 .75.75v6a.75.75 0 1 1-1.5 0v-6a.75.75 0 0 1 .75-.75Zm3.4 0a.75.75 0 0 1 .75.75v6a.75.75 0 1 1-1.5 0v-6a.75.75 0 0 1 .75-.75Z"
clip-rule="evenodd" clip-rule="evenodd"
/> />
</svg> </svg>
</button> </button>
</form> </div>
<button
type="button"
class="inline-flex h-8 w-8 items-center justify-center rounded-md text-stone-500 transition hover:text-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500"
title="Delete brew"
data-on:click="confirm('Delete this brew?') && @delete('/api/v1/brews/{{ brew.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#brew-list', mode: 'replace'}})"
>
<span class="sr-only">Delete</span>
<svg class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path
fill-rule="evenodd"
d="M7.5 3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1H15a1 1 0 1 1 0 2h-.4l-.74 10.36A2 2 0 0 1 11.87 17H8.13a2 2 0 0 1-1.99-1.64L5.4 5H5a1 1 0 1 1 0-2h2.5Zm.9 4.5a.75.75 0 0 1 .75.75v6a.75.75 0 1 1-1.5 0v-6a.75.75 0 0 1 .75-.75Zm3.4 0a.75.75 0 0 1 .75.75v6a.75.75 0 1 1-1.5 0v-6a.75.75 0 0 1 .75-.75Z"
clip-rule="evenodd"
/>
</svg>
</button>
</td> </td>
{% endif %} {% endif %}
</tr> </tr>