@props(['video' => null, 'size' => 'medium']) @php use App\Data\Languages; // When a specific audio track is being surfaced (e.g. via the language // filter chips), the hover-preview should play that language, not the // primary. audio-track route serves the track file directly. $forceTrackIdEarly = $video ? $video->getAttribute('_force_track_id') : null; $videoUrl = $video ? ($forceTrackIdEarly ? route('videos.audio-track', ['video' => $video, 'track' => $forceTrackIdEarly]) : route('videos.stream', $video)) : null; $thumbnailUrl = $video && $video->thumbnail ? route('media.thumbnail', $video->thumbnail) : ($video ? 'https://picsum.photos/seed/' . $video->id . '/640/360' : 'https://picsum.photos/seed/random/640/360'); $typeIcon = $video ? match($video->type) { 'music' => 'bi-music-note', 'match' => 'bi-trophy', default => 'bi-film', } : 'bi-film'; // Check if video is shorts $isShorts = $video && $video->isShorts(); // Check if current user is the owner of the video $isOwner = $video && auth()->check() && auth()->id() == $video->user_id; // When surfacing a video via a secondary audio track (e.g. from the // language filter chips) the controller tags it with these runtime // attributes so the card links straight to that track and badges the // thumbnail with its flag. $forceTrackId = $video ? $video->getAttribute('_force_track_id') : null; $forceTrackFlag = $video ? $video->getAttribute('_force_track_flag') : null; // Language flag code (null when no language set). Prefer the forced // track flag when set — it's the language the card is being surfaced for. $langFlag = $forceTrackFlag ?: ($video ? Languages::flag($video->language) : null); $showUrl = $video ? route('videos.show', $video) . ($forceTrackId ? ('?track=' . $forceTrackId) : '') : '#'; // Size classes $sizeClasses = match($size) { 'small' => 'yt-video-card-sm', default => '', }; @endphp