@props([ 'diff' => null, 'compact' => false, ]) @php $changes = collect(data_get($diff, 'changes', []))->values()->all(); $count = count($changes); $requiresBuild = collect($changes)->contains(fn ($change) => data_get($change, 'impact') === 'build'); @endphp @if ($count > 0)
$compact, 'text-sm' => ! $compact, ])>
{{ $count }} configuration {{ $count === 1 ? 'change' : 'changes' }} $requiresBuild, 'bg-blue-100 text-blue-700 dark:bg-blue-500/20 dark:text-blue-300' => ! $requiresBuild, ])> {{ $requiresBuild ? 'Rebuild required' : 'Redeploy required' }}
@unless ($compact)
@foreach (collect($changes)->groupBy('section_label') as $sectionLabel => $sectionChanges)
{{ $sectionLabel }}
Field
From
To
@foreach ($sectionChanges as $change) @php $changeKey = (string) data_get($change, 'key'); $expandable = data_get($change, 'expandable', false); $oldDisplay = (string) data_get($change, 'old_display_value'); $newDisplay = (string) data_get($change, 'new_display_value'); $oldFull = data_get($change, 'old_full_value') ?? $oldDisplay; $newFull = data_get($change, 'new_full_value') ?? $newDisplay; $label = (string) data_get($change, 'label'); $labelTruncated = mb_strlen($label) > 20; $rowExpandable = $expandable || $labelTruncated; @endphp
@if ($rowExpandable)
@else {{ $label }} @endif
@if ($expandable)
@else
{{ $oldDisplay }}
@endif
@if ($expandable)
@else
{{ $newDisplay }}
@endif
@if ($rowExpandable) @endif
@endforeach
@endforeach
@endunless
@endif