Commit 2c0efc65 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat: simplify podcast page's layout for better ux

parent c639c414
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
            ],
        ],
    ]);
    $routes->get('about', 'PodcastController::about/$1', [
        'as' => 'podcast-about',
    ]);
    $routes->options('episodes', 'ActivityPubController::preflight');
    $routes->get('episodes', 'PodcastController::episodes/$1', [
        'as' => 'podcast-episodes',
+45 −0
Original line number Diff line number Diff line
@@ -105,6 +105,51 @@ class PodcastController extends BaseController
        return $cachedView;
    }

    public function about(): string
    {
        // Prevent analytics hit when authenticated
        if (! can_user_interact()) {
            $this->registerPodcastWebpageHit($this->podcast->id);
        }

        $cacheName = implode(
            '_',
            array_filter([
                'page',
                "podcast#{$this->podcast->id}",
                'about',
                service('request')
                    ->getLocale(),
                can_user_interact() ? '_authenticated' : null,
            ]),
        );

        if (! ($cachedView = cache($cacheName))) {
            $data = [
                'podcast' => $this->podcast,
            ];

            // if user is logged in then send to the authenticated activity view
            if (can_user_interact()) {
                helper('form');
                return view('podcast/about_authenticated', $data);
            }

            $secondsToNextUnpublishedEpisode = (new EpisodeModel())->getSecondsToNextUnpublishedEpisode(
                $this->podcast->id,
            );

            return view('podcast/about', $data, [
                'cache' => $secondsToNextUnpublishedEpisode
                    ? $secondsToNextUnpublishedEpisode
                    : DECADE,
                'cache_name' => $cacheName,
            ]);
        }

        return $cachedView;
    }

    public function episodes(): string
    {
        // Prevent analytics hit when authenticated
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ if (! function_exists('render_page_links')) {
            'class' => 'px-2 py-1 underline hover:no-underline',
        ]);
        $links .= anchor(route_to('map'), lang('Page.map'), [
            'class' => 'px-2 underline hover:no-underline',
            'class' => 'px-2 py-1 underline hover:no-underline',
        ]);
        foreach ($pages as $page) {
            $links .= anchor($page->link, $page->title, [
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ return [
    }',
    'activity' => 'Activity',
    'episodes' => 'Episodes',
    'about' => 'About',
    'sponsor_title' => 'Enjoying the show?',
    'sponsor' => 'Sponsor',
    'funding_links' => 'Funding links for {podcastTitle}',
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ return [
    }',
    'activity' => 'Activité',
    'episodes' => 'Épisodes',
    'about' => 'About',
    'sponsor_title' => 'Vous aimez le podcast ?',
    'sponsor' => 'Soutenez-nous',
    'funding_links' => 'Liens de financement pour {podcastTitle}',
Loading