diff options
author | Vitaly Takmazov | 2019-06-25 13:08:31 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:55 +0300 |
commit | cb5240d00c19cb6c2266438fb7974c98c4d52bc4 (patch) | |
tree | db2a3cf4d9239a5b5473076a7d0fb5fa8bcb412c | |
parent | 7bb3c7cf18ee11ce7c7d779e597b4c014375aeda (diff) |
Thread: hide empty replies block
-rw-r--r-- | vnext/src/ui/Thread.js | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js index 734e5698..f965e80c 100644 --- a/vnext/src/ui/Thread.js +++ b/vnext/src/ui/Thread.js @@ -79,25 +79,25 @@ function Comment({ msg, draft, visitor, active, setActive, onStartEditing, postC active === msg.rid && <MessageInput data={msg} text={draft || ''} onSend={postComment}>Write a comment...</MessageInput> } <div className="msg-links"> - { - visitor.uid > 0 ? ( - <> - {active === msg.rid || <span style={linkStyle} onClick={() => setActive(msg.rid)}>Reply</span>} - { - visitor.uid == msg.user.uid && - <> - <span> · </span> - <span style={linkStyle} onClick={() => onStartEditing(msg)}>Edit</span> - </> - } - </> - ) : ( + { + visitor.uid > 0 ? ( + <> + {active === msg.rid || <span style={linkStyle} onClick={() => setActive(msg.rid)}>Reply</span>} + { + visitor.uid == msg.user.uid && <> - <span> · </span>{active === msg.rid || <Button>Reply</Button>} + <span> · </span> + <span style={linkStyle} onClick={() => onStartEditing(msg)}>Edit</span> </> - ) - } - </div> + } + </> + ) : ( + <> + <span> · </span>{active === msg.rid || <Button>Reply</Button>} + </> + ) + } + </div> </div> ); } @@ -192,19 +192,21 @@ export default function Thread(props) { <Spinner /> ) } - <ul id="replies"> - { - !loading ? replies.map((msg) => ( - <li id={msg.rid} key={msg.rid}> - <Comment msg={msg} draft={msg.rid === editing.replyto ? editing.body : ''} visitor={props.visitor} active={active} setActive={setActive} onStartEditing={startEditing} postComment={postComment} /> - </li> - )) : ( - <> - {Array(loaders).fill().map((it, i) => <Spinner key={i} />)} - </> - ) - } - </ul> + { + message.replies && <ul id="replies"> + { + !loading ? replies.map((msg) => ( + <li id={msg.rid} key={msg.rid}> + <Comment msg={msg} draft={msg.rid === editing.replyto ? editing.body : ''} visitor={props.visitor} active={active} setActive={setActive} onStartEditing={startEditing} postComment={postComment} /> + </li> + )) : ( + <> + {Array(loaders).fill().map((it, i) => <Spinner key={i} />)} + </> + ) + } + </ul> + } </> ); } |