@php // Pull active announcements once per request — cached for 60s so the // user dashboard hot-path isn't hammering the DB on every page hit. $rows = \Illuminate\Support\Facades\Cache::remember( 'announcements.active.v1', 60, fn() => \App\Models\Announcement::active()->get(), ); if ($rows->isEmpty()) { return; } @endphp {{-- One bar per tone: same-tone announcements chain together with separators so the colour scheme stays consistent across the strip. --}} @foreach ($rows->groupBy('tone') as $tone => $group) @php $palette = $group->first()->toneClasses(); // Stable token so localStorage dismissal can persist across reloads. $token = 'ann-' . $group->pluck('id')->join('-'); @endphp
{{-- Two copies of the content side-by-side so the CSS-animated marquee loops seamlessly when the keyframes hit -50%. --}}
@for ($pass = 0; $pass < 2; $pass++) @foreach ($group as $a) @if ($a->link_url) {{ $a->text }}@if ($a->link_label) {{ $a->link_label }} → @endif @else {{ $a->text }} @endif · @endforeach @endfor
@if ($group->contains(fn($a) => $a->dismissible)) @endif
@endforeach @once @endonce