128 lines
6.1 KiB
PHP
128 lines
6.1 KiB
PHP
@php
|
|
use App\Support\Badges\BadgeCatalog;
|
|
use App\Support\Badges\BadgeDomain;
|
|
|
|
$resolvedState = isset($getState) ? $getState() : ($artifactTruthState ?? ($state ?? null));
|
|
$state = is_array($resolvedState) ? $resolvedState : [];
|
|
$dimensions = collect(is_array($state['dimensions'] ?? null) ? $state['dimensions'] : []);
|
|
|
|
$primary = $dimensions->first(fn (mixed $dimension): bool => is_array($dimension) && ($dimension['classification'] ?? null) === 'primary');
|
|
$existence = $dimensions->first(fn (mixed $dimension): bool => is_array($dimension) && ($dimension['axis'] ?? null) === 'artifact_existence');
|
|
$freshness = $dimensions->first(fn (mixed $dimension): bool => is_array($dimension) && ($dimension['axis'] ?? null) === 'data_freshness');
|
|
$publication = $dimensions->first(fn (mixed $dimension): bool => is_array($dimension) && ($dimension['axis'] ?? null) === 'publication_readiness');
|
|
$actionability = $dimensions->first(fn (mixed $dimension): bool => is_array($dimension) && ($dimension['axis'] ?? null) === 'operator_actionability');
|
|
|
|
$specFor = static function (mixed $dimension): ?\App\Support\Badges\BadgeSpec {
|
|
if (! is_array($dimension)) {
|
|
return null;
|
|
}
|
|
|
|
if (! is_string($dimension['badgeDomain'] ?? null) || ! is_string($dimension['badgeState'] ?? null)) {
|
|
return null;
|
|
}
|
|
|
|
return BadgeCatalog::spec(BadgeDomain::from($dimension['badgeDomain']), $dimension['badgeState']);
|
|
};
|
|
|
|
$primarySpec = $specFor($primary);
|
|
$existenceSpec = $specFor($existence);
|
|
$freshnessSpec = $specFor($freshness);
|
|
$publicationSpec = $specFor($publication);
|
|
$actionabilitySpec = $specFor($actionability);
|
|
$reason = is_array($state['reason'] ?? null) ? $state['reason'] : [];
|
|
$nextSteps = is_array($reason['nextSteps'] ?? null) ? $reason['nextSteps'] : [];
|
|
@endphp
|
|
|
|
<div class="space-y-4">
|
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900">
|
|
<div class="flex flex-wrap items-start gap-2">
|
|
@if ($primarySpec)
|
|
<x-filament::badge :color="$primarySpec->color" :icon="$primarySpec->icon" size="sm">
|
|
{{ $primarySpec->label }}
|
|
</x-filament::badge>
|
|
@endif
|
|
|
|
@if ($actionabilitySpec)
|
|
<x-filament::badge :color="$actionabilitySpec->color" :icon="$actionabilitySpec->icon" size="sm">
|
|
{{ $actionabilitySpec->label }}
|
|
</x-filament::badge>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="mt-3 space-y-2">
|
|
<div class="text-sm font-medium text-gray-950 dark:text-gray-100">
|
|
{{ $state['primaryLabel'] ?? 'Artifact truth' }}
|
|
</div>
|
|
|
|
@if (is_string($state['primaryExplanation'] ?? null) && trim($state['primaryExplanation']) !== '')
|
|
<p class="text-sm text-gray-600 dark:text-gray-300">
|
|
{{ $state['primaryExplanation'] }}
|
|
</p>
|
|
@endif
|
|
|
|
@if (is_string($state['diagnosticLabel'] ?? null) && trim($state['diagnosticLabel']) !== '')
|
|
<p class="text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400">
|
|
Diagnostic: {{ $state['diagnosticLabel'] }}
|
|
</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
<dl class="grid gap-3 sm:grid-cols-2 xl:grid-cols-4">
|
|
@if ($existenceSpec)
|
|
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800 dark:bg-gray-950/60">
|
|
<dt class="text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Artifact exists</dt>
|
|
<dd class="mt-1">
|
|
<x-filament::badge :color="$existenceSpec->color" :icon="$existenceSpec->icon" size="sm">
|
|
{{ $existenceSpec->label }}
|
|
</x-filament::badge>
|
|
</dd>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($freshnessSpec)
|
|
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800 dark:bg-gray-950/60">
|
|
<dt class="text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Freshness</dt>
|
|
<dd class="mt-1">
|
|
<x-filament::badge :color="$freshnessSpec->color" :icon="$freshnessSpec->icon" size="sm">
|
|
{{ $freshnessSpec->label }}
|
|
</x-filament::badge>
|
|
</dd>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($publicationSpec)
|
|
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800 dark:bg-gray-950/60">
|
|
<dt class="text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Publication</dt>
|
|
<dd class="mt-1">
|
|
<x-filament::badge :color="$publicationSpec->color" :icon="$publicationSpec->icon" size="sm">
|
|
{{ $publicationSpec->label }}
|
|
</x-filament::badge>
|
|
</dd>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800 dark:bg-gray-950/60">
|
|
<dt class="text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Next step</dt>
|
|
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">
|
|
{{ $state['nextActionLabel'] ?? 'No action needed' }}
|
|
</dd>
|
|
</div>
|
|
</dl>
|
|
|
|
@if ($nextSteps !== [])
|
|
<div class="space-y-2">
|
|
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Guidance</div>
|
|
<ul class="space-y-1 text-sm text-gray-700 dark:text-gray-300">
|
|
@foreach ($nextSteps as $step)
|
|
@continue(! is_string($step) || trim($step) === '')
|
|
|
|
<li class="rounded-md border border-primary-100 bg-primary-50 px-3 py-2 dark:border-primary-900/40 dark:bg-primary-950/30">
|
|
{{ $step }}
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
</div>
|