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
This commit is contained in:
Yassine Doghri 2024-12-29 13:21:50 +00:00
parent 7e8f0003d1
commit f288a750f5
9 changed files with 25 additions and 28 deletions

View File

@ -35,10 +35,6 @@
cursor: pointer; cursor: pointer;
} }
.choices[data-type*="select-one"] .choices__inner {
padding-bottom: 7.5px;
}
.choices[data-type*="select-one"] .choices__input { .choices[data-type*="select-one"] .choices__input {
display: block; display: block;
width: 100%; width: 100%;
@ -119,7 +115,7 @@
display: inline-block; display: inline-block;
margin-left: 8px; margin-left: 8px;
padding-left: 16px; 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; background-size: 16px;
width: 8px; width: 8px;
line-height: 1; line-height: 1;
@ -135,7 +131,7 @@
} }
.choices__inner { .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)); box-shadow: 2px 2px 0 hsl(var(--color-border-contrast));
display: inline-block; display: inline-block;
@ -146,13 +142,9 @@
overflow: hidden; overflow: hidden;
} }
.choices[data-type*="select-multiple"] .choices__inner {
@apply pb-1;
}
.is-focused .choices__inner, .is-focused .choices__inner,
.is-open .choices__inner { .is-open .choices__inner {
@apply ring-accent ring-inset; @apply ring-accent;
} }
.is-open .choices__inner { .is-open .choices__inner {
@ -183,11 +175,11 @@
} }
.choices__list--multiple { .choices__list--multiple {
display: inline; @apply inline-flex gap-2 mr-2 items-center;
} }
.choices__list--multiple .choices__item { .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; word-break: break-all;
box-sizing: border-box; box-sizing: border-box;
@ -203,7 +195,7 @@
} }
.choices__list--multiple .choices__item.is-highlighted { .choices__list--multiple .choices__item.is-highlighted {
@apply bg-accent-base; @apply bg-subtle;
} }
.is-disabled .choices__list--multiple .choices__item { .is-disabled .choices__list--multiple .choices__item {
@ -329,7 +321,7 @@
} }
.choices__input { .choices__input {
@apply mb-1 align-middle bg-elevated; @apply align-middle bg-elevated;
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;

View File

@ -6,6 +6,10 @@
.form-helper { .form-helper {
@apply text-skin-muted; @apply text-skin-muted;
} }
select {
box-shadow: 2px 2px 0 hsl(var(--color-border-contrast));
}
} }
@layer components { @layer components {

View File

@ -32,9 +32,9 @@ abstract class FormComponent extends Component
protected string|array|null $value = null; 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; protected bool $isRequired = false;

View File

@ -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'); $this->mergeClass('w-full border-contrast rounded-lg focus:border-contrast border-3 focus-within:ring-accent transition');
if ($this->type === 'file') { 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 { } else {
$this->mergeClass('px-3 py-2'); $this->mergeClass('px-3 py-2');
} }

View File

@ -48,7 +48,7 @@ class EpisodeController extends BaseController
} }
if ( if (
! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1]) instanceof Episode) ! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1])) instanceof Episode
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }

View File

@ -117,7 +117,7 @@ $routes->group(
); );
$routes->get( $routes->get(
'remove', 'remove',
'ContributorController::remove/$1/$2', 'ContributorController::removeView/$1/$2',
[ [
'as' => 'contributor-remove', 'as' => 'contributor-remove',
'filter' => 'permission:podcast$1.manage-contributors', 'filter' => 'permission:podcast$1.manage-contributors',

View File

@ -206,7 +206,7 @@ class ContributorController extends BaseController
); );
} }
public function deleteView(): string public function removeView(): string
{ {
helper('form'); helper('form');
@ -222,10 +222,10 @@ class ContributorController extends BaseController
0 => $this->podcast->at_handle, 0 => $this->podcast->at_handle,
1 => $this->contributor->username, 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) { if ($this->podcast->created_by === $this->contributor->id) {
return redirect() return redirect()

View File

@ -210,18 +210,19 @@ label="<?= esc(lang('Podcast.form.new_feed_url')) ?>"
hint="<?= esc(lang('Podcast.form.new_feed_url_hint')) ?>" hint="<?= esc(lang('Podcast.form.new_feed_url_hint')) ?>"
value="<?= esc($podcast->new_feed_url) ?>" value="<?= esc($podcast->new_feed_url) ?>"
/> />
<Forms.Toggler name="redirect_to_new_feed" value="yes" checked="<?= service('settings') <x-Forms.Toggler name="redirect_to_new_feed" value="<?= service('settings')->get('Podcast.redirect_to_new_feed', 'podcast:' . $podcast->id) ? 'yes' : '' ?>" hint="<?= esc(lang('Podcast.form.redirect_to_new_feed_hint')) ?>">
->get('Podcast.redirect_to_new_feed', 'podcast:' . $podcast->id) ? 'true' : 'false' ?>" hint="<?= esc(lang('Podcast.form.redirect_to_new_feed_hint')) ?>"><?= lang('Podcast.form.redirect_to_new_feed') ?></Forms.Toggler> <?= lang('Podcast.form.redirect_to_new_feed') ?>
</x-Forms.Toggler>
<hr class="border-subtle"> <hr class="border-subtle">
<x-Forms.Toggler class="mb-2" name="lock" value="<?= $podcast->is_locked ? 'yes' : '' ?>" hint="<?= esc(lang('Podcast.form.lock_hint')) ?>"> <x-Forms.Toggler name="lock" value="<?= $podcast->is_locked ? 'yes' : '' ?>" hint="<?= esc(lang('Podcast.form.lock_hint')) ?>">
<?= lang('Podcast.form.lock') ?> <?= lang('Podcast.form.lock') ?>
</x-Forms.Toggler> </x-Forms.Toggler>
<x-Forms.Toggler class="mb-2" name="block" value="<?= $podcast->is_blocked ? 'yes' : '' ?>" hint="<?= esc(lang('Podcast.form.block_hint')) ?>"> <x-Forms.Toggler class="mt-2" name="block" value="<?= $podcast->is_blocked ? 'yes' : '' ?>" hint="<?= esc(lang('Podcast.form.block_hint')) ?>">
<?= lang('Podcast.form.block') ?> <?= lang('Podcast.form.block') ?>
</x-Forms.Toggler> </x-Forms.Toggler>
<x-Forms.Toggler name="complete" value="<?= $podcast->is_completed ? 'yes' : '' ?>"> <x-Forms.Toggler class="mt-2" name="complete" value="<?= $podcast->is_completed ? 'yes' : '' ?>">
<?= lang('Podcast.form.complete') ?> <?= lang('Podcast.form.complete') ?>
</x-Forms.Toggler> </x-Forms.Toggler>