|
3 | 3 | See the LICENCE file in the repository root for full licence text.
|
4 | 4 | --}}
|
5 | 5 | @php
|
| 6 | + use App\Http\Controllers\RankingController; |
| 7 | +
|
6 | 8 | $mode ??= default_mode();
|
7 |
| - $selectorParams = [ |
8 |
| - 'type' => $type, |
9 |
| - 'mode' => $mode, |
10 |
| - 'route' => fn ($routeMode, $routeType) => ( |
11 |
| - match ($routeType) { |
12 |
| - 'country' => route('rankings', ['mode' => $routeMode, 'type' => $routeType]), |
13 |
| - 'multiplayer' => route('multiplayer.rooms.show', ['room' => 'latest']), |
14 |
| - 'seasons' => route('seasons.show', ['season' => 'latest']), |
15 |
| - 'kudosu' => route('rankings.kudosu'), |
16 |
| - default => trim(route('rankings', [ |
17 |
| - 'mode' => $routeMode, |
18 |
| - 'type' => $routeType, |
19 |
| - 'spotlight' => $routeType === 'charts' ? $spotlight ?? null : null, |
20 |
| - 'country' => $routeType === 'performance' ? ($country['acronym'] ?? null) : null, |
21 |
| - ]), '?') |
22 |
| - } |
23 |
| - ) |
24 |
| - ]; |
| 9 | + $country ??= null; |
| 10 | + $spotlight ??= null; |
| 11 | + $rankingUrl = fn (string $type, string $rulesetName) => |
| 12 | + RankingController::url($type, $rulesetName, $country, $spotlight); |
25 | 13 |
|
26 | 14 | $links = [];
|
27 |
| - foreach (['performance', 'score', 'country', 'multiplayer', 'seasons', 'charts', 'kudosu'] as $tab) { |
| 15 | + foreach (RankingController::TYPES as $tab) { |
28 | 16 | $links[] = [
|
29 | 17 | 'active' => $tab === $type,
|
30 | 18 | 'title' => osu_trans("rankings.type.{$tab}"),
|
31 |
| - 'url' => $selectorParams['route']($mode, $tab), |
| 19 | + 'url' => $rankingUrl($tab, $mode), |
32 | 20 | ];
|
33 | 21 | }
|
34 | 22 |
|
35 |
| - $hasMode = $hasMode ?? true; |
36 |
| - $hasScores = $hasScores ?? true; |
| 23 | + $hasMode ??= true; |
| 24 | + $hasScores ??= true; |
37 | 25 | @endphp
|
38 | 26 |
|
39 | 27 | @extends('master', ['titlePrepend' => $titlePrepend ?? osu_trans("rankings.type.{$type}")])
|
|
45 | 33 | ]])
|
46 | 34 | @slot('linksAppend')
|
47 | 35 | @if($hasMode)
|
48 |
| - @include('rankings._mode_selector', $selectorParams) |
| 36 | + @include('rankings._mode_selector') |
49 | 37 | @endif
|
50 | 38 |
|
51 | 39 | @yield('additionalHeaderLinks')
|
|
0 commit comments