fix(post): expand button didn't appear for text with webpage link

This commit is contained in:
Tom (plebeius.eth)
2024-11-11 12:51:43 +01:00
parent b367051624
commit 80fcc5870d
2 changed files with 7 additions and 3 deletions

View File

@@ -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;

View File

@@ -237,11 +237,11 @@ const Post = ({ index, post = {} }: PostProps) => {
</span>
)}
</p>
{!isInPostView && commentMediaInfo?.type !== 'webpage' && (
{!isInPostView && (!(commentMediaInfo?.type === 'webpage') || (commentMediaInfo?.type === 'webpage' && content?.trim().length > 0)) && (
<ExpandButton
commentMediaInfo={commentMediaInfo}
content={content}
expanded={commentMediaInfo?.type === 'webpage' ? false : isExpanded}
expanded={isExpanded}
hasThumbnail={hasThumbnail}
link={link}
toggleExpanded={toggleExpanded}