From 80fcc5870dc14f61ada7054bd5b22ee8cebb8d73 Mon Sep 17 00:00:00 2001
From: "Tom (plebeius.eth)"
Date: Mon, 11 Nov 2024 12:51:43 +0100
Subject: [PATCH] fix(post): expand button didn't appear for text with webpage
link
---
src/components/post/expand-button/expand-button.tsx | 6 +++++-
src/components/post/post.tsx | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/components/post/expand-button/expand-button.tsx b/src/components/post/expand-button/expand-button.tsx
index 2d168d9f..742843c5 100644
--- a/src/components/post/expand-button/expand-button.tsx
+++ b/src/components/post/expand-button/expand-button.tsx
@@ -11,7 +11,11 @@ interface ExpandButtonProps {
}
const ExpandButton = ({ commentMediaInfo, content, expanded, hasThumbnail, link, toggleExpanded }: ExpandButtonProps) => {
- const initialButtonType = hasThumbnail || commentMediaInfo?.type === 'audio' || commentMediaInfo?.type === 'iframe' ? 'playButton' : 'textButton';
+ let initialButtonType = hasThumbnail || commentMediaInfo?.type === 'audio' || commentMediaInfo?.type === 'iframe' ? 'playButton' : 'textButton';
+
+ if (commentMediaInfo?.type === 'webpage' && content && content.trim().length > 0) {
+ initialButtonType = 'textButton';
+ }
const buttonType = expanded ? 'closeButton' : initialButtonType;
diff --git a/src/components/post/post.tsx b/src/components/post/post.tsx
index ef7c1d8f..7c517d96 100644
--- a/src/components/post/post.tsx
+++ b/src/components/post/post.tsx
@@ -237,11 +237,11 @@ const Post = ({ index, post = {} }: PostProps) => {
)}
- {!isInPostView && commentMediaInfo?.type !== 'webpage' && (
+ {!isInPostView && (!(commentMediaInfo?.type === 'webpage') || (commentMediaInfo?.type === 'webpage' && content?.trim().length > 0)) && (