-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge staging into master (#776)
- Loading branch information
Showing
117 changed files
with
1,043 additions
and
814 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Livewire\Navbar; | ||
|
||
final class MobileDarkModeToggle extends MobileToggle | ||
{ | ||
/** @var mixed */ | ||
protected $listeners = [ | ||
'themeChanged' => 'storeTheme', | ||
]; | ||
|
||
public function storeTheme(string $newValue): void | ||
{ | ||
if ($newValue !== $this->currentValue) { | ||
$this->currentValue = $newValue; | ||
|
||
$this->save(false); | ||
|
||
$this->emit('themeChanged', $newValue); | ||
} | ||
} | ||
|
||
protected function save(bool $dispatchEvent = true): void | ||
{ | ||
parent::save(); | ||
|
||
if ($dispatchEvent) { | ||
$this->dispatchBrowserEvent('setThemeMode', [ | ||
'theme' => $this->currentValue, | ||
]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Livewire\Navbar; | ||
|
||
use App\Facades\Settings; | ||
use App\Http\Livewire\Concerns\HandlesSettings; | ||
use Illuminate\Support\Collection; | ||
use Illuminate\View\View; | ||
use Livewire\Component; | ||
|
||
/* Ignore phpstan error for final or abstract class, as we can use this toggle component as a generic setting toggle. | ||
/* @phpstan-ignore-next-line */ | ||
class MobileToggle extends Component | ||
{ | ||
use HandlesSettings; | ||
|
||
public array $options; | ||
|
||
public string $setting; | ||
|
||
public mixed $currentValue = null; | ||
|
||
public function mount( | ||
array $options, | ||
string $setting, | ||
): void { | ||
$this->options = $options; | ||
$this->setting = $setting; | ||
|
||
$this->currentValue = Settings::get($this->setting); | ||
} | ||
|
||
public function render(): View | ||
{ | ||
return view('livewire.navbar.mobile-toggle'); | ||
} | ||
|
||
public function setValue(string|int $value): void | ||
{ | ||
$this->currentValue = $value; | ||
|
||
$this->save(); | ||
} | ||
|
||
public function icon(): string | ||
{ | ||
return Collection::make($this->options) | ||
->firstWhere('value', $this->currentValue)['icon']; | ||
} | ||
|
||
protected function save(): void | ||
{ | ||
$this->saveSetting($this->setting, $this->currentValue); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.