fix(admin-ui): remove button labels on smaller screens in podcast view

- update components renderer regex to include special characters
- fix itunes_explicit mapping
during import
This commit is contained in:
Yassine Doghri 2023-07-29 09:57:35 +00:00
parent 16a3fdb56e
commit 9cc5ffd143
5 changed files with 20 additions and 6 deletions

View File

@ -96,7 +96,7 @@ class ComponentRenderer
private function renderPairedTags(string $output): string
{
$pattern = '/<\s*(?<name>[A-Z][A-Za-z0-9\.]*?)(?<attributes>[\s\S\=\'\"]*)>(?<slot>.*)<\/\s*\1\s*>/uUsm';
$pattern = '/<\s*(?<name>[A-Z][A-Za-z0-9\.]*?)(?<attributes>(\s*[\w\-]+\s*=\s*(\'[^\']*\'|\"[^\"]*\"))+\s*)>(?<slot>.*)<\/\s*\1\s*>/uUsm';
ini_set('pcre.backtrack_limit', '-1');
/*
$matches[0] = full tags matched and all of its content

View File

@ -81,6 +81,10 @@ class Button extends Component
unset($this->attributes['class']);
}
if ($this->iconLeft !== '' || $this->iconRight !== '') {
$this->slot = '<span>' . $this->slot . '</span>';
}
if ($this->iconLeft !== '') {
$this->slot = (new Icon([
'glyph' => $this->iconLeft,

View File

@ -209,6 +209,11 @@ class PodcastImport extends BaseCommand
throw new Exception('Missing podcast cover. Please include an <itunes:image> tag');
}
$parentalAdvisory = null;
if ($this->podcastFeed->channel->itunes_explicit->getValue() !== null) {
$parentalAdvisory = $this->podcastFeed->channel->itunes_explicit->getValue() ? 'explicit' : 'clean';
}
$htmlConverter = new HtmlConverter();
$podcast = new Podcast([
'created_by' => $this->user->id,
@ -224,7 +229,7 @@ class PodcastImport extends BaseCommand
'banner' => null,
'language_code' => $this->importTask->language,
'category_id' => $this->importTask->category,
'parental_advisory' => $this->podcastFeed->channel->itunes_explicit->getValue(),
'parental_advisory' => $parentalAdvisory,
'owner_name' => $this->podcastFeed->channel->itunes_owner->itunes_name->getValue(),
'owner_email' => $this->podcastFeed->channel->itunes_owner->itunes_email->getValue(),
'publisher' => $this->podcastFeed->channel->itunes_author->getValue(),
@ -439,6 +444,11 @@ class PodcastImport extends BaseCommand
$coverUrl = $this->getCoverUrl($item);
$parentalAdvisory = null;
if ($item->itunes_explicit->getValue() !== null) {
$parentalAdvisory = $item->itunes_explicit->getValue() ? 'explicit' : 'clean';
}
$episode = new Episode([
'created_by' => $this->user->id,
'updated_by' => $this->user->id,
@ -455,7 +465,7 @@ class PodcastImport extends BaseCommand
'description_markdown' => $htmlConverter->convert($showNotes),
'description_html' => $showNotes,
'cover' => $coverUrl ? download_file($coverUrl) : null,
'parental_advisory' => $item->itunes_explicit->getValue(),
'parental_advisory' => $parentalAdvisory,
'number' => $item->itunes_episode->getValue(),
'season_number' => $item->itunes_season->getValue(),
'type' => $item->itunes_episodeType->getValue(),

View File

@ -16,7 +16,7 @@ $userPodcasts = get_podcasts_user_can_interact_with(auth()->user()); ?>
'home',
) ?>" class="inline-flex items-center h-full px-2 text-sm font-semibold sm:px-6 hover:underline focus:ring-inset focus:ring-accent" title="<?= lang('Navigation.go_to_website') ?>">
<span class="hidden sm:block"><?= lang('Navigation.go_to_website') ?></span>
<?= icon('external-link', 'ml-1 text-xl sm:opacity-60') ?>
<?= icon('external-link', 'sm:ml-1 text-xl sm:text-base sm:opacity-60') ?>
</a>
</div>
<div class="inline-flex items-center h-full ml-auto">

View File

@ -9,8 +9,8 @@
<?= $this->endSection() ?>
<?= $this->section('headerRight') ?>
<Button uri="<?= route_to('podcast-edit', $podcast->id) ?>" variant="secondary" iconLeft="edit"><?= lang('Podcast.edit') ?></Button>
<Button uri="<?= route_to('episode-create', $podcast->id) ?>" variant="primary" iconLeft="add"><?= lang('Episode.create') ?></Button>
<Button uri="<?= route_to('podcast-edit', $podcast->id) ?>" variant="secondary" class="[&>span]:hidden [&>span]:md:block py-3 md:py-2" iconLeft="edit"><?= lang('Podcast.edit') ?></Button>
<Button uri="<?= route_to('episode-create', $podcast->id) ?>" variant="primary" class="[&>span]:hidden [&>span]:md:block py-3 md:py-2" iconLeft="add"><?= lang('Episode.create') ?></Button>
<?= $this->endSection() ?>
<?= $this->section('content') ?>