From cdf9f9d53f2597f19455cb65c51da4677bb99327 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Fri, 21 Jan 2022 19:26:31 +0000 Subject: [PATCH] fix: add missing explicit badge for podcasts and episodes --- app/Helpers/components_helper.php | 16 +++++++++++ themes/cp_app/episode/_layout.php | 5 +++- themes/cp_app/episode/_partials/card.php | 2 +- themes/cp_app/home.php | 3 +- themes/cp_app/podcast/_layout.php | 35 +++++++++++++----------- 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/app/Helpers/components_helper.php b/app/Helpers/components_helper.php index 2d12bc3d..7c7073f4 100644 --- a/app/Helpers/components_helper.php +++ b/app/Helpers/components_helper.php @@ -316,3 +316,19 @@ if (! function_exists('relative_time')) { } // ------------------------------------------------------------------------ + +if (! function_exists('explicit_badge')) { + function explicit_badge(bool $isExplicit, string $class = ''): string + { + if (! $isExplicit) { + return ''; + } + + $explicitLabel = lang('Common.explicit'); + return <<{$explicitLabel} + CODE_SAMPLE; + } +} + +// ------------------------------------------------------------------------ diff --git a/themes/cp_app/episode/_layout.php b/themes/cp_app/episode/_layout.php index ba9291fd..8fb8aeca 100644 --- a/themes/cp_app/episode/_layout.php +++ b/themes/cp_app/episode/_layout.php @@ -81,7 +81,10 @@
- <?= $episode->title ?> +
+ parental_advisory === 'explicit', 'rounded absolute left-0 bottom-0 ml-2 mb-2 bg-black/75 text-accent-contrast') ?> + <?= $episode->title ?> +
number, $episode->season_number, 'text-sm leading-none font-semibold px-1 py-1 text-white/90 border !no-underline border-subtle', true) ?>

title ?>

diff --git a/themes/cp_app/episode/_partials/card.php b/themes/cp_app/episode/_partials/card.php index ed915ac8..22de5e04 100644 --- a/themes/cp_app/episode/_partials/card.php +++ b/themes/cp_app/episode/_partials/card.php @@ -12,7 +12,7 @@ number, $episode->season_number, 'text-xs font-semibold border-subtle text-skin-muted px-1 border mr-2 !no-underline', true) ?> published_at, 'text-xs whitespace-nowrap text-skin-muted') ?>
-

title ?>

+

title ?>

+ parental_advisory === 'explicit', 'absolute top-0 left-0 z-10 rounded bg-black/75 ml-2 mt-2') ?> <?= $podcast->title ?>
-
+

title ?>

@handle ?>

diff --git a/themes/cp_app/podcast/_layout.php b/themes/cp_app/podcast/_layout.php index 0f77aa72..417f3953 100644 --- a/themes/cp_app/podcast/_layout.php +++ b/themes/cp_app/podcast/_layout.php @@ -47,11 +47,14 @@
<?= $podcast->title ?> -
+

title ?>@handle ?>

- $podcast->actor->followers_count, - ]) ?> +
+ parental_advisory === 'explicit', 'mr-1') ?> + $podcast->actor->followers_count, + ]) ?> +
@@ -59,18 +62,18 @@ handle), - icon( - 'social/castopod', - 'mr-2 text-xl text-black/75 group-hover:text-black', - ) . lang('Podcast.follow'), - [ - 'width' => 420, - 'height' => 620, - 'class' => - 'group inline-flex items-center px-4 text-xs tracking-wider font-semibold text-black uppercase rounded-full leading-8 shadow focus:ring-accent bg-white', - ], - ) ?> + route_to('follow', $podcast->handle), + icon( + 'social/castopod', + 'mr-2 text-xl text-black/75 group-hover:text-black', + ) . lang('Podcast.follow'), + [ + 'width' => 420, + 'height' => 620, + 'class' => + 'group inline-flex items-center px-4 text-xs tracking-wider font-semibold text-black uppercase rounded-full leading-8 shadow focus:ring-accent bg-white', + ], + ) ?>
include('podcast/_partials/navigation') ?>