@php $d = $this->getData(); $cards = $d['cards']; $maxImp = $d['maxImp']; $maxViews = $d['maxViews']; $maxClicks = $d['maxClicks']; $maxBadge = $d['maxBadge']; $maxBoost = $d['maxBoost']; $best = $d['best']; $atRiskCount = $d['atRiskCount']; $warningCount = $d['warningCount']; $tierConfig = [ 'good' => ['bg' => 'bg-emerald-50', 'border' => 'border-emerald-200', 'badge' => 'bg-emerald-100 text-emerald-700', 'ring' => '#10b981', 'track' => '#d1fae5', 'label' => 'Good'], 'warning' => ['bg' => 'bg-amber-50', 'border' => 'border-amber-200', 'badge' => 'bg-amber-100 text-amber-700', 'ring' => '#f59e0b', 'track' => '#fef3c7', 'label' => 'Review'], 'danger' => ['bg' => 'bg-rose-50', 'border' => 'border-rose-200', 'badge' => 'bg-rose-100 text-rose-700', 'ring' => '#f43f5e', 'track' => '#ffe4e6', 'label' => 'Needs Attention'], ]; @endphp Marketing Performance by Platform Health scores and per-metric breakdown. CTR and view rate drive the score. {{-- Summary Banner --}} @if (count($cards) > 0)
@if ($best)
Top performer: {{ $best['name'] }} — score {{ $best['score'] }}
@endif @if ($atRiskCount > 0)
{{ $atRiskCount }} platform{{ $atRiskCount > 1 ? 's' : '' }} need attention
@endif @if ($warningCount > 0)
{{ $warningCount }} under review
@endif
@endif {{-- Platform Cards Grid --}} @if (count($cards) === 0)

No platform data for this period

Add platforms or adjust the date range filter

@else
@foreach ($cards as $card) @php $tc = $tierConfig[$card['tier']]; $circumference = 2 * M_PI * 28; // r=28 $offset = $circumference - ($card['score'] / 100) * $circumference; $metrics = [ ['label' => 'Impressions', 'value' => number_format($card['impressions']), 'raw' => $card['impressions'], 'max' => $maxImp, 'sub' => null], ['label' => 'Profile Views', 'value' => number_format($card['profileViews']), 'raw' => $card['profileViews'], 'max' => $maxViews, 'sub' => $card['viewRate'] . '% view rate'], ['label' => 'Clicks', 'value' => number_format($card['clicks']), 'raw' => $card['clicks'], 'max' => $maxClicks, 'sub' => 'CTR ' . $card['ctr'] . '%'], ['label' => 'Badge Connect', 'value' => number_format($card['badgeConnect']), 'raw' => $card['badgeConnect'], 'max' => $maxBadge, 'sub' => null], ['label' => 'Boost Profile', 'value' => number_format($card['boostProfile']), 'raw' => $card['boostProfile'], 'max' => $maxBoost, 'sub' => null], ]; @endphp
{{-- Card Header --}}

{{ $card['name'] }}

{{ $tc['label'] }}
{{-- Score Ring --}}
{{ $card['score'] }} / 100
{{-- Metrics --}}
@foreach ($metrics as $m) @php $pct = $m['max'] > 0 ? min(100, round($m['raw'] / $m['max'] * 100)) : 0; // highlight CTR metric $isCtr = $m['label'] === 'Clicks'; $barColor = match ($card['tier']) { 'good' => 'bg-emerald-400', 'warning' => 'bg-amber-400', default => 'bg-rose-400', }; @endphp
{{ $m['label'] }}
{{ $m['value'] }} @if ($m['sub']) $isCtr && $card['ctr'] < 1, 'bg-amber-100 text-amber-600' => $isCtr && $card['ctr'] >= 1 && $card['ctr'] < 3, 'bg-emerald-100 text-emerald-600' => $isCtr && $card['ctr'] >= 3, 'bg-gray-100 text-gray-500' => !$isCtr, ])>{{ $m['sub'] }} @endif
@endforeach
{{-- Insights --}} @if (count($card['insights']) > 0)
@foreach ($card['insights'] as $insight)
{{ $insight }}
@endforeach
@else
All metrics look healthy
@endif
@endforeach
{{-- Legend --}}
Good (score ≥ 70)
Review (score 40–69)
Needs Attention (score < 40)
Progress bars = relative to best performer. CTR badge = clicks ÷ impressions.
@endif