Refresh list status over Reverb with polling fallback, clarify queued vs processing, streamline upload empty states, and seed an admin login.
63 lines
1.9 KiB
PHP
63 lines
1.9 KiB
PHP
@props([
|
|
'status',
|
|
'label' => null,
|
|
/** @var string|null Alpine expression that returns a row object with badge_color + status_label (+ status for spinner) */
|
|
'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' => 'amber',
|
|
'pending' => 'zinc',
|
|
'failed' => 'red',
|
|
default => 'zinc',
|
|
};
|
|
|
|
$icon = $status === 'processing' ? 'loading' : null;
|
|
@endphp
|
|
|
|
@if ($alpineRow)
|
|
<span {{ $attributes->class('inline-flex items-center gap-1.5') }}>
|
|
@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
|
|
<flux:icon.loading
|
|
variant="micro"
|
|
class="size-3 text-amber-600 dark:text-amber-400"
|
|
x-show="{{ $alpineRow }}.status === 'processing'"
|
|
x-cloak
|
|
/>
|
|
</span>
|
|
@else
|
|
<span {{ $attributes->class('inline-flex items-center gap-1.5') }}>
|
|
<flux:badge size="sm" :color="$color" :icon="$icon">
|
|
{{ $label }}
|
|
</flux:badge>
|
|
</span>
|
|
@endif
|