@blaze @props([ 'currentView' => 'list', 'covgroup' => null, 'category' => null, 'parentcat' => null, 'shows' => false ]) @php // Build URLs for toggling views while preserving current query parameters $currentParams = request()->query(); // Map covgroup to correct cover view route $coverRouteMap = [ 'movies' => 'Movies', 'console' => 'Console', 'games' => 'Games', 'music' => 'Audio', 'books' => 'Books', 'xxx' => 'XXX', ]; // Map covgroup to correct list browse parent category $listParentMap = [ 'movies' => 'Movies', 'console' => 'Console', 'games' => 'PC', 'music' => 'Audio', 'books' => 'Books', 'xxx' => 'XXX', ]; // Parent category IDs - these should not be appended to URLs $parentCategoryIds = [ 1000, // Console/Game 2000, // Movies 3000, // Audio/Music 4000, // PC 5000, // TV 6000, // XXX 7000, // Books 8000, // Other ]; // Check if category is a parent category ID (should not be in URL path) $isParentCategory = is_numeric($category) && in_array((int)$category, $parentCategoryIds); // Build cover view URL if ($covgroup && isset($coverRouteMap[$covgroup])) { $coverRoute = $coverRouteMap[$covgroup]; // Only append category if it's not a parent category ID and not 'All' or -1 $catParam = ($category && $category !== -1 && $category !== 'All' && !$isParentCategory) ? $category : ''; $coverUrl = url('/' . $coverRoute . ($catParam ? '/' . $catParam : '')); } elseif ($shows) { $coverUrl = route('series'); } else { $coverUrl = '#'; } // Build list view URL - preserve query params except view and thumbs for clean URL $listParams = $currentParams; unset($listParams['view']); // Determine the correct parent category for list view $listParent = $parentcat; if ($covgroup && isset($listParentMap[$covgroup])) { $listParent = $listParentMap[$covgroup]; } // Only append category to list URL if it's not a parent category ID if ($listParent && $category && $category !== -1 && $category !== 'All' && !$isParentCategory) { $listUrl = url('/browse/' . $listParent . '/' . $category); } elseif ($listParent) { $listUrl = url('/browse/' . $listParent); } else { $listUrl = request()->url(); } // Add query string if there are params if (!empty($listParams)) { $listUrl .= '?' . http_build_query($listParams); } $showThumbnails = request()->query('thumbs', '0') === '1'; @endphp
View @if($currentView === 'covers') {{-- Currently in cover view --}} Covers List @else {{-- Currently in list view --}} @if($covgroup || $shows) Covers @endif List {{-- Thumbnail toggle in list view - client-side via Alpine --}} @if($covgroup || $shows) @endif @endif