diff --git a/package.json b/package.json index c3167a0bd..65d1c29f4 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "electron-log": "^2.2.12", "electron-updater": "^4.0.6", "express": "^4.16.4", - "keytar": "^4.4.1" + "keytar": "^4.4.1", + "tiny-relative-date": "^1.3.0" }, "devDependencies": { "@babel/core": "^7.0.0", diff --git a/src/ui/component/commentCreate/view.jsx b/src/ui/component/commentCreate/view.jsx index 61230a46f..78891b7da 100644 --- a/src/ui/component/commentCreate/view.jsx +++ b/src/ui/component/commentCreate/view.jsx @@ -33,11 +33,14 @@ class CommentCreate extends React.PureComponent { } handleSubmit() { - const { createComment, claim, channelUri } = this.props; - console.log('claim', claim) + // const { createComment, claim, channelUri } = this.props; + const { channelUri, claim } = this.props; // eslint-disable-line react/prop-types + console.log('claim', claim); + const { claim_id: claimId } = claim; const { message } = this.state; let cmt = { message, channelId: parseURI(channelUri).claimId, claimId }; + console.log('CMT', cmt); console.log('PURI', claimId); console.log('PURI', parseURI(channelUri)); diff --git a/src/ui/component/commentsList/view.jsx b/src/ui/component/commentsList/view.jsx index 4d7763085..6378e464c 100644 --- a/src/ui/component/commentsList/view.jsx +++ b/src/ui/component/commentsList/view.jsx @@ -1,5 +1,6 @@ // @flow import * as React from 'react'; +import relativeDate from 'tiny-relative-date'; type CommentListProps = { comments: {}, @@ -20,34 +21,35 @@ class CommentList extends React.PureComponent { componentDidMount() { this.fetchComments(this.props); } + fetchComments = (props: Props) => { const { fetchList, uri } = props; fetchList(uri); }; + render() { const { comments } = this.props; + if (!comments) { return null; } + return ( -
-
    - {comments['comments'].map(comment => { - console.log(comment.message); - return ( -
  • - -
  • - ); - })} -
-
+ ); } } @@ -55,22 +57,23 @@ class CommentList extends React.PureComponent { class Comment extends React.PureComponent { render() { return ( - -
-
-
Author: {this.props.author}
-
Date: {this.props.timePosted}
-
-
Message: {this.props.message}
-
- -
- - -
-
+
  • +
    +
    {this.props.author}
    +
    - + +
    {this.props.message}
    + +
    + + + + + + +
    +
  • ); } } diff --git a/src/ui/scss/all.scss b/src/ui/scss/all.scss index b14ebd8d8..be0187dfa 100644 --- a/src/ui/scss/all.scss +++ b/src/ui/scss/all.scss @@ -13,6 +13,7 @@ @import 'component/button'; @import 'component/card'; @import 'component/channel'; +@import 'component/comments'; @import 'component/content'; @import 'component/credit'; @import 'component/dat-gui'; diff --git a/src/ui/scss/component/_comments.scss b/src/ui/scss/component/_comments.scss new file mode 100644 index 000000000..7aba0c141 --- /dev/null +++ b/src/ui/scss/component/_comments.scss @@ -0,0 +1,20 @@ +.comments { +} + +.comment { + padding-bottom: var(--spacing-vertical-large); + + &:not(:first-of-type) { + padding-top: var(--spacing-vertical-large); + } + + &:not(:last-of-type) { + border-bottom: 1px solid $lbry-gray-1; + } +} + +.comment__content { + font-size: 1.15rem; + padding-top: var(--spacing-vertical-medium); + padding-bottom: var(--spacing-vertical-medium); +}