{{-- Renders one content block. Expects $block (CourseContentBlock). --}} @php $d = $block->data ?? []; @endphp @switch($block->type) @case('paragraph')
{{ data_get($d, 'text') }}
@break @case('heading') @if((int) data_get($d, 'level', 2) === 3)

{{ data_get($d, 'text') }}

@else

{{ data_get($d, 'text') }}

@endif @break @case('image')
@if(data_get($d, 'path')) {{ data_get($d, 'alt') }} @endif @if(data_get($d, 'caption'))
{{ data_get($d, 'caption') }}
@endif
@break @case('text_image') @php $tiText = trim((string) data_get($d, 'text')); @endphp @if($tiText === '') {{-- No accompanying text — just center the image like a standalone image block. --}}
@if(data_get($d, 'path')) {{ data_get($d, 'alt') }} @endif @if(data_get($d, 'caption'))
{{ data_get($d, 'caption') }}
@endif
@else
{{ $tiText }}
@if(data_get($d, 'path'))
{{ data_get($d, 'alt') }} @if(data_get($d, 'caption'))
{{ data_get($d, 'caption') }}
@endif
@endif
@endif @break @case('video') @php $yt = \App\Models\CourseContentBlock::youtubeId(data_get($d, 'youtube_url')); $isYt = data_get($d, 'source') === 'youtube' && $yt; $isUpload = data_get($d, 'source') === 'upload' && data_get($d, 'path'); $vid = 'vid-'.$block->id; @endphp
@if(data_get($d, 'title'))

{{ data_get($d, 'title') }}

@endif @if($isYt)
@elseif($isUpload) @else
videocam_off

Video not available

@endif @if(data_get($d, 'transcript'))
subtitles Transcript expand_more
{{ data_get($d, 'transcript') }}
@endif
@break @case('callout') @php $variant = data_get($d, 'variant', 'info'); $cv = [ 'info' => ['bg-primary/5 border-primary/30', 'text-primary', 'info'], 'success' => ['bg-primary/5 border-primary/30', 'text-primary', 'check_circle'], 'warning' => ['bg-gold/10 border-gold/40', 'text-[#8a6d3b]', 'warning'], 'danger' => ['bg-error-container border-error/30', 'text-error', 'report'], ][$variant] ?? ['bg-surface-container-high border-outline-variant', 'text-on-surface-variant', 'info']; @endphp
{{ $cv[2] }}

{{ data_get($d, 'text') }}

@break @case('divider')
@break @case('accordion') {{-- Wrapper carries the interaction (and its "done" badge); inner card keeps overflow-hidden for rounded corners. --}}
@foreach(data_get($d, 'items', []) as $item)
{{ data_get($item, 'title') }} expand_more
@if(data_get($item, 'image')) {{ data_get($item, 'title') }} @endif @if(data_get($item, 'body'))

{{ data_get($item, 'body') }}

@endif
@endforeach
@break @case('carousel') @php $cid = 'car-'.$block->id; $slides = collect(data_get($d, 'slides', []))->filter(fn ($s) => data_get($s, 'image') || data_get($s, 'title'))->values(); @endphp @if($slides->isNotEmpty()) @endif @break @case('flip_card')

{{ data_get($d, 'front') }}

Click to flip

{{ data_get($d, 'back') }}

@break @case('knowledge_check') @php $bid = 'kc-'.$block->id; @endphp
quiz

{{ data_get($d, 'question') }}

@foreach(data_get($d, 'options', []) as $i => $opt) @endforeach
@if(data_get($d, 'explanation')) @endif
@break @endswitch @once @endonce