fedi-feed-router/resources/views/pages/channels/show.blade.php

177 lines
9.6 KiB
PHP
Raw Normal View History

2025-07-10 12:00:50 +02:00
@extends('layouts.app')
@section('content')
<div class="max-w-4xl mx-auto py-6 sm:px-6 lg:px-8">
<div class="px-4 py-6 sm:px-0">
<!-- Header -->
<div class="flex justify-between items-center mb-6">
<div>
<h1 class="text-2xl font-semibold text-gray-900">{{ $channel->display_name ?? $channel->name }}</h1>
<p class="mt-1 text-sm text-gray-600">{{ $channel->platformInstance->name }} Channel</p>
</div>
<div class="flex items-center space-x-3">
<a href="{{ route('channels.edit', $channel) }}" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-md">
Edit Channel
</a>
<a href="{{ route('channels.index') }}" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-md">
Back to Channels
</a>
</div>
</div>
@if(session('success'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-6">
{{ session('success') }}
</div>
@endif
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Channel Status & Toggle -->
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center justify-between mb-4">
<div>
<h3 class="text-lg font-medium text-gray-900">Channel Status</h3>
<p class="text-sm text-gray-500">Enable or disable publishing to this channel</p>
</div>
@if($channel->is_active)
<div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center">
<x-heroicon-o-check-circle class="w-5 h-5 text-green-600" />
</div>
@else
<div class="w-8 h-8 bg-red-100 rounded-full flex items-center justify-center">
<x-heroicon-o-x-circle class="w-5 h-5 text-red-600" />
</div>
@endif
</div>
<div class="flex items-center justify-between">
<span class="text-lg font-medium {{ $channel->is_active ? 'text-green-600' : 'text-red-600' }}">
{{ $channel->is_active ? 'Active' : 'Inactive' }}
</span>
<form action="{{ route('channels.toggle', $channel) }}" method="POST">
@csrf
<button type="submit"
class="relative inline-flex h-6 w-11 items-center rounded-full transition-colors {{ $channel->is_active ? 'bg-green-600' : 'bg-gray-200' }}"
title="{{ $channel->is_active ? 'Click to deactivate' : 'Click to activate' }}">
<span class="inline-block h-4 w-4 transform rounded-full bg-white transition-transform {{ $channel->is_active ? 'translate-x-6' : 'translate-x-1' }}"></span>
</button>
</form>
</div>
@if(!$channel->is_active)
<div class="mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md">
<p class="text-sm text-yellow-800">
<x-heroicon-o-exclamation-triangle class="w-4 h-4 inline mr-1" />
This channel is inactive. No articles will be published here until reactivated.
</p>
</div>
@endif
</div>
</div>
<!-- Channel Details -->
<div class="lg:col-span-2 bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Channel Details</h3>
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
<div>
<dt class="text-sm font-medium text-gray-500">Channel Name</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $channel->name }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Display Name</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $channel->display_name ?? $channel->name }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Platform</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $channel->platformInstance->name }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">Channel ID</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $channel->channel_id ?? 'Not set' }}</dd>
</div>
@if($channel->language)
<div>
<dt class="text-sm font-medium text-gray-500">Language</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $channel->language->name }}</dd>
</div>
@endif
<div>
<dt class="text-sm font-medium text-gray-500">Created</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $channel->created_at->format('M j, Y') }}</dd>
</div>
</dl>
@if($channel->description)
<div class="mt-4">
<dt class="text-sm font-medium text-gray-500">Description</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $channel->description }}</dd>
</div>
@endif
</div>
</div>
</div>
<!-- Connected Feeds -->
@if($channel->feeds->count() > 0)
<div class="mt-6 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">Connected Feeds</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">Feeds that route content to this channel</p>
</div>
<ul class="divide-y divide-gray-200">
@foreach($channel->feeds as $feed)
<li class="px-4 py-4">
<div class="flex items-center justify-between">
<div class="flex items-center">
@if($feed->type === 'rss')
<x-heroicon-o-rss class="w-4 h-4 text-orange-500 mr-3" />
@else
<x-heroicon-o-globe-alt class="w-4 h-4 text-blue-500 mr-3" />
@endif
<div>
<p class="text-sm font-medium text-gray-900">{{ $feed->name }}</p>
<p class="text-sm text-gray-500">{{ $feed->url }}</p>
</div>
@if(!$feed->pivot->is_active)
<span class="ml-3 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
Route Inactive
</span>
@endif
</div>
<div class="flex items-center space-x-2">
<a href="{{ route('feeds.show', $feed) }}" class="text-indigo-600 hover:text-indigo-900 text-sm">
View Feed
</a>
<a href="{{ route('routing.edit', [$feed, $channel]) }}" class="text-indigo-600 hover:text-indigo-900 text-sm">
Edit Route
</a>
</div>
</div>
</li>
@endforeach
</ul>
</div>
@else
<div class="mt-6 bg-white shadow overflow-hidden sm:rounded-lg">
<div class="px-4 py-8 text-center">
<x-heroicon-o-arrow-path class="w-12 h-12 text-gray-400 mx-auto mb-4" />
<h3 class="text-sm font-medium text-gray-900 mb-2">No feeds connected</h3>
<p class="text-sm text-gray-500 mb-4">This channel doesn't have any feeds routing content to it yet.</p>
<a href="{{ route('routing.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm">
Create Route
</a>
</div>
</div>
@endif
</div>
</div>
@endsection