From d0f9c6018f1af527099f3e26b5d824710fa11caf Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Fri, 22 Oct 2021 14:35:11 +0000 Subject: [PATCH] feat: add replied to post or comment to reply element --- app/Entities/EpisodeComment.php | 7 +++++ app/Resources/styles/custom.css | 6 ++++ app/Resources/styles/index.css | 1 - app/Resources/styles/post.css | 22 --------------- themes/cp_admin/episode/publish.php | 4 +-- themes/cp_admin/episode/publish_edit.php | 4 +-- themes/cp_app/episode/_partials/comment.php | 4 +-- .../cp_app/episode/_partials/comment_card.php | 4 +-- .../episode/_partials/comment_reply.php | 4 +-- .../_partials/comment_reply_actions.php | 4 +-- .../_partials/comment_with_replies.php | 28 ++++++++++++++----- themes/cp_app/episode/activity.php | 7 ++--- themes/cp_app/episode/comments.php | 7 ++--- themes/cp_app/podcast/activity.php | 4 +-- themes/cp_app/post/_partials/card.php | 4 +-- .../post/_partials/post_with_replies.php | 17 +++++++++-- themes/cp_app/post/_partials/reblog.php | 4 +-- themes/cp_app/post/_partials/reply.php | 4 +-- .../cp_app/post/_partials/reply_actions.php | 26 ++++++++--------- 19 files changed, 88 insertions(+), 73 deletions(-) delete mode 100644 app/Resources/styles/post.css diff --git a/app/Entities/EpisodeComment.php b/app/Entities/EpisodeComment.php index b7670d82..d30e3c5a 100644 --- a/app/Entities/EpisodeComment.php +++ b/app/Entities/EpisodeComment.php @@ -47,6 +47,8 @@ class EpisodeComment extends UuidEntity */ protected ?array $replies = null; + protected bool $has_replies = false; + /** * @var string[] */ @@ -115,6 +117,11 @@ class EpisodeComment extends UuidEntity return $this->replies; } + public function getHasReplies(): bool + { + return $this->getReplies() !== null; + } + public function getReplyToComment(): ?self { if ($this->in_reply_to_id === null) { diff --git a/app/Resources/styles/custom.css b/app/Resources/styles/custom.css index e229f820..8f5fabad 100644 --- a/app/Resources/styles/custom.css +++ b/app/Resources/styles/custom.css @@ -1,4 +1,10 @@ @layer components { + .post-content { + & a { + @apply text-sm font-semibold text-pine-600 hover:underline; + } + } + .ring-castopod { @apply outline-none ring-2 ring-pine-500 ring-offset-2 ring-offset-pine-100; } diff --git a/app/Resources/styles/index.css b/app/Resources/styles/index.css index 7ac86a77..bf5dbe92 100644 --- a/app/Resources/styles/index.css +++ b/app/Resources/styles/index.css @@ -7,7 +7,6 @@ @import "./radioBtn.css"; @import "./switch.css"; @import "./charts.css"; -@import "./post.css"; @import "./radioToggler.css"; @import "./formInputTabs.css"; @import "./stickyHeader.css"; diff --git a/app/Resources/styles/post.css b/app/Resources/styles/post.css deleted file mode 100644 index 966ec606..00000000 --- a/app/Resources/styles/post.css +++ /dev/null @@ -1,22 +0,0 @@ -@layer components { - .post-content { - & a { - @apply text-sm font-semibold text-pine-600 hover:underline; - } - } - - .post-replies > * { - @apply relative; - - & img { - @apply z-20; - } - - &:not(:last-child)::before { - @apply absolute z-10 h-full bg-gray-300 top-8; - content: ""; - left: 3rem; - width: 2px; - } - } -} diff --git a/themes/cp_admin/episode/publish.php b/themes/cp_admin/episode/publish.php index a149e6f4..11af5a63 100644 --- a/themes/cp_admin/episode/publish.php +++ b/themes/cp_admin/episode/publish.php @@ -27,8 +27,8 @@ ) ?>
-
- <?= $podcast->actor->display_name ?> +
+ <?= $podcast->actor->display_name ?>

actor->display_name ?> diff --git a/themes/cp_admin/episode/publish_edit.php b/themes/cp_admin/episode/publish_edit.php index eff01066..cd6de4b5 100644 --- a/themes/cp_admin/episode/publish_edit.php +++ b/themes/cp_admin/episode/publish_edit.php @@ -28,8 +28,8 @@ ) ?>

-
- <?= $podcast->actor->display_name ?> +
+ <?= $podcast->actor->display_name ?>

actor->display_name ?> diff --git a/themes/cp_app/episode/_partials/comment.php b/themes/cp_app/episode/_partials/comment.php index bb1624a9..f6700fa4 100644 --- a/themes/cp_app/episode/_partials/comment.php +++ b/themes/cp_app/episode/_partials/comment.php @@ -1,5 +1,5 @@ -

- <?= $comment->display_name ?> +
+ <?= $comment->display_name ?>
- <?= $comment->display_name ?> +
+ <?= $comment->display_name ?>
actor->is_local diff --git a/themes/cp_app/episode/_partials/comment_reply.php b/themes/cp_app/episode/_partials/comment_reply.php index 59b5643f..c14646b5 100644 --- a/themes/cp_app/episode/_partials/comment_reply.php +++ b/themes/cp_app/episode/_partials/comment_reply.php @@ -1,6 +1,6 @@ -
+
<?= $reply->actor
-    ->display_name ?> + ->display_name ?>" class="z-10 w-10 h-10 rounded-full ring-gray-50 ring-2" />
likes_count ?> +) ?>">likes_count ?> @@ -15,7 +15,7 @@ [ 'numberOfLikes' => $reply->likes_count, ], -) ?>">likes_count ?> +) ?>">likes_count ?> replies_count): ?> episode->podcast->handle, $reply->episode->slug, $reply->id), diff --git a/themes/cp_app/episode/_partials/comment_with_replies.php b/themes/cp_app/episode/_partials/comment_with_replies.php index 45b42537..ec96f6f7 100644 --- a/themes/cp_app/episode/_partials/comment_with_replies.php +++ b/themes/cp_app/episode/_partials/comment_with_replies.php @@ -1,11 +1,21 @@ +in_reply_to_id): ?> +
+
+ $comment->reply_to_comment, + ]) ?> +
+ include('episode/_partials/comment_card') ?>
-
+ <?= interact_as_actor()
-    ->display_name ?> + ->display_name ?>" class="w-10 h-10 rounded-full ring-gray-50 ring-2" />
-replies as $reply): ?> - $reply, - ]) ?> - +has_replies): ?> +
+ replies as $reply): ?> + $reply, + ]) ?> + +
+
diff --git a/themes/cp_app/episode/activity.php b/themes/cp_app/episode/activity.php index df14e320..6c5ca3a1 100644 --- a/themes/cp_app/episode/activity.php +++ b/themes/cp_app/episode/activity.php @@ -35,14 +35,13 @@ section('content') ?> - + + - - <?= interact_as_actor()
-            ->display_name ?> + ->display_name ?>" class="w-10 h-10 rounded-full" />
section('content') ?> - + + - - <?= interact_as_actor()
-            ->display_name ?> + ->display_name ?>" class="w-10 h-10 rounded-full" />