@extends('front.layouts.app')
@section('content')
    <main class="container">

        @include('front.partials.breadcrumbs')

        <div class="row g-5">
            <div class="col-md-8">
                <h1 class="pb-2 fw-normal h2">
                    @if (isset($category) && !is_null($category))
                        {{ $category->name }} News from EchoScoop
                    @else
                        Latest News from EchoScoop
                    @endif
                </h1>
                @if ($posts->count() > 0)
                    @foreach ($posts as $post)
                        @include('front.partials.post_detail', ['post' => $post])
                    @endforeach
                    @if ($posts instanceof \Illuminate\Pagination\Paginator)
                        <div class="flex justify-center">
                            {{ $posts->links('pagination::simple-bootstrap-5-rounded') }}
                        </div>
                    @endif
                @else
                    <div class="py-3 text-center">
                        <div class="mb-2">No posts found yet.</div>
                        <div><a href="{{ route('front.home') }}">Back to Home</a></div>
                    </div>
                @endif
            </div>

            <div class="col-md-4">
                <div class="position-sticky" style="top: 2rem;">
                    @include('front.partials.about')
                </div>
            </div>
        </div>
    </main>
@endsection

@push('top_head')
    {!! $breadcrumb_context !!}
@endpush
