Commit 5f3752b4 authored by Guy Martin (Dwev)'s avatar Guy Martin (Dwev) 🇩🇰 Committed by Yassine Doghri
Browse files

feat(admin): add podcast's OP3 analytics dashboard link

parent a12327da
Loading
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ use RuntimeException;
 * @property string|null $location_osm
 * @property string|null $payment_pointer
 * @property array|null $custom_rss
 * @property bool $is_op3_enabled
 * @property string $op3_url
 * @property string $custom_rss_string
 * @property bool $is_published_on_hubs
 * @property string|null $partner_id
@@ -688,4 +690,14 @@ class Podcast extends Entity
        // podcast is premium if at least one of its episodes is set as premium
        return (new EpisodeModel())->doesPodcastHavePremiumEpisodes($this->id);
    }

    public function getIsOp3Enabled(): bool
    {
        return service('settings')->get('Analytics.enableOP3', 'podcast:' . $this->id);
    }

    public function getOp3Url(): string
    {
        return 'https://op3.dev/show/' . $this->guid;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ return [
        'premium_by_default' => 'Episodes must be set as premium by default',
        'premium_by_default_hint' => 'Podcast episodes will be marked as premium by default. You can still choose to set some episodes, trailers or bonuses as public.',
        'op3' => 'Open Podcast Prefix Project (OP3)',
        'op3_link' => 'Visit your OP3 dashboard (external link)',
        'op3_hint' => 'Value your analytics data with OP3, an open-source and trusted third party analytics service. Share, validate and compare your analytics data with the open podcasting ecosystem.',
        'op3_enable' => 'Enable OP3 analytics service',
        'op3_enable_hint' => 'For security reasons, premium episodes\' analytics data will not be shared with OP3.',
+39 −28
Original line number Diff line number Diff line
@@ -85,9 +85,10 @@ $podcastNavigation = [

?>

<div class="relative flex items-stretch px-2 py-2 border-b border-navigation">
<div class="flex gap-2 px-2 py-2 border-b border-navigation">
    <div class="relative">
        <?php if ($podcast->is_premium): ?>
        <Icon glyph="exchange-dollar" class="absolute pl-1 text-xl rounded-r-full rounded-tl-lg left-4 top-4 text-accent-contrast bg-accent-base" />
            <Icon glyph="exchange-dollar" class="absolute left-0 pl-1 text-xl rounded-r-full rounded-tl-lg top-2 text-accent-contrast bg-accent-base" />
        <?php endif; ?>
        <img
        src="<?= $podcast->cover->thumbnail_url ?>"
@@ -95,7 +96,9 @@ $podcastNavigation = [
        class="object-cover w-20 h-20 rounded aspect-square"
        loading="lazy"
        />
    <div class="flex flex-col items-start flex-1 w-48 px-2">
    </div>
    <div class="flex flex-col gap-4">
        <div class="flex flex-col items-start flex-1 w-48">
            <span class="w-full font-semibold truncate" title="<?= esc($podcast->title) ?>"><?= esc($podcast->title) ?></span>
            <a href="<?= route_to(
                'podcast-activity',
@@ -106,9 +109,17 @@ $podcastNavigation = [
            ) ?>">@<?= esc($podcast->handle) ?>
            <?= icon('external-link', 'ml-1 opacity-60') ?>
            </a>
        <a href="<?= $podcast->feed_url ?>" class="inline-flex items-center mt-auto text-xs gap-x-1 focus:ring-accent group hover:underline" target="_blank" rel="noopener noreferrer">
            <?= icon('rss', 'text-xl text-orange-400 inline-flex items-center justify-center rounded') . lang('PodcastNavigation.rss_feed') . icon('external-link', 'text-sm opacity-60') ?>
        </div>
        <div class="flex flex-col items-start gap-1">
            <a href="<?= $podcast->feed_url ?>" class="inline-flex items-center text-xs gap-x-1 focus:ring-accent group hover:underline" target="_blank" rel="noopener noreferrer" data-tooltip="bottom" title="<?= lang('PodcastNavigation.rss_feed') ?>">
                <?= icon('rss', 'text-xl text-orange-400 inline-flex items-center justify-center rounded') . 'RSS Feed' . icon('external-link', 'text-sm opacity-60') ?>
            </a>
            <?php if ($podcast->is_op3_enabled): ?>
            <a href="<?= $podcast->op3_url ?>" class="inline-flex items-center text-xs gap-x-1 focus:ring-accent group hover:underline" data-tooltip="bottom" target="_blank" rel="noopener noreferrer" title="<?= lang('Podcast.form.op3_link') ?>">
                <?= icon('line-chart', 'text-xl text-white inline-flex items-center justify-center rounded') . 'OP3' . icon('external-link', 'text-sm opacity-60') ?>
            </a>
            <?php endif; ?>
        </div>
    </div>
</div>