Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
Simoneu01 committed Oct 10, 2023
1 parent 5a06f0b commit 1d1e941
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 100 deletions.
27 changes: 15 additions & 12 deletions app/Livewire/Rankings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
class Rankings extends Component
{
public Collection $rankings;

public string $year = '2021';

public bool $killcache = false;

protected $queryString = [
Expand All @@ -25,7 +27,7 @@ public function mount(GameshardApi $gameShardApi): void
Cache::forget('rankings' . $this->year);
}

[$tournamentUuid, $phaseUuid] = match($this->year) {
[$tournamentUuid, $phaseUuid] = match ($this->year) {
'2020' => ['f6d9cf5f-9c31-44c6-8693-b99d769b929c', 'ef76c5d2-757b-4ff3-8109-41ea0c1dbb3b'],
'2021' => ['1f13aad9-0459-448a-b14b-537bbf4cfc6f', 'a64424d6-f061-4e12-bc28-2d967040c2c3'],
'2022' => ['b873126e-ad58-48e0-8a39-e43b2adf35e6', '7c786925-e76e-4b85-b6fb-91c148fa8a1b'],
Expand Down Expand Up @@ -57,9 +59,9 @@ public function mount(GameshardApi $gameShardApi): void
'contestant' => [
'id' => $contestant['id'],
'name' => $contestant['name'],
'avatar' => $contestant['avatar']
'avatar' => $contestant['avatar'],
],
'points' => 0
'points' => 0,
];
}
}
Expand All @@ -69,12 +71,12 @@ public function mount(GameshardApi $gameShardApi): void
*/
foreach ($games as $game) {
$game = $game->first();
$homeContestant = Arr::get($game['contestants'],0, null);
if (!$homeContestant) {
$homeContestant = Arr::get($game['contestants'], 0, null);
if (! $homeContestant) {
continue;

Check warning on line 76 in app/Livewire/Rankings.php

View check run for this annotation

Codecov / codecov/patch

app/Livewire/Rankings.php#L74-L76

Added lines #L74 - L76 were not covered by tests
}
$awayContestant = Arr::get($game['contestants'],1, null);
if (!$awayContestant) {
$awayContestant = Arr::get($game['contestants'], 1, null);
if (! $awayContestant) {
continue;

Check warning on line 80 in app/Livewire/Rankings.php

View check run for this annotation

Codecov / codecov/patch

app/Livewire/Rankings.php#L78-L80

Added lines #L78 - L80 were not covered by tests
}
if ((int) $homeContestant['score'] + (int) $awayContestant['score'] > 12) {
Expand Down Expand Up @@ -107,8 +109,9 @@ public function mount(GameshardApi $gameShardApi): void
}

$rankings = collect($rankings);

return $rankings->sortBy([
['points', 'desc']
['points', 'desc'],
]);
});

Expand All @@ -118,10 +121,10 @@ public function mount(GameshardApi $gameShardApi): void
public function getTrophyColor(int $position): string
{
return match ($position) {
1 => "#FFD147",
2 => "#C9C8CC",
3 => "#B5785B",
default => "000000",
1 => '#FFD147',
2 => '#C9C8CC',
3 => '#B5785B',
default => '000000',
};
}

Expand Down
71 changes: 41 additions & 30 deletions resources/views/components/hero.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,37 @@ class="inline-flex items-center justify-center rounded-md bg-gray-50 p-2 text-gr
<a class="font-medium text-gray-500 hover:text-gray-900" href="{{ route('chi-siamo') }}">Chi
Siamo</a>

<a class="font-medium text-gray-500 hover:text-gray-900" href="{{ route('campionato-corrente') }}">Be
<a class="font-medium text-gray-500 hover:text-gray-900"
href="{{ route('campionato-corrente') }}">Be
Serious 2023</a>

<div class="relative" x-data="{open: false}" @click.outside="open = false">
<button type="button" class="inline-flex items-center gap-x-1 font-medium leading-6 text-gray-500 hover:text-gray-900" aria-expanded="false" @click="open =! open">
<div class="relative" x-data="{ open: false }" @click.outside="open = false">
<button
class="inline-flex items-center gap-x-1 font-medium leading-6 text-gray-500 hover:text-gray-900"
type="button" aria-expanded="false" @click="open =! open">
<span>Campionati Precedenti</span>
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd" />
<svg class="h-5 w-5" aria-hidden="true" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd"
d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"
clip-rule="evenodd" />
</svg>
</button>

<div class="absolute left-1/2 z-10 mt-5 flex w-screen max-w-min -translate-x-1/2 px-4" x-show="open" x-cloak

x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 translate-y-1"
x-transition:enter-end="opacity-100 translate-y-0"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 translate-y-0"
x-transition:leave-end="opacity-0 translate-y-1"


>
<div class="w-56 shrink rounded-xl bg-white p-4 text-sm font-semibold leading-6 text-gray-500 shadow-lg ring-1 ring-gray-900/5">
<a href="{{ route('campionato-anno', 2022) }}" class="block p-2 hover:text-gray-900">BeSerious 2022</a>
<a href="{{ route('campionato-anno', 2021) }}" class="block p-2 hover:text-gray-900">BeSerious 2021</a>
<a href="{{ route('campionato-anno', 2020) }}" class="block p-2 hover:text-gray-900">BeSerious 2020</a>
<div class="absolute left-1/2 z-10 mt-5 flex w-screen max-w-min -translate-x-1/2 px-4"
x-show="open" x-cloak x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 translate-y-1"
x-transition:enter-end="opacity-100 translate-y-0"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 translate-y-0"
x-transition:leave-end="opacity-0 translate-y-1">
<div
class="w-56 shrink rounded-xl bg-white p-4 text-sm font-semibold leading-6 text-gray-500 shadow-lg ring-1 ring-gray-900/5">
<a class="block p-2 hover:text-gray-900"
href="{{ route('campionato-anno', 2022) }}">BeSerious 2022</a>
<a class="block p-2 hover:text-gray-900"
href="{{ route('campionato-anno', 2021) }}">BeSerious 2021</a>
<a class="block p-2 hover:text-gray-900"
href="{{ route('campionato-anno', 2020) }}">BeSerious 2020</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -150,26 +155,32 @@ class="inline-flex items-center justify-center rounded-md bg-white p-2 text-gray
<a class="block rounded-md px-3 py-2 text-base font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900"
href="{{ route('campionato-corrente') }}">Be Serious 2023</a>

<div x-data="{campionatiIsOpen: false}">
<button type="button" class="flex w-full items-center justify-between rounded-md py-2 pl-3 pr-3.5 text-base font-medium leading-7 text-gray-700 hover:bg-gray-50 hover:text-gray-900" aria-controls="disclosure-1" aria-expanded="false"
@click="campionatiIsOpen =! campionatiIsOpen">
<div x-data="{ campionatiIsOpen: false }">
<button
class="flex w-full items-center justify-between rounded-md py-2 pl-3 pr-3.5 text-base font-medium leading-7 text-gray-700 hover:bg-gray-50 hover:text-gray-900"
type="button" aria-controls="disclosure-1" aria-expanded="false"
@click="campionatiIsOpen =! campionatiIsOpen">
Campionati precedenti
<!--
Expand/collapse icon, toggle classes based on menu open state.
Open: "rotate-180", Closed: ""
-->
<svg
:class="campionatiIsOpen ? 'rotate-180' : ''"
class="h-5 w-5 flex-none" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd" />
<svg class="h-5 w-5 flex-none" aria-hidden="true"
:class="campionatiIsOpen ? 'rotate-180' : ''" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd"
d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"
clip-rule="evenodd" />
</svg>
</button>
<!-- 'Campionati precedenti' sub-menu, show/hide based on menu state. -->
<div class="mt-2 space-y-2" id="disclosure-1" x-show="campionatiIsOpen" x-cloak>
<a href="{{ route('campionato-anno', 2022) }}" class="block rounded-lg py-2 pl-6 pr-3 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900">BeSerious 2022</a>
<a href="{{ route('campionato-anno', 2021) }}" class="block rounded-lg py-2 pl-6 pr-3 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900">BeSerious 2021</a>
<a href="{{ route('campionato-anno', 2020) }}" class="block rounded-lg py-2 pl-6 pr-3 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900">BeSerious 2020</a>
<a class="block rounded-lg py-2 pl-6 pr-3 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900"
href="{{ route('campionato-anno', 2022) }}">BeSerious 2022</a>
<a class="block rounded-lg py-2 pl-6 pr-3 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900"
href="{{ route('campionato-anno', 2021) }}">BeSerious 2021</a>
<a class="block rounded-lg py-2 pl-6 pr-3 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900"
href="{{ route('campionato-anno', 2020) }}">BeSerious 2020</a>
</div>
</div>

Expand Down
Loading

0 comments on commit 1d1e941

Please sign in to comment.