Compare commits

...

1 commit

Author SHA1 Message Date
Alec Armbruster
bd69d941f1
wip 2023-06-29 09:56:52 -04:00

View file

@ -325,10 +325,11 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
} }
thumbnail() { thumbnail() {
const post = this.postView.post; const { post } = this.postView;
const url = post.url; const { url } = post;
const thumbnail = post.thumbnail_url; const thumbnail = post.thumbnail_url;
// if direct image link
if (!this.props.hideImage && url && isImage(url) && this.imageSrc) { if (!this.props.hideImage && url && isImage(url) && this.imageSrc) {
return ( return (
<button <button
@ -345,7 +346,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
/> />
</button> </button>
); );
} 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 ( return (
<a <a
className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0" className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0"
@ -360,8 +364,13 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
/> />
</a> </a>
); );
} else if (url) { }
if ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) {
// if link to direct/embedded video
if (
url &&
((!this.props.hideImage && isVideo(url)) || post.embed_video_url)
) {
return ( return (
<a <a
className="text-body" className="text-body"
@ -377,7 +386,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</div> </div>
</a> </a>
); );
} else { }
// if link to url without metadata image
if (url) {
return ( return (
<a className="text-body" href={url} title={url} rel={relTags}> <a className="text-body" href={url} title={url} rel={relTags}>
<div className="thumbnail rounded bg-light d-flex justify-content-center"> <div className="thumbnail rounded bg-light d-flex justify-content-center">
@ -386,7 +398,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</a> </a>
); );
} }
} else {
// if text-only post
return ( return (
<Link <Link
className="text-body" className="text-body"
@ -399,7 +412,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</Link> </Link>
); );
} }
}
createdLine() { createdLine() {
const post_view = this.postView; const post_view = this.postView;