- Add spacious flat table CSS for desktop (transparent card wrapper, lighter dividers, visible hover, larger cell padding) - Split roaster/cafe columns into separate Country and City columns with sortable headers - Split cup Roast/Roaster into separate desktop columns with city sort support (full-stack: domain, repo, view, template) - Add sortable Status column to bags with colored pills (green Open, amber Closed) and remaining weight subtext - Style bag Finished column as date-only (NaiveDate) and Weight column with smaller text - Show status pill next to mobile bag card actions menu - Add city to cups mobile card view - Use middle dot separator for brew recipe weight/volume - Add tasting notes pills to roast list, brew notes to brew list - Fix build.rs to use rerun-if-changed for CSS and templates
104 lines
5.6 KiB
HTML
104 lines
5.6 KiB
HTML
{% import "partials/lists/table.html" as table %}
|
|
{% import "partials/icons.html" as icons %}
|
|
|
|
<div id="cup-list" class="mt-6" data-star-scope="cups">
|
|
{% if cups.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 cups added yet. Click the Add button to add your first cup.
|
|
{% else %}
|
|
No cups added yet.
|
|
{% endif %}
|
|
</p>
|
|
</div>
|
|
{% else %}
|
|
<section class="rounded-lg border bg-surface"
|
|
{% if cups.has_next() %}data-infinite-scroll data-next-url="{{ navigator.fragment_page_href(cups.next_page().unwrap())|safe }}" data-target="#cup-list"{% endif %}
|
|
>
|
|
{% call table::search_header(navigator, "#cup-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">
|
|
<tr>
|
|
{% call table::sortable_header("Added", "created-at", navigator, "#cup-list") %}
|
|
{% call table::sortable_header("Roast", "roast", navigator, "#cup-list") %}
|
|
{% call table::sortable_header("Roaster", "roaster", navigator, "#cup-list") %}
|
|
{% call table::sortable_header("Cafe", "cafe", navigator, "#cup-list") %}
|
|
{% call table::sortable_header("City", "city", navigator, "#cup-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 cup in cups.items %}
|
|
<tr
|
|
data-star-key="{{ cup.id }}"
|
|
class="transition hover:bg-surface-alt"
|
|
{% if is_authenticated %}onclick="if(event.target.closest('.card-detail'))return;this.classList.toggle('expanded');this.querySelector('.card-detail')?.classList.toggle('hidden');const r=this.nextElementSibling;if(r?.classList.contains('detail-row'))r.classList.toggle('hidden');this.querySelector('.icon-expand')?.classList.toggle('hidden');this.querySelector('.icon-collapse')?.classList.toggle('hidden');"{% endif %}
|
|
>
|
|
<td data-label="Added" class="card-date whitespace-nowrap px-4 py-3 text-xs font-medium text-text-secondary">
|
|
<div>{{ cup.created_date }}</div>
|
|
<div class="hidden md:block font-normal text-text-muted">{{ cup.created_time }}</div>
|
|
</td>
|
|
<td data-label="Coffee" class="card-title px-4 py-3 whitespace-nowrap md:hidden">
|
|
<div class="font-medium text-text">{{ cup.roast_name }}</div>
|
|
</td>
|
|
<td data-label="Roaster" class="px-4 py-3 whitespace-nowrap md:hidden">{{ cup.roaster_name }}</td>
|
|
<td data-label="Roast" class="mobile-hidden px-4 py-3 whitespace-nowrap font-medium text-text">{{ cup.roast_name }}</td>
|
|
<td data-label="Roaster" class="mobile-hidden px-4 py-3 whitespace-nowrap">{{ cup.roaster_name }}</td>
|
|
<td data-label="Cafe" class="px-4 py-3 whitespace-nowrap">
|
|
{{ cup.cafe_name }}
|
|
</td>
|
|
<td data-label="City" class="px-4 py-3 whitespace-nowrap md:hidden">{{ cup.cafe_city }}</td>
|
|
<td data-label="City" class="mobile-hidden px-4 py-3 whitespace-nowrap">{{ cup.cafe_city }}</td>
|
|
{% if is_authenticated %}
|
|
<td data-label="" class="card-detail hidden">
|
|
<div class="flex items-center gap-4">
|
|
<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 cup?') && @delete('/api/v1/cups/{{ cup.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#cup-list', mode: 'replace'}})">
|
|
{% call icons::delete("h-4 w-4") %} Delete
|
|
</button>
|
|
</div>
|
|
</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">{% call icons::ellipsis_vertical("h-5 w-5") %}</span>
|
|
<span class="icon-collapse hidden">{% call icons::chevron_up("h-5 w-5") %}</span>
|
|
</button>
|
|
</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">
|
|
<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 cup?') && @delete('/api/v1/cups/{{ cup.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#cup-list', mode: 'replace'}})">
|
|
{% call icons::delete("h-4 w-4") %} Delete
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% if cups.items.is_empty() %}
|
|
<div class="p-8 text-center text-text-muted">No cups match your search.</div>
|
|
{% endif %}
|
|
{% call table::pagination_header(cups, navigator, "#cup-list") %}
|
|
{% if cups.has_next() %}
|
|
<div class="infinite-scroll-sentinel h-4 md:hidden" aria-hidden="true"></div>
|
|
{% endif %}
|
|
</section>
|
|
{% endif %}
|
|
</div>
|