fedi-feed-router/resources/views/livewire/articles.blade.php

84 lines
4.8 KiB
PHP
Raw Normal View History

<div class="p-6">
<div class="mb-8 flex items-start justify-between">
<div>
<h1 class="text-2xl font-bold text-gray-900">Articles</h1>
<p class="mt-1 text-sm text-gray-500">
Articles fetched from your feeds
</p>
</div>
<button
wire:click="refresh"
wire:loading.attr="disabled"
@disabled($isRefreshing)
x-on:refresh-started.window="setTimeout(() => window.location.reload(), 10000)"
class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
>
<svg class="h-4 w-4 mr-2 {{ $isRefreshing ? 'animate-spin' : '' }}" wire:loading.class="animate-spin" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" />
</svg>
<span wire:loading.remove wire:target="refresh">{{ $isRefreshing ? 'Refreshing...' : 'Refresh' }}</span>
<span wire:loading wire:target="refresh">Refreshing...</span>
</button>
</div>
<div class="space-y-6">
@forelse ($articles as $article)
<div class="bg-white rounded-lg shadow p-6" wire:key="article-{{ $article->id }}">
<div class="flex items-start justify-between">
<div class="flex-1 min-w-0">
<h3 class="text-lg font-medium text-gray-900 mb-2">
{{ $article->title ?? 'Untitled Article' }}
</h3>
<p class="text-sm text-gray-600 mb-3 line-clamp-2">
{{ $article->description ?? 'No description available' }}
</p>
<div class="flex items-center space-x-4 text-xs text-gray-500">
<span>Feed: {{ $article->feed?->name ?? 'Unknown' }}</span>
<span>&bull;</span>
<span>{{ $article->created_at->format('M d, Y H:i') }}</span>
@if ($article->validated_at)
<span>&bull;</span>
<span class="text-green-600">Validated</span>
@else
<span>&bull;</span>
<span class="text-yellow-600">Not validated</span>
@endif
</div>
</div>
<div class="flex items-center space-x-3 ml-4">
@if ($article->url)
<a
href="{{ $article->url }}"
target="_blank"
rel="noopener noreferrer"
class="p-2 text-gray-400 hover:text-gray-600 rounded-md"
title="View original article"
>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" />
</svg>
</a>
@endif
</div>
</div>
</div>
@empty
<div class="text-center py-12">
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">No articles</h3>
<p class="mt-1 text-sm text-gray-500">
No articles have been fetched yet.
</p>
</div>
@endforelse
@if ($articles->hasPages())
<div class="mt-6">
{{ $articles->links() }}
</div>
@endif
</div>
</div>