aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-05 12:41:05 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit688006ed8ef24378d9033879fab12621db551e5a (patch)
tree07fda4b348461b666dcddf67daf13347a28032a7 /vnext
parent8c768c19ce3e3b7bb61344cc8c77a54e10641c6d (diff)
Do not show empty tags
Diffstat (limited to 'vnext')
-rw-r--r--vnext/src/components/Message.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js
index 273e035c..509cae42 100644
--- a/vnext/src/components/Message.js
+++ b/vnext/src/components/Message.js
@@ -20,16 +20,14 @@ export default function Message({ data, visitor, children, ...rest }) {
</span>
<Avatar user={data.user} />
<div className="msg-ts">
- <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: {msg: data} }}>
+ <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: { msg: data } }}>
<time itemProp="datePublished dateModified" itemType="http://schema.org/Date" dateTime={data.timestamp}
title={moment.utc(data.timestamp).local().format('lll')}>
{moment.utc(data.timestamp).fromNow()}
</time>
</Link>
</div>
- <div className="msg-tags" itemProp="headline">
- <Tags user={data.user} data={data.tags || []} />
- </div>
+ <Tags user={data.user} data={data.tags || []} />
</header>
<div className="msg-txt">
<p itemProp="description" dangerouslySetInnerHTML={{ __html: format(data.body, data.mid, (data.tags || []).indexOf('code') >= 0) }}></p>
@@ -49,7 +47,7 @@ export default function Message({ data, visitor, children, ...rest }) {
<span>&nbsp;Recommend</span>
</a>
) : visitor.uid > 0 ? (
- <Link to={{pathname: "/post", search: `?body=!+%23${data.mid}`}} className="a-like msg-button">
+ <Link to={{ pathname: "/post", search: `?body=!+%23${data.mid}` }} className="a-like msg-button">
<span className="msg-button-icon">
<Icon name="ei-heart" size="s" />
{data.likes > 0 && (` ${data.likes}`)}
@@ -67,7 +65,7 @@ export default function Message({ data, visitor, children, ...rest }) {
)}
{!Boolean(data.ReadOnly) | (visitor.uid === data.user.uid) && (
<React.Fragment>
- <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: {msg: data} }} className="a-comment msg-button">
+ <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: { msg: data } }} className="a-comment msg-button">
<span className="msg-button-icon">
<Icon name="ei-comment" size="s" />
{data.replies > 0 &&
@@ -90,15 +88,21 @@ export default function Message({ data, visitor, children, ...rest }) {
<a href="#" className="a-privacy">Открыть доступ</a>
)}
</nav>
- { children }
+ {children}
</div>
);
}
-function Tags({ data, user, ...rest}) {
- return data && data.map(tag => {
- return (<Link key={tag} to={{ pathname: `/${user.uname}`, search: `?tag=${tag}` }} title={tag}>{tag}</Link>)
- })
+function Tags({ data, user, ...rest }) {
+ return data.length > 0 && (
+ <div className="msg-tags" itemProp="headline">
+ {
+ data.map(tag => {
+ return (<Link key={tag} to={{ pathname: `/${user.uname}`, search: `?tag=${tag}` }} title={tag}>{tag}</Link>)
+ })
+ }
+ </div>
+ );
}
Message.propTypes = {