-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
129 changed files
with
6,403 additions
and
1,623 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Enum; | ||
|
||
use App\Enum\Traits\WireableEnumTrait; | ||
use Livewire\Wireable; | ||
|
||
enum AlbumMode: int implements Wireable | ||
{ | ||
use WireableEnumTrait; | ||
|
||
case FLKR = 0; | ||
case MASONRY = 1; | ||
case SQUARE = 2; | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace App\Enum; | ||
|
||
use App\Enum\Traits\WireableEnumTrait; | ||
use Livewire\Wireable; | ||
|
||
enum PageMode: string implements Wireable | ||
{ | ||
use WireableEnumTrait; | ||
|
||
case ALBUM = 'album'; | ||
case ALBUMS = 'albums'; | ||
case PHOTO = 'photo'; | ||
case MAP = 'map'; | ||
} |
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,42 @@ | ||
<?php | ||
|
||
namespace App\Enum; | ||
|
||
use App\Enum\Traits\WireableEnumTrait; | ||
use Livewire\Wireable; | ||
|
||
enum PhotoOverlayMode: string implements Wireable | ||
{ | ||
use WireableEnumTrait; | ||
|
||
case NONE = 'none'; | ||
case DESC = 'desc'; | ||
case EXIF = 'exif'; | ||
case DATE = 'date'; | ||
|
||
/** | ||
* Iterate to the next OverlayMode. | ||
* | ||
* @return PhotoOverlayMode | ||
*/ | ||
public function next(): PhotoOverlayMode | ||
{ | ||
return match ($this) { | ||
self::NONE => self::DESC, | ||
self::DESC => self::DATE, | ||
self::DATE => self::EXIF, | ||
self::EXIF => self::NONE, | ||
default => self::NONE | ||
}; | ||
} | ||
|
||
/** | ||
* Number of valid values. | ||
* | ||
* @return int | ||
*/ | ||
public static function count(): int | ||
{ | ||
return 4; | ||
} | ||
} |
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 | ||
|
||
namespace App\Enum\Traits; | ||
|
||
use App\Exceptions\Internal\LycheeLogicException; | ||
use Closure; | ||
|
||
trait WireableEnumTrait | ||
{ | ||
public function toLivewire(): string|int | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public static function fromLivewire(mixed $value): self | ||
{ | ||
if (!is_string($value) && !is_int($value)) { | ||
throw new LycheeLogicException('Enum could not be instanciated from ' . strval($value), null); | ||
} | ||
|
||
return self::from($value); | ||
} | ||
|
||
/** | ||
* @return string[]|int[]|\Closure | ||
* | ||
* @psalm-return array<string, string|int> | Closure(string):(int|string) | ||
*/ | ||
protected static function values() | ||
{ | ||
return function (string $name): string { | ||
return mb_strtolower($name); | ||
}; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,90 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Components\Base; | ||
|
||
use Illuminate\View\View; | ||
|
||
/** | ||
* Modal component, extends Openable. | ||
* | ||
* This aims to encapsulate any floating box that appears in Lychee Interface: | ||
* - login | ||
* - privacy properties... | ||
*/ | ||
class Modal extends Openable | ||
{ | ||
/** @var string defines the opacity status (unused for now) */ | ||
public string $opacity = '0'; | ||
|
||
/** | ||
* ! defines the type of Modal. This correspond to the Livewire component loaded inside the Modal. | ||
* | ||
* @var string | ||
*/ | ||
public string $type = ''; | ||
|
||
/** | ||
* ! defines the arguments to be passed to the Livewire component loaded inside the Modal. | ||
* | ||
* @var array | ||
*/ | ||
public array $params = []; | ||
|
||
/** | ||
* Css properties for the modal. | ||
* | ||
* @var string | ||
*/ | ||
public string $modalSize = 'md:max-w-xl'; | ||
|
||
/** | ||
* This defined the events that the Component will intercept. | ||
* In order to facilitate the use of those events, the trait | ||
* app/Livewire/Traits/InteractWithModal.php can be used to | ||
* add access to the modal. | ||
* | ||
* @var string[] listeners for modal events | ||
* */ | ||
protected $listeners = [ | ||
'openModal', | ||
'closeModal', | ||
'deleteModal', | ||
]; | ||
|
||
/** | ||
* Open a Modal. | ||
* | ||
* @param string $type defines the Component loaded inside the modal | ||
* @param array $params Arguments to pass to the modal | ||
* | ||
* @return void | ||
*/ | ||
public function openModal(string $type, array $params = []): void | ||
{ | ||
$this->open(); | ||
$this->type = $type; | ||
$this->params = $params; | ||
$this->opacity = '100'; | ||
} | ||
|
||
/** | ||
* Close the Modal component. | ||
* | ||
* @return void | ||
*/ | ||
public function closeModal(): void | ||
{ | ||
$this->close(); | ||
$this->opacity = '0'; | ||
} | ||
|
||
/** | ||
* Rendering of the Component. | ||
* | ||
* @return View | ||
*/ | ||
public function render(): View | ||
{ | ||
return view('livewire.modal'); | ||
} | ||
} |
Oops, something went wrong.