From f288a750f580ab19b04a170cc76bf8769084e19d Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Sun, 29 Dec 2024 13:21:50 +0000 Subject: [PATCH] fix: typo in EpisodeController remap function to get episode - fix defaultValue being empty string when cast as array - fix initial styles for select to reduce content layout shift --- app/Resources/styles/choices.css | 22 ++++++------------- app/Resources/styles/custom.css | 4 ++++ app/Views/Components/Forms/FormComponent.php | 4 ++-- app/Views/Components/Forms/Input.php | 2 +- .../Admin/Controllers/EpisodeController.php | 2 +- modules/Auth/Config/Routes.php | 2 +- .../Controllers/ContributorController.php | 6 ++--- .../contributor/{delete.php => remove.php} | 0 themes/cp_admin/podcast/edit.php | 11 +++++----- 9 files changed, 25 insertions(+), 28 deletions(-) rename themes/cp_admin/contributor/{delete.php => remove.php} (100%) diff --git a/app/Resources/styles/choices.css b/app/Resources/styles/choices.css index ae98288d..a83a52f1 100644 --- a/app/Resources/styles/choices.css +++ b/app/Resources/styles/choices.css @@ -35,10 +35,6 @@ cursor: pointer; } - .choices[data-type*="select-one"] .choices__inner { - padding-bottom: 7.5px; - } - .choices[data-type*="select-one"] .choices__input { display: block; width: 100%; @@ -119,7 +115,7 @@ display: inline-block; margin-left: 8px; padding-left: 16px; - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z'/%3E%3C/svg%3E"); + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300574B'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z'/%3E%3C/svg%3E"); background-size: 16px; width: 8px; line-height: 1; @@ -135,7 +131,7 @@ } .choices__inner { - @apply p-2 rounded-lg border-contrast bg-elevated border-3; + @apply px-3 py-2 rounded-lg border-contrast bg-elevated border-3 transition; box-shadow: 2px 2px 0 hsl(var(--color-border-contrast)); display: inline-block; @@ -146,13 +142,9 @@ overflow: hidden; } - .choices[data-type*="select-multiple"] .choices__inner { - @apply pb-1; - } - .is-focused .choices__inner, .is-open .choices__inner { - @apply ring-accent ring-inset; + @apply ring-accent; } .is-open .choices__inner { @@ -183,11 +175,11 @@ } .choices__list--multiple { - display: inline; + @apply inline-flex gap-2 mr-2 items-center; } .choices__list--multiple .choices__item { - @apply inline-block px-2 py-1 mb-1 mr-1 text-sm align-middle rounded text-accent-contrast bg-accent-base; + @apply inline-block font-semibold px-1 py-0.5 text-sm align-middle rounded text-accent-hover bg-base border-accent-base ring-2 ring-accent-base; word-break: break-all; box-sizing: border-box; @@ -203,7 +195,7 @@ } .choices__list--multiple .choices__item.is-highlighted { - @apply bg-accent-base; + @apply bg-subtle; } .is-disabled .choices__list--multiple .choices__item { @@ -329,7 +321,7 @@ } .choices__input { - @apply mb-1 align-middle bg-elevated; + @apply align-middle bg-elevated; display: inline-block; font-size: 14px; diff --git a/app/Resources/styles/custom.css b/app/Resources/styles/custom.css index 19db6669..14888b22 100644 --- a/app/Resources/styles/custom.css +++ b/app/Resources/styles/custom.css @@ -6,6 +6,10 @@ .form-helper { @apply text-skin-muted; } + + select { + box-shadow: 2px 2px 0 hsl(var(--color-border-contrast)); + } } @layer components { diff --git a/app/Views/Components/Forms/FormComponent.php b/app/Views/Components/Forms/FormComponent.php index 58cb30d0..4d8c31d8 100644 --- a/app/Views/Components/Forms/FormComponent.php +++ b/app/Views/Components/Forms/FormComponent.php @@ -32,9 +32,9 @@ abstract class FormComponent extends Component protected string|array|null $value = null; /** - * @var string|string[] + * @var string|string[]|null */ - protected string|array $defaultValue = ''; + protected string|array|null $defaultValue = null; protected bool $isRequired = false; diff --git a/app/Views/Components/Forms/Input.php b/app/Views/Components/Forms/Input.php index 3714553b..a45d3224 100644 --- a/app/Views/Components/Forms/Input.php +++ b/app/Views/Components/Forms/Input.php @@ -18,7 +18,7 @@ class Input extends FormComponent $this->mergeClass('w-full border-contrast rounded-lg focus:border-contrast border-3 focus-within:ring-accent transition'); if ($this->type === 'file') { - $this->mergeClass('file:px-3 file:py-2 file:h-[40px] file:font-semibold file:text-skin-muted file:text-sm file:rounded-none file:border-none file:bg-highlight file:cursor-pointer'); + $this->mergeClass('file:px-3 file:py-2 file:h-[40px] file:font-semibold file:text-accent-hover file:text-sm file:rounded-none file:border-none file:bg-base file:cursor-pointer'); } else { $this->mergeClass('px-3 py-2'); } diff --git a/modules/Admin/Controllers/EpisodeController.php b/modules/Admin/Controllers/EpisodeController.php index ad5b628e..f6f23088 100644 --- a/modules/Admin/Controllers/EpisodeController.php +++ b/modules/Admin/Controllers/EpisodeController.php @@ -48,7 +48,7 @@ class EpisodeController extends BaseController } if ( - ! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1]) instanceof Episode) + ! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1])) instanceof Episode ) { throw PageNotFoundException::forPageNotFound(); } diff --git a/modules/Auth/Config/Routes.php b/modules/Auth/Config/Routes.php index c33aba71..aa56747e 100644 --- a/modules/Auth/Config/Routes.php +++ b/modules/Auth/Config/Routes.php @@ -117,7 +117,7 @@ $routes->group( ); $routes->get( 'remove', - 'ContributorController::remove/$1/$2', + 'ContributorController::removeView/$1/$2', [ 'as' => 'contributor-remove', 'filter' => 'permission:podcast$1.manage-contributors', diff --git a/modules/Auth/Controllers/ContributorController.php b/modules/Auth/Controllers/ContributorController.php index b8df9866..6c75aaeb 100644 --- a/modules/Auth/Controllers/ContributorController.php +++ b/modules/Auth/Controllers/ContributorController.php @@ -206,7 +206,7 @@ class ContributorController extends BaseController ); } - public function deleteView(): string + public function removeView(): string { helper('form'); @@ -222,10 +222,10 @@ class ContributorController extends BaseController 0 => $this->podcast->at_handle, 1 => $this->contributor->username, ]); - return view('contributor/delete', $data); + return view('contributor/remove', $data); } - public function deleteAction(): RedirectResponse + public function removeAction(): RedirectResponse { if ($this->podcast->created_by === $this->contributor->id) { return redirect() diff --git a/themes/cp_admin/contributor/delete.php b/themes/cp_admin/contributor/remove.php similarity index 100% rename from themes/cp_admin/contributor/delete.php rename to themes/cp_admin/contributor/remove.php diff --git a/themes/cp_admin/podcast/edit.php b/themes/cp_admin/podcast/edit.php index a88a88b0..aed8fe82 100644 --- a/themes/cp_admin/podcast/edit.php +++ b/themes/cp_admin/podcast/edit.php @@ -210,18 +210,19 @@ label="" hint="" value="new_feed_url) ?>" /> - + + +
- + - + - +