fedi-feed-router/resources/views/pages/platforms/index.blade.php

103 lines
6.6 KiB
PHP
Raw Normal View History

2025-07-05 01:55:53 +02:00
@extends('layouts.app')
@section('page-title', 'Platform Accounts')
@section('content')
<div class="mb-6">
<a href="{{ route('platforms.create') }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg inline-flex items-center">
2025-07-06 01:42:39 +02:00
<x-heroicon-o-plus class="w-4 h-4 mr-2" />
2025-07-05 01:55:53 +02:00
Add Platform Account
</a>
</div>
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Platform Accounts</h2>
<p class="text-sm text-gray-600 mt-1">Manage your social media platform accounts for posting</p>
</div>
@if($accounts->isEmpty())
<div class="p-6 text-center">
2025-07-06 01:42:39 +02:00
<x-heroicon-o-share class="w-16 h-16 text-gray-400 mb-4" />
2025-07-05 01:55:53 +02:00
<h3 class="text-lg font-medium text-gray-900 mb-2">No platform accounts configured</h3>
<p class="text-gray-600 mb-4">Add your first platform account to start posting articles</p>
<a href="{{ route('platforms.create') }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg inline-flex items-center">
2025-07-06 01:42:39 +02:00
<x-heroicon-o-plus class="w-4 h-4 mr-2" />
2025-07-05 01:55:53 +02:00
Add Platform Account
</a>
</div>
@else
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Platform</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Account</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Last Tested</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($accounts as $account)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
2025-07-06 01:42:39 +02:00
<x-heroicon-o-globe-alt class="w-5 h-5 mr-3
2025-07-05 01:55:53 +02:00
{{ $account->platform === 'lemmy' ? 'text-orange-500' :
2025-07-06 01:42:39 +02:00
($account->platform === 'mastodon' ? 'text-purple-500' : 'text-red-500') }}" />
2025-07-05 01:55:53 +02:00
<span class="text-sm font-medium text-gray-900 capitalize">{{ $account->platform }}</span>
@if($account->is_active)
<span class="ml-2 inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">
Active
</span>
@endif
</div>
</td>
<td class="px-6 py-4">
<div class="text-sm text-gray-900">{{ $account->username }}</div>
<div class="text-sm text-gray-500">{{ $account->instance_url }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full
{{ $account->status === 'working' ? 'bg-green-100 text-green-800' :
($account->status === 'failed' ? 'bg-red-100 text-red-800' : 'bg-gray-100 text-gray-800') }}">
{{ ucfirst($account->status) }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $account->last_tested_at ? $account->last_tested_at->format('Y-m-d H:i') : 'Never' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<div class="flex space-x-2">
@if(!$account->is_active)
<form action="{{ route('platforms.set-active', $account) }}" method="POST" class="inline">
@csrf
<button type="submit" class="text-green-600 hover:text-green-900">
2025-07-06 01:42:39 +02:00
<x-heroicon-o-check class="w-4 h-4 mr-1" />Set Active
2025-07-05 01:55:53 +02:00
</button>
</form>
@endif
<a href="{{ route('platforms.edit', $account) }}" class="text-blue-600 hover:text-blue-900">
2025-07-06 01:42:39 +02:00
<x-heroicon-o-pencil class="w-4 h-4 mr-1" />Edit
2025-07-05 01:55:53 +02:00
</a>
<form action="{{ route('platforms.destroy', $account) }}" method="POST" class="inline"
onsubmit="return confirm('Are you sure you want to delete this platform account?')">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-900">
2025-07-06 01:42:39 +02:00
<x-heroicon-o-trash class="w-4 h-4 mr-1" />Delete
2025-07-05 01:55:53 +02:00
</button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
@endsection