Commit 93214007 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat: redesign public podcast and episode pages + remove any information clutter for better ux

- add About podcast page
- use different layout for episode pages
- improve on user feedback with
design
- restructure app theme folders
- update js packages to latest versions
parent e3bd9df0
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -114,6 +114,9 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
                ],
            ],
        ]);
        $routes->get('activity', 'EpisodeController::activity/$1/$2', [
            'as' => 'episode-activity',
        ]);
        $routes->options('comments', 'ActivityPubController::preflight');
        $routes->get('comments', 'EpisodeController::comments/$1/$2', [
            'as' => 'episode-comments',
@@ -128,7 +131,7 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
            ],
        ]);
        $routes->get('comments/(:uuid)', 'EpisodeCommentController::view/$1/$2/$3', [
            'as' => 'comment',
            'as' => 'episode-comment',
            'application/activity+json' => [
                'controller-method' => 'EpisodeController::commentObject/$1/$2',
            ],
@@ -140,10 +143,10 @@ $routes->group('@(:podcastHandle)', function ($routes): void {
            ],
        ]);
        $routes->get('comments/(:uuid)/replies', 'EpisodeCommentController::replies/$1/$2/$3', [
            'as' => 'comment-replies',
            'as' => 'episode-comment-replies',
        ]);
        $routes->post('comments/(:uuid)/like', 'EpisodeCommentController::attemptLike/$1/$2/$3', [
            'as' => 'comment-attempt-like',
            'as' => 'episode-comment-attempt-like',
        ]);
        $routes->get('oembed.json', 'EpisodeController::oembedJSON/$1/$2', [
            'as' => 'episode-oembed-json',
+1 −2
Original line number Diff line number Diff line
@@ -104,9 +104,8 @@ class EpisodeCommentController extends BaseController
            // if user is logged in then send to the authenticated activity view
            if (can_user_interact()) {
                helper('form');
                return view('podcast/comment_authenticated', $data);
            }
            return view('podcast/comment', $data, [
            return view('episode/comment', $data, [
                'cache' => DECADE,
                'cache_name' => $cacheName,
            ]);
+39 −2
Original line number Diff line number Diff line
@@ -87,10 +87,47 @@ class EpisodeController extends BaseController

            if (can_user_interact()) {
                helper('form');
                return view('podcast/episode_authenticated', $data);
            }
            // The page cache is set to a decade so it is deleted manually upon podcast update
            return view('podcast/episode', $data, [
            return view('episode/comments', $data, [
                'cache' => $secondsToNextUnpublishedEpisode
                    ? $secondsToNextUnpublishedEpisode
                    : DECADE,
                'cache_name' => $cacheName,
            ]);
        }

        return $cachedView;
    }

    public function activity(): string
    {
        // Prevent analytics hit when authenticated
        if (! can_user_interact()) {
            $this->registerPodcastWebpageHit($this->episode->podcast_id);
        }

        $locale = service('request')
            ->getLocale();
        $cacheName =
            "page_podcast#{$this->podcast->id}_episode#{$this->episode->id}_{$locale}" .
            (can_user_interact() ? '_authenticated' : '');

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

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

            if (can_user_interact()) {
                helper('form');
            }
            // The page cache is set to a decade so it is deleted manually upon podcast update
            return view('episode/activity', $data, [
                'cache' => $secondsToNextUnpublishedEpisode
                    ? $secondsToNextUnpublishedEpisode
                    : DECADE,
+1 −8
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ class PodcastController extends BaseController
            // if user is logged in then send to the authenticated activity view
            if (can_user_interact()) {
                helper('form');
                return view('podcast/activity_authenticated', $data);
            }

            $secondsToNextUnpublishedEpisode = (new EpisodeModel())->getSecondsToNextUnpublishedEpisode(
@@ -129,10 +128,9 @@ class PodcastController extends BaseController
                'podcast' => $this->podcast,
            ];

            // if user is logged in then send to the authenticated activity view
            // // 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(
@@ -256,11 +254,6 @@ class PodcastController extends BaseController
            $secondsToNextUnpublishedEpisode = (new EpisodeModel())->getSecondsToNextUnpublishedEpisode(
                $this->podcast->id,
            );

            // if user is logged in then send to the authenticated episodes view
            if (can_user_interact()) {
                return view('podcast/episodes_authenticated', $data);
            }
            return view('podcast/episodes', $data, [
                'cache' => $secondsToNextUnpublishedEpisode
                    ? $secondsToNextUnpublishedEpisode
+2 −3
Original line number Diff line number Diff line
@@ -88,9 +88,8 @@ class PostController extends FediversePostController
            // if user is logged in then send to the authenticated activity view
            if (can_user_interact()) {
                helper('form');
                return view('podcast/post_authenticated', $data);
            }
            return view('podcast/post', $data, [
            return view('post/post', $data, [
                'cache' => DECADE,
                'cache_name' => $cacheName,
            ]);
@@ -242,7 +241,7 @@ class PostController extends FediversePostController

            helper('form');

            return view('podcast/post_remote_action', $data, [
            return view('post/remote_action', $data, [
                'cache' => DECADE,
                'cache_name' => $cacheName,
            ]);
Loading