- Combine Country/City into Location column with city as desktop subtext - Add City as separate mobile-only field for card layout - Move homepage icon into Actions column alongside delete button - Remove bordered style from homepage icon to match other action icons
114 lines
6 KiB
HTML
114 lines
6 KiB
HTML
{% import "partials/table.html" as table %}
|
|
|
|
<div id="roaster-list" class="mt-6" data-star-scope="roasters">
|
|
{% if roasters.items.is_empty() && !navigator.has_search() %}
|
|
<div
|
|
class="rounded-lg border border-dashed border-amber-300 bg-amber-100/40 px-4 py-6 text-sm text-stone-600"
|
|
>
|
|
<p class="text-center">
|
|
No roasters recorded yet. Use the form above to add your first roaster.
|
|
</p>
|
|
</div>
|
|
{% else %}
|
|
<section class="rounded-lg border border-amber-300 bg-amber-100/80 shadow-sm"
|
|
{% if roasters.has_next() %}data-infinite-scroll data-next-url="{{ navigator.fragment_page_href(roasters.next_page().unwrap())|safe }}" data-target="#roaster-list"{% endif %}
|
|
>
|
|
{% call table::search_header(navigator, "#roaster-list") %}
|
|
<div class="overflow-x-auto">
|
|
<table class="responsive-table min-w-full divide-y divide-amber-200 text-left text-sm text-stone-700">
|
|
<thead class="bg-amber-200/60 text-xs font-semibold tracking-wide text-amber-900">
|
|
<tr>
|
|
{% call table::sortable_header("Added", "created-at", navigator, "#roaster-list") %}
|
|
{% call table::sortable_header("Name", "name", navigator, "#roaster-list") %}
|
|
{% call table::sortable_header("Location", "country", navigator, "#roaster-list") %}
|
|
<th scope="col" class="px-4 py-3">Notes</th>
|
|
<th scope="col" class="px-4 py-3 text-right">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-amber-200/70">
|
|
{% for roaster in roasters.items %}
|
|
<tr
|
|
data-star-key="{{ roaster.id }}"
|
|
data-sort-created-at="{{ roaster.created_at_sort_key }}"
|
|
data-sort-name="{{ roaster.name }}"
|
|
data-sort-country="{{ roaster.country }}"
|
|
data-sort-city="{{ roaster.city }}"
|
|
class="bg-amber-50/40 transition hover:bg-amber-50"
|
|
>
|
|
<td data-label="Added" class="whitespace-nowrap px-4 py-3 text-xs font-medium text-stone-600">
|
|
{{ roaster.created_at }}
|
|
</td>
|
|
<td data-label="Name" class="px-4 py-3">
|
|
<a
|
|
href="{{ roaster.detail_path }}"
|
|
class="font-semibold text-amber-800 hover:text-amber-600"
|
|
>{{ roaster.name }}</a
|
|
>
|
|
</td>
|
|
<td data-label="Location" class="px-4 py-3 whitespace-nowrap">
|
|
{{ roaster.country }}
|
|
{% if !roaster.city.is_empty() %}
|
|
<div class="hidden md:block text-xs text-stone-500">{{ roaster.city }}</div>
|
|
{% endif %}
|
|
</td>
|
|
{% if !roaster.city.is_empty() %}
|
|
<td data-label="City" class="px-4 py-3 whitespace-nowrap md:hidden">{{ roaster.city }}</td>
|
|
{% endif %}
|
|
<td data-label="Notes" class="mobile-hidden px-4 py-3 text-sm text-stone-600">{{ roaster.notes }}</td>
|
|
<td data-label="" class="px-4 py-3 text-right">
|
|
<div class="inline-flex items-center gap-1">
|
|
{% if roaster.has_homepage %}
|
|
<a
|
|
class="hidden md:inline-flex h-8 w-8 items-center justify-center rounded-md text-stone-500 transition hover:text-amber-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-500"
|
|
href="{{ roaster.homepage_url }}"
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
title="Visit homepage"
|
|
>
|
|
<span class="sr-only">Visit {{ roaster.name }} homepage</span>
|
|
<svg class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
<path
|
|
fill-rule="evenodd"
|
|
d="M11.3 2a.7.7 0 0 0 0 1.4h3.3l-8.1 8.1a.7.7 0 1 0 1 1l8.1-8.1v3.3a.7.7 0 1 0 1.4 0V2.7A.7.7 0 0 0 16.3 2h-5Z"
|
|
clip-rule="evenodd"
|
|
/>
|
|
<path
|
|
d="M4.7 5.2a1.5 1.5 0 0 1 1.5-1.5h2.1a.7.7 0 1 0 0-1.4H6.2a2.9 2.9 0 0 0-2.9 2.9v7.6a2.9 2.9 0 0 0 2.9 2.9h7.6a2.9 2.9 0 0 0 2.9-2.9v-2.1a.7.7 0 1 0-1.4 0v2.1a1.5 1.5 0 0 1-1.5 1.5H6.1a1.5 1.5 0 0 1-1.5-1.5V5.2Z"
|
|
/>
|
|
</svg>
|
|
</a>
|
|
{% endif %}
|
|
{% if is_authenticated %}
|
|
<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 roaster"
|
|
data-on:click="confirm('Delete this roaster?') && @delete('/api/v1/roasters/{{ roaster.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#roaster-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>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% if roasters.items.is_empty() %}
|
|
<div class="p-8 text-center text-stone-500">No roasters match your search.</div>
|
|
{% endif %}
|
|
{% call table::pagination_header(roasters, navigator, "#roaster-list") %}
|
|
{% if roasters.has_next() %}
|
|
<div class="infinite-scroll-sentinel h-4" aria-hidden="true"></div>
|
|
{% endif %}
|
|
</section>
|
|
{% endif %}
|
|
</div>
|