brewlog/templates/partials/lists/brew_list.html
Jon Seager af9344202d
refactor(css): add text-2xs and small-caps utilities, replace inline styles
- Add @utility text-2xs (0.65rem) and small-caps (font-variant) to input.css
- Replace inline style="font-variant: small-caps" with .small-caps class
  across all list partials and base.html footer
- Add gap support to .tab and .tab-mobile for icon+label layout
- Reduce mobile top padding (py-4 md:py-10) on main container
- Rename CSS section header from "Scrollbar hide" to "Utilities"
2026-02-07 22:36:28 +00:00

138 lines
6.3 KiB
HTML

{% import "partials/lists/table.html" as table %}
{% import "partials/icons.html" as icons %}
{% macro brew_actions(brew, navigator) %}
<div class="flex items-center gap-4">
<a href="{{ brew.brew_again_url() }}"
class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover">
{{ icons::plus_circle("h-4 w-4") }} Brew Again
</a>
<button type="button"
class="inline-flex items-center gap-1 text-sm font-medium text-text-muted hover:text-red-600"
data-on:click="confirm('Delete this brew?') && @delete('/api/v1/brews/{{ brew.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#brew-list', mode: 'replace'}})">
{{ icons::delete("h-4 w-4") }} Delete
</button>
</div>
{% endmacro %}
<div id="brew-list" class="mt-6" data-star-scope="brews">
{% if brews.items.is_empty() && !navigator.has_search() %}
<div
class="rounded-lg border border-dashed px-4 py-6 text-sm text-text-secondary"
>
<p class="text-center">
{% if is_authenticated %}
No brews logged yet. Click the Add button to log your first brew.
{% else %}
No brews logged yet.
{% endif %}
</p>
</div>
{% else %}
<section class="rounded-lg border bg-surface"
{% if brews.has_next() %}data-infinite-scroll data-next-url="{{ navigator.fragment_page_href(brews.next_page().unwrap())|safe }}" data-target="#brew-list"{% endif %}
>
{{ table::search_header(navigator, "#brew-list") }}
<div class="overflow-x-auto">
<table class="responsive-table min-w-full divide-y text-left text-sm text-text">
<thead class="bg-surface-alt text-xs font-semibold tracking-wide text-text small-caps">
<tr>
{{ table::sortable_header("Added", "created-at", navigator, "#brew-list") }}
<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">Recipe</th>
<th scope="col" class="px-4 py-3">Brewer</th>
<th scope="col" class="px-4 py-3">Notes</th>
{% if is_authenticated %}
<th scope="col" class="actions-col px-4 py-3 text-right">Actions</th>
{% endif %}
</tr>
</thead>
<tbody class="divide-y/70">
{% for brew in brews.items %}
<tr class="transition hover:bg-surface-alt"
{% if is_authenticated %}onclick="toggleRow(event)"{% endif %}
>
<td data-label="Added" class="card-date whitespace-nowrap px-4 py-3 font-medium text-text-secondary">
<div>{{ brew.created_date }}</div>
<div class="hidden md:block text-xs font-normal text-text-muted">{{ brew.created_time }}</div>
</td>
<td data-label="Coffee" class="card-title px-4 py-3 whitespace-nowrap">
<div class="font-medium text-text">{{ brew.roast_name }}</div>
<div class="hidden md:block text-xs text-text-muted">{{ brew.roaster_name }}</div>
</td>
<td data-label="Roaster" class="px-4 py-3 whitespace-nowrap md:hidden">{{ brew.roaster_name }}</td>
<td data-label="Grind" class="px-4 py-3 whitespace-nowrap">
<div>{{ brew.grind_setting }}</div>
<div class="hidden md:block text-xs text-text-muted">{{ brew.grinder_name }}</div>
</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">
<div>{{ brew.coffee_weight }} · {{ brew.water_volume }}</div>
<div class="hidden md:block text-xs text-text-muted">{% if let Some(bt) = brew.brew_time %}{{ bt }} · {% endif %}{{ brew.water_temp }}</div>
</td>
{% if let Some(bt) = brew.brew_time %}
<td data-label="Brew Time" class="px-4 py-3 whitespace-nowrap md:hidden">{{ bt }}</td>
{% endif %}
<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">
<div>{{ brew.brewer_name }}</div>
{% if let Some(fp_name) = brew.filter_paper_name %}
<div class="hidden md:block text-xs text-text-muted">{{ fp_name }}</div>
{% endif %}
</td>
{% if let Some(fp_name) = brew.filter_paper_name %}
<td data-label="Filter" class="px-4 py-3 whitespace-nowrap md:hidden">{{ fp_name }}</td>
{% endif %}
<td data-label="Notes" class="px-4 py-3">
{% if !brew.quick_notes.is_empty() %}
<div class="flex flex-wrap gap-1">
{% for qn in brew.quick_notes %}
<span class="{{ qn.pill_class }}">{{ qn.label }}</span>
{% endfor %}
</div>
{% else %}
<span class="pill pill-muted">No Notes</span>
{% endif %}
</td>
{% if is_authenticated %}
<td data-label="" class="card-detail hidden">
{{ brew_actions(brew, navigator) }}
</td>
<td data-label="" class="card-actions px-4 py-3 text-right">
<button type="button"
class="inline-flex h-8 w-8 items-center justify-center rounded-md text-text-muted transition hover:text-accent hover:bg-surface-alt"
title="Actions">
<span class="icon-expand">{{ icons::ellipsis_vertical("h-5 w-5") }}</span>
<span class="icon-collapse hidden">{{ icons::chevron_up("h-5 w-5") }}</span>
</button>
</td>
{% endif %}
</tr>
{% if is_authenticated %}
<tr class="hidden detail-row">
<td colspan="7" class="bg-surface-alt px-4 py-2">
{{ brew_actions(brew, navigator) }}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% if brews.items.is_empty() %}
<div class="p-8 text-center text-text-muted">
No brews match your search.
</div>
{% endif %}
{{ table::pagination_header(brews, navigator, "#brew-list") }}
{% if brews.has_next() %}
<div class="infinite-scroll-sentinel h-4 md:hidden" aria-hidden="true"></div>
{% endif %}
</section>
{% endif %}
</div>