## Summary - add a shared diff presentation layer under `app/Support/Diff` with deterministic row classification, summary derivation, and value stringification - centralize diff-state badge semantics through `BadgeCatalog` with a dedicated `DiffRowStatusBadge` - add reusable Filament diff partials, focused Pest coverage, and the full SpecKit artifact set for spec 141 ## Testing - `vendor/bin/sail artisan test --compact tests/Unit/Support/Diff/DiffRowStatusTest.php tests/Unit/Support/Diff/DiffRowTest.php tests/Unit/Support/Diff/DiffPresenterTest.php tests/Unit/Support/Diff/ValueStringifierTest.php tests/Unit/Badges/DiffRowStatusBadgeTest.php tests/Feature/Support/Diff/SharedDiffSummaryPartialTest.php tests/Feature/Support/Diff/SharedDiffRowPartialTest.php tests/Feature/Support/Diff/SharedInlineListDiffPartialTest.php` - `vendor/bin/sail bin pint --dirty --format agent` ## Filament / Livewire Contract - Livewire v4.0+ compliance: unchanged and respected; this feature adds presentation support only within the existing Filament v5 / Livewire v4 stack - Provider registration: unchanged; no panel/provider changes were required, so `bootstrap/providers.php` remains the correct registration location - Global search: unchanged; no Resource or global-search behavior was added or modified - Destructive actions: none introduced in this feature - Asset strategy: no new registered Filament assets; shared Blade partials rely on the existing asset pipeline and standard deploy step for `php artisan filament:assets` when assets change generally - Testing coverage: presenter, DTOs, stringifier, badge semantics, summary partial, row partial, and inline-list partial are covered by focused Pest unit and feature tests ## Notes - Spec checklist status is complete for `specs/141-shared-diff-presentation-foundation/checklists/requirements.md` - This PR preserves specialized diff renderers and documents incremental adoption rather than forcing migration in the same change Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #170
50 lines
2.1 KiB
PHP
50 lines
2.1 KiB
PHP
@php
|
|
use App\Support\Diff\ValueStringifier;
|
|
|
|
$stringifier = app(ValueStringifier::class);
|
|
$labelClasses = 'text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400';
|
|
$mutedTextClasses = $dimUnchanged ? 'text-gray-500 dark:text-gray-400' : 'text-gray-900 dark:text-gray-100';
|
|
$itemPadding = $compact ? 'px-2 py-1 text-xs' : 'px-2.5 py-1 text-sm';
|
|
@endphp
|
|
|
|
<div class="space-y-3" aria-label="{{ $row->label }} list diff">
|
|
@if ($row->addedItems !== [])
|
|
<div class="space-y-2">
|
|
<div class="{{ $labelClasses }}">Added items</div>
|
|
<ul aria-label="Added items" class="flex flex-wrap gap-2">
|
|
@foreach ($row->addedItems as $item)
|
|
<li class="rounded-full bg-success-100 {{ $itemPadding }} text-success-800 dark:bg-success-500/20 dark:text-success-100">
|
|
{{ $stringifier->stringify($item) }}
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($row->removedItems !== [])
|
|
<div class="space-y-2">
|
|
<div class="{{ $labelClasses }}">Removed items</div>
|
|
<ul aria-label="Removed items" class="flex flex-wrap gap-2">
|
|
@foreach ($row->removedItems as $item)
|
|
<li class="rounded-full bg-danger-100 {{ $itemPadding }} text-danger-800 dark:bg-danger-500/20 dark:text-danger-100">
|
|
{{ $stringifier->stringify($item) }}
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($row->unchangedItems !== [])
|
|
<div class="space-y-2">
|
|
<div class="{{ $labelClasses }}">Unchanged items</div>
|
|
<ul aria-label="Unchanged items" class="flex flex-wrap gap-2">
|
|
@foreach ($row->unchangedItems as $item)
|
|
<li class="rounded-full bg-gray-100 {{ $itemPadding }} {{ $mutedTextClasses }} dark:bg-white/5">
|
|
{{ $stringifier->stringify($item) }}
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
</div>
|