@extends('news.layout', [
    'metaTitle' => $typeLabel . ' — News',
    'metaDescription' => 'News articles of type ' . $typeLabel . '.',
    'metaCanonical' => route('news.type', $type),
])

@section('news_content')
@php
    $headerBreadcrumbs = collect([
        (object) ['name' => 'Community', 'url' => route('community.activity')],
        (object) ['name' => 'Announcements', 'url' => route('news.index')],
        (object) ['name' => $typeLabel, 'url' => route('news.type', $type)],
    ]);

    $seo = \App\Support\Seo\SeoDataBuilder::fromArray([
        'title' => $typeLabel . ' — News',
        'description' => 'Browse all news articles of type ' . $typeLabel . '.',
        'canonical' => route('news.type', $type),
        'breadcrumbs' => $headerBreadcrumbs,
        'structured_data' => [
            [
                '@context' => 'https://schema.org',
                '@type' => 'CollectionPage',
                'name' => $typeLabel . ' — News',
                'description' => 'Browse all news articles of type ' . $typeLabel . '.',
                'url' => route('news.type', $type),
            ],
        ],
    ])->build();
@endphp

<x-nova-page-header
    section="Community"
    :title="$typeLabel"
    icon="fa-newspaper"
    :breadcrumbs="$headerBreadcrumbs"
    :description="'Browse all ' . $typeLabel . ' articles.'"
    headerClass="pb-6"
    innerClass="mx-auto max-w-7xl"
/>

<div class="mx-auto max-w-7xl px-6 pt-8 pb-16 md:px-10">
    <div class="grid gap-8 xl:grid-cols-[minmax(0,1fr)_320px]">
        <section>
            @if($articles->isEmpty())
                <div class="rounded-[28px] border border-white/[0.06] bg-white/[0.025] px-8 py-14 text-center text-white/45">No {{ $typeLabel }} articles have been published yet.</div>
            @else
                <div class="grid gap-5 md:grid-cols-2">
                    @foreach($articles as $article)
                        @include('news._article_card', ['article' => $article])
                    @endforeach
                </div>
                <div class="mt-8 flex justify-center">{{ $articles->links() }}</div>
            @endif
        </section>
        <aside class="space-y-4">
            @include('news._sidebar', ['categories' => $categories, 'trending' => $trending, 'tags' => $tags])
        </aside>
    </div>
</div>
@endsection
