summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post-listing.tsx
diff options
context:
space:
mode:
authorAndre Vallestero <andrevallestero@gmail.com>2020-05-07 21:26:08 -0400
committerAndre Vallestero <andrevallestero@gmail.com>2020-05-07 21:26:08 -0400
commitbc8ad12b04a501bf670cc541b20282a791a3aac4 (patch)
treee57f4168a9d27fe42b0af5b114e6e758701c5308 /ui/src/components/post-listing.tsx
parent243dda543cff0015132f8f0cc464a21a4162b096 (diff)
Added externally hosted UI thumbnail support
Diffstat (limited to 'ui/src/components/post-listing.tsx')
-rw-r--r--ui/src/components/post-listing.tsx33
1 files changed, 20 insertions, 13 deletions
diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx
index d0efa043..36a1e282 100644
--- a/ui/src/components/post-listing.tsx
+++ b/ui/src/components/post-listing.tsx
@@ -150,9 +150,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
let post = this.props.post;
return (
<img
- className={`img-fluid thumbnail rounded ${(post.nsfw ||
- post.community_nsfw) &&
- 'img-blur'}`}
+ className={`img-fluid thumbnail rounded ${
+ (post.nsfw || post.community_nsfw) && 'img-blur'
+ }`}
src={src}
/>
);
@@ -163,6 +163,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
if (isImage(post.url)) {
if (post.url.includes('pictshare')) {
return pictshareImage(post.url, thumbnail);
+ } else if (post.thumbnail_url) {
+ return pictshareImage(post.thumbnail_url, thumbnail);
} else {
return post.url;
}
@@ -542,8 +544,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
}
>
<svg
- class={`icon icon-inline ${post.saved &&
- 'text-warning'}`}
+ class={`icon icon-inline ${
+ post.saved && 'text-warning'
+ }`}
>
<use xlinkHref="#icon-star"></use>
</svg>
@@ -586,8 +589,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
}
>
<svg
- class={`icon icon-inline ${post.deleted &&
- 'text-danger'}`}
+ class={`icon icon-inline ${
+ post.deleted && 'text-danger'
+ }`}
>
<use xlinkHref="#icon-trash"></use>
</svg>
@@ -618,8 +622,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
data-tippy-content={i18n.t('view_source')}
>
<svg
- class={`icon icon-inline ${this.state
- .viewSource && 'text-success'}`}
+ class={`icon icon-inline ${
+ this.state.viewSource && 'text-success'
+ }`}
>
<use xlinkHref="#icon-file-text"></use>
</svg>
@@ -639,8 +644,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
}
>
<svg
- class={`icon icon-inline ${post.locked &&
- 'text-danger'}`}
+ class={`icon icon-inline ${
+ post.locked && 'text-danger'
+ }`}
>
<use xlinkHref="#icon-lock"></use>
</svg>
@@ -657,8 +663,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
}
>
<svg
- class={`icon icon-inline ${post.stickied &&
- 'text-success'}`}
+ class={`icon icon-inline ${
+ post.stickied && 'text-success'
+ }`}
>
<use xlinkHref="#icon-pin"></use>
</svg>