{{-- Insights listing (PRD ยง16.2) with category/tag filters, empty state and Load more. --}} @php $categorySlug = isset($activeCategory) ? $activeCategory->slug : (request()->string('category')->value() ?: null); $active = array_filter(['category' => $categorySlug, 'tag' => request()->string('tag')->value() ?: null]); $matches = fn ($article): bool => (! isset($active['category']) || $article->category?->slug === $active['category']) && (! isset($active['tag']) || $article->topics->contains('slug', $active['tag'])); $articles = $vm->resolved('articles', []); $visibleCount = count(array_filter($articles, $matches)); $groups = [ 'category' => ['label' => __('portfolio.ui.filter_category'), 'options' => collect($vm->resolved('categories', []))->pluck('name', 'slug')->all()], 'tag' => ['label' => __('portfolio.ui.filter_topic'), 'options' => collect($vm->resolved('topics', []))->pluck('name', 'slug')->all()], ]; @endphp
@if ($vm->get('show_filters', true) && $articles !== []) @include('partials.listing-filters', ['groups' => $groups, 'active' => $active, 'baseUrl' => route('insights.index')]) @endif

@foreach ($articles as $article) @endforeach
@if ($articles !== []) {{ __('portfolio.ui.clear_filters') }} @endif