Removed some redundant code.

This commit is contained in:
Dessalines 2019-04-24 20:57:07 -07:00
parent f02c2ffac8
commit 8da8846024

View file

@ -67,21 +67,23 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</div> </div>
</div> </div>
{post.url && isImage(post.url) && {post.url && isImage(post.url) &&
<span class="pointer" onClick={linkEvent(this, this.handleImageExpandClick)}><img class="mx-2 float-left img-fluid thumbnail rounded" src={post.url} /></span> <span title="Expand here" class="pointer" onClick={linkEvent(this, this.handleImageExpandClick)}><img class="mx-2 float-left img-fluid thumbnail rounded" src={post.url} /></span>
} }
<div className="ml-4"> <div className="ml-4">
{post.url <div>
? <div className="mb-0"> <h5 className="mb-0 d-inline"><Link className="text-white" to={`/post/${post.id}`}>{post.name}</Link></h5>
<h5 className="d-inline"><a className="text-white" href={post.url} target="_blank" title={post.url}>{post.name}</a> {post.url &&
<small>
<a className="ml-2 text-muted font-italic" href={post.url} target="_blank" title={post.url}>{(new URL(post.url)).hostname}</a>
</small>
}
{post.removed && {post.removed &&
<small className="ml-2 text-muted font-italic">removed</small> <small className="ml-2 text-muted font-italic">removed</small>
} }
{post.locked && {post.locked &&
<small className="ml-2 text-muted font-italic">locked</small> <small className="ml-2 text-muted font-italic">locked</small>
} }
</h5> { post.url && isImage(post.url) &&
<small><a className="ml-2 text-muted font-italic" href={post.url} title={post.url}>{(new URL(post.url)).hostname}</a></small>
{ isImage(post.url) &&
<> <>
{ !this.state.imageExpanded { !this.state.imageExpanded
? <span class="badge badge-light pointer ml-2 text-muted small" title="Expand here" onClick={linkEvent(this, this.handleImageExpandClick)}>+</span> ? <span class="badge badge-light pointer ml-2 text-muted small" title="Expand here" onClick={linkEvent(this, this.handleImageExpandClick)}>+</span>
@ -96,15 +98,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</> </>
} }
</div> </div>
: <h5 className="mb-0"><Link className="text-white" to={`/post/${post.id}`}>{post.name}</Link>
{post.removed &&
<small className="ml-2 text-muted font-italic">removed</small>
}
{post.locked &&
<small className="ml-2 text-muted font-italic">locked</small>
}
</h5>
}
</div> </div>
<div className="details ml-4 mb-1"> <div className="details ml-4 mb-1">
<ul class="list-inline mb-0 text-muted small"> <ul class="list-inline mb-0 text-muted small">