brewlog/templates/partials/lists/bag_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

146 lines
7.5 KiB
HTML

{% import "partials/lists/table.html" as table %}
{% import "partials/icons.html" as icons %}
<div id="bag-list" class="mt-6" data-star-scope="bags">
{% if bags.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 bags added yet. Click the Add button to create your first bag.
{% else %}
No bags added yet.
{% endif %}
</p>
</div>
{% else %}
<section class="rounded-lg border bg-surface"
{% if bags.has_next() %}data-infinite-scroll data-next-url="{{ navigator.fragment_page_href(bags.next_page().unwrap())|safe }}" data-target="#bag-list"{% endif %}
>
{{ table::search_header(navigator, "#bag-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, "#bag-list") }}
{{ table::sortable_header("Roaster", "roaster", navigator, "#bag-list") }}
{{ table::sortable_header("Roast", "roast", navigator, "#bag-list") }}
{{ table::sortable_header("Status", "status", navigator, "#bag-list") }}
{{ table::sortable_header("Finished", "finished-at", navigator, "#bag-list") }}
{% 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 bag in bags.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>{{ bag.created_date }}</div>
<div class="hidden md:block text-xs font-normal text-text-muted">{{ bag.created_time }}</div>
</td>
<td data-label="Roaster" class="px-4 py-3 whitespace-nowrap font-medium text-text-secondary">
{{ bag.roaster_name }}
</td>
<td data-label="Roast" class="card-title px-4 py-3 whitespace-nowrap">
{{ bag.roast_name }}
</td>
<td data-label="Status" class="mobile-hidden px-4 py-3 whitespace-nowrap">
{% if bag.closed %}
<span class="pill pill-warning">Closed</span>
{% else %}
<div class="w-14">
<div class="h-1.5 rounded-full bg-surface-alt overflow-hidden">
<div class="h-full rounded-full bg-accent" style="width: {{ bag.used_percent }}%"></div>
</div>
<div class="mt-0.5 text-text-muted small-caps" style="font-size: 0.7rem">{{ bag.remaining }} / {{ bag.amount }}g</div>
</div>
{% endif %}
</td>
{% if !bag.closed %}
<td data-label="" class="card-progress md:hidden">
<div class="h-1.5 rounded-full bg-surface-alt overflow-hidden">
<div class="h-full rounded-full bg-accent" style="width: {{ bag.used_percent }}%"></div>
</div>
<div class="mt-0.5 text-right text-text-muted small-caps" style="font-size: 0.7rem">{{ bag.remaining }} / {{ bag.amount }}g</div>
</td>
{% endif %}
<td data-label="Finished" class="mobile-hidden whitespace-nowrap px-4 py-3 font-medium text-text-secondary">
<div>{{ bag.finished_date }}</div>
</td>
{% if bag.closed %}
<td data-label="Finished" class="whitespace-nowrap px-4 py-3 font-medium text-text-secondary md:hidden">
<div>{{ bag.finished_date }}</div>
</td>
{% endif %}
{% if is_authenticated %}
<td data-label="" class="card-detail hidden">
<div class="flex items-center gap-4">
{% if !bag.closed %}
<button type="button"
class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover"
data-on:click="confirm('Close this bag? This will mark it as finished.') && @put('/api/v1/bags/{{ bag.id }}?closed=true&{{ navigator.query() }}', {responseOverrides: {selector: '#bag-list', mode: 'replace'}})">
{{ icons::x_circle("h-4 w-4") }} Close bag
</button>
{% endif %}
<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 bag?') && @delete('/api/v1/bags/{{ bag.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#bag-list', mode: 'replace'}})">
{{ icons::delete("h-4 w-4") }} Delete
</button>
</div>
</td>
<td data-label="" class="card-actions px-4 py-3 text-right">
<div class="inline-flex items-center gap-2">
<span class="md:hidden">
{% if bag.closed %}
<span class="pill pill-warning text-[0.625rem] py-0 px-1.5">Closed</span>
{% endif %}
</span>
<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>
</div>
</td>
{% endif %}
</tr>
{% if is_authenticated %}
<tr class="hidden detail-row">
<td colspan="6" class="bg-surface-alt px-4 py-2">
<div class="flex items-center gap-4">
{% if !bag.closed %}
<button type="button"
class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover"
data-on:click="confirm('Close this bag? This will mark it as finished.') && @put('/api/v1/bags/{{ bag.id }}?closed=true&{{ navigator.query() }}', {responseOverrides: {selector: '#bag-list', mode: 'replace'}})">
{{ icons::x_circle("h-4 w-4") }} Close bag
</button>
{% endif %}
<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 bag?') && @delete('/api/v1/bags/{{ bag.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#bag-list', mode: 'replace'}})">
{{ icons::delete("h-4 w-4") }} Delete
</button>
</div>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% if bags.items.is_empty() %}
<div class="p-8 text-center text-text-muted">No bags match your search.</div>
{% endif %}
{{ table::pagination_header(bags, navigator, "#bag-list") }}
{% if bags.has_next() %}
<div class="infinite-scroll-sentinel h-4 md:hidden" aria-hidden="true"></div>
{% endif %}
</section>
{% endif %}
</div>