diff options
author | Vitaly Takmazov | 2018-06-20 10:15:31 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:52 +0300 |
commit | fd18ac5cd96f76a39de57bb6a877d3f0faf7c528 (patch) | |
tree | 21744e1a82b15213793b3b81489afa02d5a776f5 /vnext/src/components/Thread.js | |
parent | 95f9a337435091188b02d4545b7507f47fef34cc (diff) |
refactoring
Diffstat (limited to 'vnext/src/components/Thread.js')
-rw-r--r-- | vnext/src/components/Thread.js | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index 4cf36747..6830a821 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -4,6 +4,7 @@ import * as qs from 'query-string'; import moment from 'moment'; import Message from './Message'; +import MessageInput from './MessageInput'; import Spinner from './Spinner'; import Avatar from './Avatar'; @@ -60,25 +61,8 @@ export default class Thread extends React.Component { { this.loaded() ? ( <Message data={msg} visitor={this.props.visitor}> - <form className="msg-comment-target"> - <input type="hidden" name="mid" value={msg.mid} /> - <div className="msg-comment"> - <div className="ta-wrapper"> - <textarea name="body" rows="1" className="reply" placeholder="Write a comment..."></textarea> - </div> - </div> - </form> - { - msg.recommendations && ( - <div className="msg-recomms">{`Recommended by (${msg.recommendations.length}): `} - { - msg.recommendations.map(it => ( - <Link to={`/${it}/`}>{it}</Link> - )).reduce((prev, curr) => [prev, ', ', curr]) - } - </div> - ) - } + <MessageInput data={msg} /> + <Recommendations src={msg.recommendations} /> </Message> ) : ( <Spinner /> @@ -159,6 +143,18 @@ export default class Thread extends React.Component { } </React.Fragment> ) - } } + +function Recommendations(props) { + const recomms = props.src; + return recomms && ( + <div className="msg-recomms">{`Recommended by (${recomms.length}): `} + { + recomms.map(it => ( + <Link key={it} to={`/${it}/`}>{it}</Link> + )).reduce((prev, curr) => [prev, ', ', curr]) + } + </div> + ) || null; +} |