From bd69d941f1d6c969c693c3d3cbcd36844d77d894 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 29 Jun 2023 09:56:52 -0400 Subject: [PATCH] wip --- src/shared/components/post/post-listing.tsx | 82 ++++++++++++--------- 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 586403be..3ed44de8 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -325,10 +325,11 @@ export class PostListing extends Component { } thumbnail() { - const post = this.postView.post; - const url = post.url; + const { post } = this.postView; + const { url } = post; const thumbnail = post.thumbnail_url; + // if direct image link if (!this.props.hideImage && url && isImage(url) && this.imageSrc) { return ( ); - } else if (!this.props.hideImage && url && thumbnail && this.imageSrc) { + } + + // if link to url with included metadata image + if (!this.props.hideImage && url && thumbnail && this.imageSrc) { return ( { /> ); - } else if (url) { - if ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) { - return ( - -
- -
-
- ); - } else { - return ( - -
- -
-
- ); - } - } else { + } + + // if link to direct/embedded video + if ( + url && + ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) + ) { return ( -
- +
- + ); } + + // if link to url without metadata image + if (url) { + return ( + +
+ +
+
+ ); + } + + // if text-only post + return ( + +
+ +
+ + ); } createdLine() {