Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions resources/views/livewire/dashboard/dashboard-converter.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,28 @@
@endif

@if ($step === 'format' && $this->currentFile)
@php($file = $this->currentFile)
<div class="flex flex-col gap-4">
<div class="flex items-center justify-between gap-4">
<p class="text-base font-semibold text-[var(--ca-text)]">{{ $this->currentFile->original_name }}</p>
<div class="flex items-center justify-between gap-4 rounded-[var(--ca-radius-md)] border border-[var(--ca-border)] bg-white p-4">
<div class="flex items-center gap-3">
<x-file-icon :format="$file->extension" />
<div class="flex flex-col">
<p class="text-sm font-semibold text-[var(--ca-text)]">{{ $file->original_name }}</p>
<p class="text-xs text-[var(--ca-muted)]">
{{ strtoupper($file->extension) }} ·
{{ number_format($file->size_bytes / 1024, 1) }} KB
@php($meta = $file->metadata_json ?? [])
@if (isset($meta['width'], $meta['height']))
· {{ $meta['width'] }}×{{ $meta['height'] }}
@endif
</p>
</div>
</div>

<div class="flex items-center gap-2">
<x-button variant="secondary" size="sm" wire:click="replaceFile">Replace</x-button>
<x-button variant="ghost" size="sm" wire:click="removeFile">Remove</x-button>
</div>
</div>

<div class="rounded-[var(--ca-radius-md)] border border-dashed border-[var(--ca-border)] bg-[var(--ca-surface-muted)]/40 px-6 py-8 text-center">
Expand Down
15 changes: 15 additions & 0 deletions tests/Feature/Livewire/DashboardConverterUploadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@

expect(FileRecord::query()->where('original_name', 'sample.png')->exists())->toBeTrue();
});

it('shows uploaded file summary after upload', function () {
Storage::fake('local');

$user = User::factory()->create();

Livewire::actingAs($user)
->test(DashboardConverter::class)
->set('upload', UploadedFile::fake()->image('avatar.jpg', 800, 600))
->call('storeUpload')
->assertSee('avatar.jpg')
->assertSee('JPG')
->assertSee('Replace')
->assertSee('Remove');
});