@php $isAdmin = $persona === 'admin'; $isTeacher = $persona === 'teacher'; $canManage = $isAdmin || $isTeacher; $isMember = $isAdmin || $community->members()->where('users.id', auth()->id())->exists(); $hasChannels = $community->channels->isNotEmpty(); $firstChannelUuid = $community->channels->first()->uuid ?? null; $palettes = [ ['bg' => 'from-blue-500 to-cyan-400', 'border' => 'border-l-blue-500', 'text' => 'text-blue-900 dark:text-blue-100'], ['bg' => 'from-emerald-500 to-teal-400', 'border' => 'border-l-emerald-500', 'text' => 'text-emerald-900 dark:text-emerald-100'], ['bg' => 'from-amber-400 to-orange-400', 'border' => 'border-l-amber-500', 'text' => 'text-amber-900 dark:text-amber-100'], ['bg' => 'from-fuchsia-500 to-pink-400', 'border' => 'border-l-fuchsia-500', 'text' => 'text-fuchsia-900 dark:text-fuchsia-100'], ['bg' => 'from-violet-500 to-purple-400', 'border' => 'border-l-violet-500', 'text' => 'text-violet-900 dark:text-violet-100'], ['bg' => 'from-rose-500 to-red-400', 'border' => 'border-l-rose-500', 'text' => 'text-rose-900 dark:text-rose-100'], ]; @endphp
@if($community->getFirstMediaUrl('cover_image')) {{ $community->name }} @else
@endif
{{ $community->community_type }} {{ number_format($community->members_count ?? $community->members->count()) }} {{ __('Members') }}

{{ $community->name }}

@if($community->description)

{{ $community->description }}

@endif
@if($isMember && !$isAdmin)
@csrf
@elseif(!$isMember)
@csrf
@endif
@if(session('success'))
{{ session('success') }}
@endif

{{ __('Channels') }}

@forelse($community->channels as $channel) @empty
{{ __('No channels yet.') }} @if($canManage) @endif
@endforelse
@if($canManage)
{{ __('Manage') }} @if($hasChannels) @else @endif
@endif @if(!$isMember)

{{ __('Members Only') }}

{{ __('Join this community to view topics and participate in discussions.') }}

@else @if(!$hasChannels)

{{ __('No Channels Yet') }}

{{ __('Create a channel to start posting topics and discussions.') }}

@if($canManage) @endif
@else @foreach($community->channels as $channel)

# {{ $channel->name }}

@forelse($channel->topics as $topic) @php $color = $palettes[$loop->index % count($palettes)]; @endphp
{{ substr($topic->creator->name ?? '?', 0, 1) }}
{{ $topic->creator->name ?? __('Unknown') }} • {{ $topic->created_at->diffForHumans() }} @if($topic->is_pinned) PINNED @endif

{{ $topic->title }}

{{ strip_tags($topic->body) }}

{{ number_format($topic->replies_count ?? 0) }} {{ __('Replies') }}
@empty

{{ __('No topics yet') }}

{{ __('Be the first to start a discussion!') }}

@endforelse
@endforeach
@php $now = now(); $allEvents = $community->events()->orderBy('scheduled_date', 'asc')->get(); $upcomingSessions = $allEvents->filter(fn($e) => !$e->isConvertedToSession() && $e->scheduled_date >= $now); $liveSessions = $allEvents->filter(fn($e) => $e->isConvertedToSession()); $pastSessions = $allEvents->filter(fn($e) => !$e->isConvertedToSession() && $e->scheduled_date < $now); @endphp

{{ __('Community Sessions') }}

@forelse($upcomingSessions as $session)

{{ $session->title }}

{{ \Carbon\Carbon::parse($session->scheduled_date)->format('M d, Y @ h:i A') }}

@if(auth()->id() === $session->host_id || $isAdmin)
@csrf
@endif
@empty
{{ __('No upcoming sessions') }}
@endforelse
@endif @endif
@if($canManage) @if($hasChannels) @endif @endif