@extends('layouts.nova')

@php
@php
    $page_title = $page_title ?? 'Community Activity';
    $page_meta_description = 'Track comments, replies, reactions, and mentions from across the Skinbase community in one live feed.';
    $page_canonical = route('community.activity', array_filter([
        'filter' => ($initialFilter ?? null) && ($initialFilter ?? 'all') !== 'all' ? $initialFilter : null,
        'user_id' => $initialUserId ?? null,
    ], fn (mixed $value): bool => $value !== null && $value !== ''));
    $useUnifiedSeo = true;
    $headerBreadcrumbs = collect([
        (object) ['name' => $page_title, 'url' => $page_canonical],
    ]);
    $breadcrumbs = $headerBreadcrumbs;
    $seo = \App\Support\Seo\SeoDataBuilder::fromArray(
        app(\App\Support\Seo\SeoFactory::class)->fromViewData(get_defined_vars())
    )->build();

    $initialFilterLabel = match (($initialFilter ?? 'all')) {
        'comments' => 'Comments',
        'replies' => 'Replies',
        'following' => 'Following',
        'my' => 'My Activity',
        default => 'All Activity',
    };
@endphp

@section('content')
<x-nova-page-header
    section="Community"
    :title="$page_title ?? 'Community Activity'"
    icon="fa-wave-square"
    :breadcrumbs="$headerBreadcrumbs"
    description="Track comments, replies, reactions, and mentions from across the Skinbase community in one live feed."
    headerClass="pb-6"
>
    <x-slot name="actions">
        <div class="flex flex-wrap items-center gap-2 text-xs font-medium">
            <span id="community-activity-filter-summary" class="inline-flex items-center gap-1.5 rounded-full border border-sky-400/20 bg-sky-500/10 px-3 py-1 text-sky-200">
                <i class="fa-solid fa-filter"></i>
                {{ $initialFilterLabel }}
            </span>
            @if (!empty($initialUserId))
                <span id="community-activity-scope-summary" class="inline-flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-white/[0.04] px-3 py-1 text-white/65">
                    <i class="fa-solid fa-user"></i>
                    User #{{ $initialUserId }}
                </span>
            @else
                <span id="community-activity-scope-summary" class="hidden"></span>
            @endif
        </div>
    </x-slot>
</x-nova-page-header>

<script id="community-activity-props" type="application/json">
    {!! json_encode($props, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) !!}
</script>

<div id="community-activity-root" class="min-h-[480px]">
    <div class="mx-auto max-w-6xl px-6 pt-8 pb-20 md:px-10">
        <div class="mb-6 rounded-[28px] border border-white/[0.06] bg-white/[0.025] p-5 shadow-[0_18px_45px_rgba(0,0,0,0.22)]">
            <div class="h-3 w-40 animate-pulse rounded bg-white/[0.08]"></div>
            <div class="mt-3 h-3 w-2/3 animate-pulse rounded bg-white/[0.06]"></div>
            <div class="mt-5 flex gap-2">
                <div class="h-10 w-28 animate-pulse rounded-full bg-white/[0.06]"></div>
                <div class="h-10 w-24 animate-pulse rounded-full bg-white/[0.05]"></div>
                <div class="h-10 w-24 animate-pulse rounded-full bg-white/[0.05]"></div>
            </div>
        </div>
    </div>
</div>

@vite(['resources/js/Pages/Community/CommunityActivityPage.jsx'])

@endsection
