Hand-rolled login/register/logout on Laravel's built-in Auth facade rather than Breeze/Jetstream, which scaffold Tailwind v3 config and would fight our existing Tailwind v4 CSS-first setup. Login/Register are Livewire components; logout is a plain POST route (auth-gated, CSRF-protected). Routing: "/" is now a public landing page describing the project; the sites list moved from "/" to "/sites" to make room for it. Data gating: App\Support\GuestPreview::paginate() forces page 1 and a 5-row page size for unauthenticated visitors on Sites, Discover, and a site's Pages/Backlinks tables, while total() still reflects the real match count — authenticated users get the existing full pagination unchanged. A shared guest-preview-notice component shows "N of M results, sign in to see all" and only renders when something is actually being hidden. Testing: pointed the test suite at a dedicated MySQL database (huginn_testing) instead of the default in-memory SQLite, since the existing fulltext index migration isn't SQLite-compatible — this app is MySQL-specific by now regardless. Added AuthFlowTest (register, login, wrong-password rejection, logout) and GuestPreviewTest (guest capped to a preview, authenticated sees everything), all passing. Also fixed a real bug the tests caught: request()->session() isn't reliably attached during Livewire's in-process test action calls; switched Login/Register to the session() helper, which resolves the session store directly and works in both contexts.
51 lines
2.4 KiB
PHP
51 lines
2.4 KiB
PHP
<div class="mx-auto max-w-5xl px-4 py-8">
|
|
<h1 class="text-2xl font-semibold">Sites</h1>
|
|
<p class="mt-1 text-sm text-neutral-500">{{ number_format(\App\Models\Site::count()) }} sites indexed from Common Crawl.</p>
|
|
|
|
<div class="mt-6">
|
|
<input
|
|
type="search"
|
|
wire:model.live.debounce.400ms="search"
|
|
placeholder="Search by domain…"
|
|
class="w-full max-w-sm rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-neutral-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"
|
|
>
|
|
</div>
|
|
|
|
<div class="mt-6 overflow-hidden rounded-lg border border-neutral-200 dark:border-neutral-800">
|
|
<table class="min-w-full divide-y divide-neutral-200 dark:divide-neutral-800">
|
|
<thead class="bg-neutral-50 dark:bg-neutral-900">
|
|
<tr>
|
|
<th class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wide text-neutral-500">Domain</th>
|
|
<th class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wide text-neutral-500">Title</th>
|
|
<th class="px-4 py-2 text-right text-xs font-medium uppercase tracking-wide text-neutral-500">Pages</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-neutral-200 dark:divide-neutral-800">
|
|
@forelse ($sites as $site)
|
|
<tr wire:key="site-{{ $site->id }}">
|
|
<td class="px-4 py-2 text-sm">
|
|
<a href="{{ route('sites.show', $site) }}" class="font-medium text-blue-600 hover:underline dark:text-blue-400">
|
|
{{ $site->domain }}
|
|
</a>
|
|
</td>
|
|
<td class="px-4 py-2 text-sm text-neutral-600 dark:text-neutral-400">{{ $site->title ?? '—' }}</td>
|
|
<td class="px-4 py-2 text-right text-sm text-neutral-600 dark:text-neutral-400">{{ $site->pages_count }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="3" class="px-4 py-6 text-center text-sm text-neutral-500">No sites found.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
@auth
|
|
{{ $sites->links() }}
|
|
@else
|
|
<x-guest-preview-notice :paginator="$sites" />
|
|
@endauth
|
|
</div>
|
|
</div>
|