You've already forked Atomcms-edit
Add radio embed widget, SSE real-time, song history, moderation panel, and Auto DJ
- Embed widget: standalone iframe player with dark/light/transparent themes, copy-paste embed code admin page - Real-time SSE: streaming now-playing/listeners/dj events, replaces polling in radio-player and embed - Song history: auto-records song changes to radio_song_plays table, Filament resource to view - DJ moderation: unified panel for shouts approval, song request queue, DJ applications - Auto DJ: playlist management with round-robin playback when no DJ is live - Refactored radio-player Alpine component to use EventSource API with auto-reconnect
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\RadioSongPlay\Pages;
|
||||
|
||||
use App\Filament\Resources\RadioSongPlay\RadioSongPlayResource;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageRadioSongPlays extends ManageRecords
|
||||
{
|
||||
#[\Override]
|
||||
protected static string $resource = RadioSongPlayResource::class;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\RadioSongPlay;
|
||||
|
||||
use App\Filament\Resources\RadioSongPlay\Pages\ManageRadioSongPlays;
|
||||
use App\Models\RadioSongPlay;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class RadioSongPlayResource extends Resource
|
||||
{
|
||||
#[\Override]
|
||||
protected static ?string $model = RadioSongPlay::class;
|
||||
|
||||
#[\Override]
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-musical-note';
|
||||
|
||||
#[\Override]
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Radio';
|
||||
|
||||
#[\Override]
|
||||
protected static ?string $slug = 'radio/song-plays';
|
||||
|
||||
#[\Override]
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Song Geschiedenis';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function getLabel(): string
|
||||
{
|
||||
return 'Song Play';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function getPluralLabel(): string
|
||||
{
|
||||
return 'Song Geschiedenis';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->query(RadioSongPlay::query())
|
||||
->defaultSort('played_at', 'desc')
|
||||
->columns([
|
||||
TextColumn::make('title')
|
||||
->label('Titel')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('artist')
|
||||
->label('Artiest')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('played_at')
|
||||
->label('Gespeeld op')
|
||||
->dateTime('d-m-Y H:i:s')
|
||||
->sortable(),
|
||||
TextColumn::make('duration')
|
||||
->label('Duur')
|
||||
->formatStateUsing(fn ($state) => $state ? gmdate('i:s', $state) : '-')
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('artist')
|
||||
->label('Artiest')
|
||||
->options(fn () => RadioSongPlay::distinct()->whereNotNull('artist')->pluck('artist', 'artist')->toArray())
|
||||
->searchable(),
|
||||
])
|
||||
->recordActions([
|
||||
DeleteAction::make()
|
||||
->label('Verwijderen'),
|
||||
])
|
||||
->bulkActions([
|
||||
DeleteBulkAction::make()
|
||||
->label('Selectie verwijderen'),
|
||||
])
|
||||
->poll('30s');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageRadioSongPlays::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user