Replace controller-driven Blade views with full-page Livewire index/show/create flows so Flux tables, toasts, and uploads work natively.
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
@props([
|
|
'status',
|
|
'label' => null,
|
|
/** @var string|null Alpine expression that returns a row object with badge_color + status_label */
|
|
'alpineRow' => null,
|
|
])
|
|
|
|
@php
|
|
$label ??= match ($status) {
|
|
'pending' => 'Queued',
|
|
'processing' => 'Transcribing',
|
|
'done' => 'Done',
|
|
'failed' => 'Failed',
|
|
'cancelled' => 'Cancelled',
|
|
default => (string) $status,
|
|
};
|
|
|
|
$color = match ($status) {
|
|
'done' => 'teal',
|
|
'processing', 'pending' => 'amber',
|
|
'failed' => 'red',
|
|
default => 'zinc',
|
|
};
|
|
@endphp
|
|
|
|
@if ($alpineRow)
|
|
<span {{ $attributes->class('inline-flex') }}>
|
|
@foreach (['teal', 'amber', 'red', 'zinc'] as $badgeColor)
|
|
@if ($badgeColor === $color)
|
|
<flux:badge
|
|
size="sm"
|
|
:color="$badgeColor"
|
|
x-show="{{ $alpineRow }}.badge_color === '{{ $badgeColor }}'"
|
|
x-text="{{ $alpineRow }}.status_label"
|
|
>{{ $label }}</flux:badge>
|
|
@else
|
|
<flux:badge
|
|
size="sm"
|
|
:color="$badgeColor"
|
|
x-show="{{ $alpineRow }}.badge_color === '{{ $badgeColor }}'"
|
|
x-cloak
|
|
x-text="{{ $alpineRow }}.status_label"
|
|
>{{ $label }}</flux:badge>
|
|
@endif
|
|
@endforeach
|
|
</span>
|
|
@else
|
|
<flux:badge size="sm" :color="$color" {{ $attributes }}>
|
|
{{ $label }}
|
|
</flux:badge>
|
|
@endif
|