Add aria-required to required inputs, role=alert to error messages, aria-label to icon-only list nav buttons, and progressbar ARIA to bag status bars. Replace hardcoded red/green colors with error/success design tokens across all templates. Add toast notifications for entity creation and tab-switch links for empty add-form states. Increase scan upload body limit to 10MB.
128 lines
4.7 KiB
HTML
128 lines
4.7 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 Add to add the 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 %}
|
|
>
|
|
{{ 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 text-text-secondary"
|
|
>
|
|
<tr>
|
|
{{ table::sortable_header("Added", "created-at", navigator, "#cup-list") }}
|
|
{{ table::sortable_header("Roast", "roast", navigator, "#cup-list") }}
|
|
{{ table::sortable_header("Roaster", "roaster", navigator, "#cup-list") }}
|
|
{{ table::sortable_header("Cafe", "cafe", navigator, "#cup-list") }}
|
|
{{ table::sortable_header("City", "city", navigator, "#cup-list") }}
|
|
<th scope="col" class="actions-col px-4 py-3 text-right"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y/70">
|
|
{% for cup in cups.items %}
|
|
<tr
|
|
data-star-key="{{ cup.id }}"
|
|
class="transition hover:bg-surface-alt"
|
|
onclick="window.location.href='/cups/{{ cup.id }}'"
|
|
>
|
|
<td
|
|
data-label="Added"
|
|
class="card-date whitespace-nowrap px-4 py-3 font-medium text-text-secondary"
|
|
>
|
|
<div>{{ cup.created_date }}</div>
|
|
<div
|
|
class="hidden md:block text-xs 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>
|
|
<td data-label="" class="card-actions px-4 py-3 text-right">
|
|
<a
|
|
href="/cups/{{ cup.id }}"
|
|
aria-label="View {{ cup.roast_name }}"
|
|
class="inline-flex h-8 w-8 items-center justify-center rounded-md text-text-muted transition hover:text-accent hover:bg-surface-alt"
|
|
>
|
|
{{ icons::chevron_right("h-5 w-5") }}
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% if cups.items.is_empty() %}
|
|
<div class="p-8 text-center text-text-muted">
|
|
No cups match the search.
|
|
</div>
|
|
{% endif %}
|
|
{{ 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>
|