aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Thread.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-06-25 13:08:31 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commitcb5240d00c19cb6c2266438fb7974c98c4d52bc4 (patch)
treedb2a3cf4d9239a5b5473076a7d0fb5fa8bcb412c /vnext/src/ui/Thread.js
parent7bb3c7cf18ee11ce7c7d779e597b4c014375aeda (diff)
Thread: hide empty replies block
Diffstat (limited to 'vnext/src/ui/Thread.js')
-rw-r--r--vnext/src/ui/Thread.js62
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>&nbsp;&middot;&nbsp;</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>&nbsp;&middot;&nbsp;</span>{active === msg.rid || <Button>Reply</Button>}
+ <span>&nbsp;&middot;&nbsp;</span>
+ <span style={linkStyle} onClick={() => onStartEditing(msg)}>Edit</span>
</>
- )
- }
- </div>
+ }
+ </>
+ ) : (
+ <>
+ <span>&nbsp;&middot;&nbsp;</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>
+ }
</>
);
}