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

154 lines
No EOL
10 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
<div class="px-4 py-6 sm:px-0">
<div class="flex justify-between items-center mb-6">
<div>
<h1 class="text-2xl font-semibold text-gray-900">Feed Routing</h1>
<p class="mt-1 text-sm text-gray-600">Manage how feeds are routed to channels</p>
</div>
<a href="{{ route('routing.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Create New Routing
</a>
</div>
@if(session('success'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4">
{{ session('success') }}
</div>
@endif
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Feeds Section -->
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
<div class="px-4 py-5 sm:px-6 border-b border-gray-200">
<h3 class="text-lg leading-6 font-medium text-gray-900">Feeds Channels</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">Active feed-to-channel routing</p>
</div>
<div class="divide-y divide-gray-200">
@forelse($feeds as $feed)
@if($feed->channels->count() > 0)
<div class="px-4 py-4">
<div class="flex items-center mb-3">
@if($feed->type === 'rss')
<x-heroicon-o-rss class="w-4 h-4 text-orange-500 mr-2" />
@else
<x-heroicon-o-globe-alt class="w-4 h-4 text-blue-500 mr-2" />
@endif
<span class="font-medium text-gray-900">{{ $feed->name }}</span>
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">
{{ $feed->channels->count() }} channel{{ $feed->channels->count() !== 1 ? 's' : '' }}
</span>
</div>
<div class="space-y-2">
@foreach($feed->channels as $channel)
<div class="flex items-center justify-between bg-gray-50 rounded px-3 py-2">
<div class="flex items-center">
<x-heroicon-o-hashtag class="w-4 h-4 text-gray-400 mr-2" />
<span class="text-sm text-gray-900">{{ $channel->name }}</span>
<span class="ml-2 text-xs text-gray-500">({{ $channel->platformInstance->name }})</span>
@if(!$channel->pivot->is_active)
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
Inactive
</span>
@endif
@if($channel->pivot->priority > 0)
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
Priority: {{ $channel->pivot->priority }}
</span>
@endif
</div>
<div class="flex items-center space-x-2">
<form action="{{ route('routing.toggle', [$feed, $channel]) }}" method="POST" class="inline">
@csrf
<label class="inline-flex items-center cursor-pointer">
<span class="text-xs text-gray-600 mr-2">{{ $channel->pivot->is_active ? 'Active' : 'Inactive' }}</span>
<button type="submit" class="relative inline-flex h-6 w-11 items-center rounded-full transition-colors {{ $channel->pivot->is_active ? 'bg-green-600' : 'bg-gray-200' }}">
<span class="inline-block h-4 w-4 transform rounded-full bg-white transition-transform {{ $channel->pivot->is_active ? 'translate-x-6' : 'translate-x-1' }}"></span>
</button>
</label>
</form>
<a href="{{ route('routing.edit', [$feed, $channel]) }}" class="text-indigo-600 hover:text-indigo-900 text-xs">Edit</a>
<form action="{{ route('routing.destroy', [$feed, $channel]) }}" method="POST" class="inline"
onsubmit="return confirm('Remove this routing?')">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-900 text-xs">Remove</button>
</form>
</div>
</div>
@endforeach
</div>
</div>
@endif
@empty
<div class="px-4 py-8 text-center text-gray-500">
No feed routing configured
</div>
@endforelse
</div>
</div>
<!-- Channels Section -->
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
<div class="px-4 py-5 sm:px-6 border-b border-gray-200">
<h3 class="text-lg leading-6 font-medium text-gray-900">Channels Feeds</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">Channels and their connected feeds</p>
</div>
<div class="divide-y divide-gray-200">
@forelse($channels as $channel)
@if($channel->feeds->count() > 0)
<div class="px-4 py-4">
<div class="flex items-center mb-3">
<x-heroicon-o-hashtag class="w-4 h-4 text-gray-400 mr-2" />
<span class="font-medium text-gray-900">{{ $channel->name }}</span>
<span class="ml-2 text-xs text-gray-500">({{ $channel->platformInstance->name }})</span>
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">
{{ $channel->feeds->count() }} feed{{ $channel->feeds->count() !== 1 ? 's' : '' }}
</span>
</div>
<div class="space-y-1">
@foreach($channel->feeds as $feed)
<div class="flex items-center justify-between bg-gray-50 rounded px-3 py-2">
<div class="flex items-center">
@if($feed->type === 'rss')
<x-heroicon-o-rss class="w-4 h-4 text-orange-500 mr-2" />
@else
<x-heroicon-o-globe-alt class="w-4 h-4 text-blue-500 mr-2" />
@endif
<span class="text-sm text-gray-900">{{ $feed->name }}</span>
@if(!$feed->pivot->is_active)
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
Inactive
</span>
@endif
</div>
<a href="{{ route('routing.edit', [$feed, $channel]) }}" class="text-indigo-600 hover:text-indigo-900 text-xs">Edit</a>
</div>
@endforeach
</div>
</div>
@endif
@empty
<div class="px-4 py-8 text-center text-gray-500">
No channels with feeds
</div>
@endforelse
</div>
</div>
</div>
@if($feeds->where('channels')->isEmpty() && $channels->where('feeds')->isEmpty())
<div class="text-center py-12">
<x-heroicon-o-arrow-path class="w-24 h-24 text-gray-400 mb-4" />
<h3 class="text-lg font-medium text-gray-900 mb-2">No routing configured</h3>
<p class="text-gray-500 mb-4">Connect your feeds to channels to start routing content.</p>
<a href="{{ route('routing.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Create First Routing
</a>
</div>
@endif
</div>
</div>
@endsection