diff --git a/src/ui/component/comment/index.js b/src/ui/component/comment/index.js new file mode 100644 index 000000000..ec92bc310 --- /dev/null +++ b/src/ui/component/comment/index.js @@ -0,0 +1,7 @@ +import { connect } from 'react-redux'; +import Comment from './view'; + +export default connect( + null, + null +)(Comment); diff --git a/src/ui/component/comment/view.jsx b/src/ui/component/comment/view.jsx new file mode 100644 index 000000000..096f35642 --- /dev/null +++ b/src/ui/component/comment/view.jsx @@ -0,0 +1,36 @@ +// @flow +import React from 'react'; +import relativeDate from 'tiny-relative-date'; + +type Props = { + author: string, + message: string, + timePosted: number, +}; + +function Comment(props: Props) { + const { author, timePosted, message } = props; + + return ( +
  • +
    + {author || __('Anonymous')} + + +
    + +

    {message}

    + {/* The following is for adding threaded replies, upvoting and downvoting */} + {/*
    */} + {/* */} + + {/* */} + {/* */} + {/* */} + {/* */} + {/*
    */} +
  • + ); +} + +export default Comment; diff --git a/src/ui/component/commentCreate/view.jsx b/src/ui/component/commentCreate/view.jsx index bf2d51cc7..f0da4d393 100644 --- a/src/ui/component/commentCreate/view.jsx +++ b/src/ui/component/commentCreate/view.jsx @@ -1,11 +1,11 @@ // @flow +import { CHANNEL_NEW } from 'constants/claim'; import React from 'react'; import { FormField, Form } from 'component/common/form'; import Button from 'component/button'; import ChannelSection from 'component/selectChannel'; import usePersistedState from 'util/use-persisted-state'; -// props: type Props = { uri: string, claim: StreamClaim, @@ -13,12 +13,11 @@ type Props = { }; export function CommentCreate(props: Props) { - const COMMENT_ACKNOWLEDGED = 'COMMENT_ACKNOWLEDGED'; const { createComment, claim } = props; const { claim_id: claimId } = claim; const [commentValue, setCommentValue] = usePersistedState(`comment-${claimId}`, ''); - const [commentAck, setCommentAck] = usePersistedState(COMMENT_ACKNOWLEDGED, false); - const [channel, setChannel] = usePersistedState('COMMENT_CHANNEL', 'anonymous'); + const [commentAck, setCommentAck] = usePersistedState('comment-acknowledge', false); + const [channel, setChannel] = usePersistedState('comment-channel', 'anonymous'); function handleCommentChange(event) { setCommentValue(event.target.value); @@ -32,19 +31,19 @@ export function CommentCreate(props: Props) { setCommentAck(true); } function handleSubmit() { - if (channel !== 'new' && commentValue.length) createComment(commentValue, claimId, channel); + if (channel !== CHANNEL_NEW && commentValue.length) createComment(commentValue, claimId, channel); setCommentValue(''); } return ( {commentAck !== true && ( -
    +
    About comments..
    -
    Seriously, don't comment.
    +
    I acknowledge something.
    )} {commentAck === true && ( -
    +
    -
    +
    */} - - {/* */} - {/* */} - {/* */} - {/* */} - {/*
    */} - - ); - } + return ( +
      + {comments && + comments.map(comment => { + return ( + + ); + })} +
    + ); } export default CommentList; diff --git a/src/ui/component/common/form-components/form-field.jsx b/src/ui/component/common/form-components/form-field.jsx index 17deb99ca..37a9e55e2 100644 --- a/src/ui/component/common/form-components/form-field.jsx +++ b/src/ui/component/common/form-components/form-field.jsx @@ -154,6 +154,7 @@ export class FormField extends React.PureComponent { } else if (type === 'textarea') { input = ( +