Replace ~268 hardcoded text-stone-* classes with theme-aware token utilities (text-text, text-text-secondary, text-text-muted) across all templates and JS components. Adjust dark mode token values to meet WCAG AA contrast ratios on dark surfaces.
121 lines
6.4 KiB
HTML
121 lines
6.4 KiB
HTML
{% import "partials/lists/table.html" as table %}
|
|
{% import "partials/icons.html" as icons %}
|
|
|
|
<div id="cafe-list" class="mt-6" data-star-scope="cafes">
|
|
{% if cafes.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 cafes added yet. Click the Add button to add your first cafe.
|
|
{% else %}
|
|
No cafes added yet.
|
|
{% endif %}
|
|
</p>
|
|
</div>
|
|
{% else %}
|
|
<section class="rounded-lg border bg-surface"
|
|
{% if cafes.has_next() %}data-infinite-scroll data-next-url="{{ navigator.fragment_page_href(cafes.next_page().unwrap())|safe }}" data-target="#cafe-list"{% endif %}
|
|
>
|
|
{% call table::search_header(navigator, "#cafe-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, "#cafe-list") %}
|
|
{% call table::sortable_header("Name", "name", navigator, "#cafe-list") %}
|
|
{% call table::sortable_header("Location", "country", navigator, "#cafe-list") %}
|
|
<th scope="col" class="px-4 py-3 text-right">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y/70">
|
|
{% for cafe in cafes.items %}
|
|
<tr
|
|
data-star-key="{{ cafe.id }}"
|
|
data-sort-created-at="{{ cafe.created_at_sort_key }}"
|
|
data-sort-name="{{ cafe.name }}"
|
|
data-sort-country="{{ cafe.country }}"
|
|
data-sort-city="{{ cafe.city }}"
|
|
class="transition hover:bg-surface-alt"
|
|
>
|
|
<td data-label="Added" class="card-date whitespace-nowrap px-4 py-3 text-xs font-medium text-text-secondary">
|
|
<div>{{ cafe.created_date }}</div>
|
|
<div class="hidden md:block font-normal text-text-muted">{{ cafe.created_time }}</div>
|
|
</td>
|
|
<td data-label="Name" class="card-title px-4 py-3 font-medium text-text">
|
|
{{ cafe.name }}
|
|
</td>
|
|
<td data-label="Location" class="px-4 py-3 whitespace-nowrap">
|
|
{{ cafe.country }}
|
|
<div class="hidden md:block text-xs text-text-muted">{{ cafe.city }}</div>
|
|
</td>
|
|
<td data-label="City" class="px-4 py-3 whitespace-nowrap md:hidden">{{ cafe.city }}</td>
|
|
<td data-label="" class="card-detail hidden">
|
|
<div class="flex items-center gap-4">
|
|
<a class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover"
|
|
href="{{ cafe.map_url }}" target="_blank" rel="noreferrer noopener">
|
|
{% call icons::location("h-4 w-4") %} View Map
|
|
</a>
|
|
{% if cafe.has_website %}
|
|
<a class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover"
|
|
href="{{ cafe.website_url }}" target="_blank" rel="noreferrer noopener">
|
|
{% call icons::external_link("h-4 w-4") %} Homepage
|
|
</a>
|
|
{% endif %}
|
|
{% if is_authenticated %}
|
|
<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 cafe?') && @delete('/api/v1/cafes/{{ cafe.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#cafe-list', mode: 'replace'}})">
|
|
{% call icons::delete("h-4 w-4") %} Delete
|
|
</button>
|
|
{% endif %}
|
|
</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"
|
|
onclick="const tr=this.closest('tr');const d=tr.querySelector('.card-detail');if(d)d.classList.toggle('hidden');const r=tr.nextElementSibling;if(r&&r.classList.contains('detail-row'))r.classList.toggle('hidden');this.querySelector('.icon-expand').classList.toggle('hidden');this.querySelector('.icon-collapse').classList.toggle('hidden');"
|
|
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>
|
|
</tr>
|
|
<tr class="hidden detail-row">
|
|
<td colspan="4" class="bg-surface-alt px-4 py-2">
|
|
<div class="flex items-center gap-4">
|
|
<a class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover"
|
|
href="{{ cafe.map_url }}" target="_blank" rel="noreferrer noopener">
|
|
{% call icons::location("h-4 w-4") %} View Map
|
|
</a>
|
|
{% if cafe.has_website %}
|
|
<a class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover"
|
|
href="{{ cafe.website_url }}" target="_blank" rel="noreferrer noopener">
|
|
{% call icons::external_link("h-4 w-4") %} Homepage
|
|
</a>
|
|
{% endif %}
|
|
{% if is_authenticated %}
|
|
<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 cafe?') && @delete('/api/v1/cafes/{{ cafe.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#cafe-list', mode: 'replace'}})">
|
|
{% call icons::delete("h-4 w-4") %} Delete
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% if cafes.items.is_empty() %}
|
|
<div class="p-8 text-center text-text-muted">No cafes match your search.</div>
|
|
{% endif %}
|
|
{% call table::pagination_header(cafes, navigator, "#cafe-list") %}
|
|
{% if cafes.has_next() %}
|
|
<div class="infinite-scroll-sentinel h-4 md:hidden" aria-hidden="true"></div>
|
|
{% endif %}
|
|
</section>
|
|
{% endif %}
|
|
</div>
|