diff --git a/app/Livewire/Dashboard/DashboardConverter.php b/app/Livewire/Dashboard/DashboardConverter.php index 84b3915..f1f970c 100644 --- a/app/Livewire/Dashboard/DashboardConverter.php +++ b/app/Livewire/Dashboard/DashboardConverter.php @@ -4,8 +4,10 @@ use App\Actions\Conversions\CreateConversionJobAction; use App\Actions\Files\StoreUploadedFileAction; +use App\Enums\ConversionStatus; use App\Exceptions\Files\FileStorageException; use App\Exceptions\Files\UnsupportedFileFormatException; +use App\Models\ConversionJob; use App\Models\FileRecord; use App\Support\Converters\ConverterRegistry; use App\Support\Converters\DTO\ConverterTarget; @@ -309,6 +311,43 @@ private function resetTargetSelection(): void $this->optionsByTarget = []; } + public function getCurrentJobProperty(): ?ConversionJob + { + if ($this->currentConversionJobId === null) { + return null; + } + + return ConversionJob::query() + ->with(['sourceFile', 'resultFile']) + ->where('user_id', auth()->id()) + ->find($this->currentConversionJobId); + } + + public function refreshConversionStatus(): void + { + if ($this->currentConversionJobId === null) { + return; + } + + $job = ConversionJob::query() + ->where('user_id', auth()->id()) + ->find($this->currentConversionJobId); + + if (! $job) { + return; + } + + if ($job->status === ConversionStatus::Completed) { + $this->step = 'completed'; + + return; + } + + if ($job->status === ConversionStatus::Failed) { + $this->step = 'failed'; + } + } + public function getCurrentFileProperty(): ?FileRecord { return $this->currentFileId diff --git a/resources/views/livewire/dashboard/dashboard-converter.blade.php b/resources/views/livewire/dashboard/dashboard-converter.blade.php index 13661ec..2f40946 100644 --- a/resources/views/livewire/dashboard/dashboard-converter.blade.php +++ b/resources/views/livewire/dashboard/dashboard-converter.blade.php @@ -180,6 +180,25 @@ class="flex items-center justify-between gap-4 rounded-[var(--ca-radius-md)] bor @endif + @if ($step === 'converting') +
Converting your file
+ @if ($this->currentJob) ++ {{ strtoupper($this->currentJob->source_format) }} → {{ strtoupper($this->currentJob->target_format) }} +
+ @endif +Please keep this page open while we prepare your file.
+