Release v1.3.0 #100
2 changed files with 10 additions and 101 deletions
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
use App\Jobs\ArticleDiscoveryJob;
|
use App\Jobs\ArticleDiscoveryJob;
|
||||||
use App\Models\Article;
|
use App\Models\Article;
|
||||||
use App\Models\Setting;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
|
@ -14,22 +13,6 @@ class Articles extends Component
|
||||||
|
|
||||||
public bool $isRefreshing = false;
|
public bool $isRefreshing = false;
|
||||||
|
|
||||||
public function approve(int $articleId): void
|
|
||||||
{
|
|
||||||
$article = Article::findOrFail($articleId);
|
|
||||||
$article->approve();
|
|
||||||
|
|
||||||
$this->dispatch('article-updated');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reject(int $articleId): void
|
|
||||||
{
|
|
||||||
$article = Article::findOrFail($articleId);
|
|
||||||
$article->reject();
|
|
||||||
|
|
||||||
$this->dispatch('article-updated');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function refresh(): void
|
public function refresh(): void
|
||||||
{
|
{
|
||||||
$this->isRefreshing = true;
|
$this->isRefreshing = true;
|
||||||
|
|
@ -41,15 +24,12 @@ public function refresh(): void
|
||||||
|
|
||||||
public function render(): \Illuminate\Contracts\View\View
|
public function render(): \Illuminate\Contracts\View\View
|
||||||
{
|
{
|
||||||
$articles = Article::with(['feed', 'articlePublication'])
|
$articles = Article::with('feed')
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->paginate(15);
|
->paginate(15);
|
||||||
|
|
||||||
$approvalsEnabled = Setting::isPublishingApprovalsEnabled();
|
|
||||||
|
|
||||||
return view('livewire.articles', [
|
return view('livewire.articles', [
|
||||||
'articles' => $articles,
|
'articles' => $articles,
|
||||||
'approvalsEnabled' => $approvalsEnabled,
|
|
||||||
])->layout('layouts.app');
|
])->layout('layouts.app');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,8 @@
|
||||||
<div>
|
<div>
|
||||||
<h1 class="text-2xl font-bold text-gray-900">Articles</h1>
|
<h1 class="text-2xl font-bold text-gray-900">Articles</h1>
|
||||||
<p class="mt-1 text-sm text-gray-500">
|
<p class="mt-1 text-sm text-gray-500">
|
||||||
Manage and review articles from your feeds
|
Articles fetched from your feeds
|
||||||
</p>
|
</p>
|
||||||
@if ($approvalsEnabled)
|
|
||||||
<div class="mt-2 inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
|
||||||
<svg class="h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z" />
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 6h.008v.008H6V6Z" />
|
|
||||||
</svg>
|
|
||||||
Approval system enabled
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
wire:click="refresh"
|
wire:click="refresh"
|
||||||
|
|
@ -44,54 +35,17 @@ class="inline-flex items-center px-4 py-2 border border-transparent text-sm font
|
||||||
<div class="flex items-center space-x-4 text-xs text-gray-500">
|
<div class="flex items-center space-x-4 text-xs text-gray-500">
|
||||||
<span>Feed: {{ $article->feed?->name ?? 'Unknown' }}</span>
|
<span>Feed: {{ $article->feed?->name ?? 'Unknown' }}</span>
|
||||||
<span>•</span>
|
<span>•</span>
|
||||||
<span>{{ $article->created_at->format('M d, Y') }}</span>
|
<span>{{ $article->created_at->format('M d, Y H:i') }}</span>
|
||||||
|
@if ($article->validated_at)
|
||||||
|
<span>•</span>
|
||||||
|
<span class="text-green-600">Validated</span>
|
||||||
|
@else
|
||||||
|
<span>•</span>
|
||||||
|
<span class="text-yellow-600">Not validated</span>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-3 ml-4">
|
<div class="flex items-center space-x-3 ml-4">
|
||||||
@if ($article->is_published)
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
|
||||||
<svg class="h-3 w-3 mr-1" 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>
|
|
||||||
Published
|
|
||||||
</span>
|
|
||||||
@elseif ($article->publish_status === 'error')
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-orange-100 text-orange-800">
|
|
||||||
<svg class="h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z" />
|
|
||||||
</svg>
|
|
||||||
Publish Error
|
|
||||||
</span>
|
|
||||||
@elseif ($article->publish_status === 'publishing')
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-800">
|
|
||||||
<svg class="h-3 w-3 mr-1 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>
|
|
||||||
Publishing...
|
|
||||||
</span>
|
|
||||||
@elseif ($article->approval_status === 'approved')
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
||||||
<svg class="h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
||||||
</svg>
|
|
||||||
Approved
|
|
||||||
</span>
|
|
||||||
@elseif ($article->approval_status === 'rejected')
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
|
||||||
<svg class="h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
||||||
</svg>
|
|
||||||
Rejected
|
|
||||||
</span>
|
|
||||||
@else
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
|
|
||||||
<svg class="h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
||||||
</svg>
|
|
||||||
Pending
|
|
||||||
</span>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ($article->url)
|
@if ($article->url)
|
||||||
<a
|
<a
|
||||||
href="{{ $article->url }}"
|
href="{{ $article->url }}"
|
||||||
|
|
@ -107,31 +61,6 @@ class="p-2 text-gray-400 hover:text-gray-600 rounded-md"
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($article->approval_status === 'pending' && $approvalsEnabled)
|
|
||||||
<div class="mt-4 flex space-x-3">
|
|
||||||
<button
|
|
||||||
wire:click="approve({{ $article->id }})"
|
|
||||||
wire:loading.attr="disabled"
|
|
||||||
class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50"
|
|
||||||
>
|
|
||||||
<svg class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
||||||
</svg>
|
|
||||||
Approve
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
wire:click="reject({{ $article->id }})"
|
|
||||||
wire:loading.attr="disabled"
|
|
||||||
class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:opacity-50"
|
|
||||||
>
|
|
||||||
<svg class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
||||||
</svg>
|
|
||||||
Reject
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
@empty
|
@empty
|
||||||
<div class="text-center py-12">
|
<div class="text-center py-12">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue