{{-- Homepage Products Section — one card per product (Box, Pilote, Caractérisation) --}} @php // Product pages come from the navigation config (routes missing in this locale are filtered out); // copy and media are keyed by route $productCards = __('home.products_section.cards'); $productMedia = [ 'products.wasoria-box' => ['key' => 'box', 'video' => 'videos/portique.webm', 'poster' => 'images/home/portique-poster.webp'], 'products.wasoria-pilot' => ['key' => 'pilot', 'video' => 'videos/computers.webm', 'poster' => 'images/home/computers-poster.webp'], 'products.wasoria-caracterisation' => ['key' => 'caracterisation', 'video' => 'videos/segmented_wastes.webm', 'poster' => 'images/home/segmented_wastes-poster.webp'], ]; $products = collect(collect(menu_data())->firstWhere('key', 'products')['items'] ?? []) ->filter(fn ($item) => isset($productMedia[$item['route']])) ->values(); @endphp
@foreach ($products as $product) @php $media = $productMedia[$product['route']]; $card = $productCards[$media['key']]; @endphp {{-- Below the fold: nothing downloads until the card nears the viewport (initInViewVideos), then it plays only while visible --}} @endforeach