Optimizing
This commit is contained in:
parent
6cbade699f
commit
90d2f365c1
5 changed files with 64 additions and 36 deletions
|
@ -46,7 +46,8 @@
|
||||||
"electron-log": "^2.2.12",
|
"electron-log": "^2.2.12",
|
||||||
"electron-updater": "^4.0.6",
|
"electron-updater": "^4.0.6",
|
||||||
"express": "^4.16.4",
|
"express": "^4.16.4",
|
||||||
"keytar": "^4.4.1"
|
"keytar": "^4.4.1",
|
||||||
|
"tiny-relative-date": "^1.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.0.0",
|
||||||
|
|
|
@ -33,11 +33,14 @@ class CommentCreate extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
const { createComment, claim, channelUri } = this.props;
|
// const { createComment, claim, channelUri } = this.props;
|
||||||
console.log('claim', claim)
|
const { channelUri, claim } = this.props; // eslint-disable-line react/prop-types
|
||||||
|
console.log('claim', claim);
|
||||||
|
|
||||||
const { claim_id: claimId } = claim;
|
const { claim_id: claimId } = claim;
|
||||||
const { message } = this.state;
|
const { message } = this.state;
|
||||||
let cmt = { message, channelId: parseURI(channelUri).claimId, claimId };
|
let cmt = { message, channelId: parseURI(channelUri).claimId, claimId };
|
||||||
|
|
||||||
console.log('CMT', cmt);
|
console.log('CMT', cmt);
|
||||||
console.log('PURI', claimId);
|
console.log('PURI', claimId);
|
||||||
console.log('PURI', parseURI(channelUri));
|
console.log('PURI', parseURI(channelUri));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import relativeDate from 'tiny-relative-date';
|
||||||
|
|
||||||
type CommentListProps = {
|
type CommentListProps = {
|
||||||
comments: {},
|
comments: {},
|
||||||
|
@ -20,34 +21,35 @@ class CommentList extends React.PureComponent<CommentListProps> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.fetchComments(this.props);
|
this.fetchComments(this.props);
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchComments = (props: Props) => {
|
fetchComments = (props: Props) => {
|
||||||
const { fetchList, uri } = props;
|
const { fetchList, uri } = props;
|
||||||
fetchList(uri);
|
fetchList(uri);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { comments } = this.props;
|
const { comments } = this.props;
|
||||||
|
|
||||||
if (!comments) {
|
if (!comments) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<ul className="comments">
|
||||||
<ul>
|
{comments['comments'].map(comment => {
|
||||||
{comments['comments'].map(comment => {
|
console.log(comment.message);
|
||||||
console.log(comment.message);
|
return (
|
||||||
return (
|
<Comment
|
||||||
<li key={comment.author + comment.comment_id}>
|
author={comment.author}
|
||||||
<Comment
|
claimId={comment.claim_id}
|
||||||
commentId={comment.comment_id}
|
commentId={comment.comment_id}
|
||||||
claimId={comment.claim_id}
|
key={comment.author + comment.comment_id}
|
||||||
author={comment.author}
|
message={comment.message}
|
||||||
message={comment.message}
|
timePosted={comment.time_posted}
|
||||||
timePosted={comment.time_posted}
|
/>
|
||||||
/>
|
);
|
||||||
</li>
|
})}
|
||||||
);
|
</ul>
|
||||||
})}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,22 +57,23 @@ class CommentList extends React.PureComponent<CommentListProps> {
|
||||||
class Comment extends React.PureComponent<CommentProps> {
|
class Comment extends React.PureComponent<CommentProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<span className="button button--no-style navigation__link card__message">
|
<li className="comment">
|
||||||
<div className="media__info-text">
|
<div className="comment__meta card__actions--between">
|
||||||
<div className="card__actions--between">
|
<div>{this.props.author}</div>
|
||||||
<div>Author: {this.props.author}</div>
|
<time datatime={this.props.timePosted}>{relativeDate(this.props.timePosted)}</time>
|
||||||
<div>Date: {this.props.timePosted}</div>
|
|
||||||
</div>
|
|
||||||
<div className="media__subtitle__channel">Message: {this.props.message}</div>
|
|
||||||
<div className="card__actions--between">
|
|
||||||
<button className={'button button--primary'}>Reply</button>
|
|
||||||
<div>
|
|
||||||
<button className={'button button--primary'}>Up</button>
|
|
||||||
<button className={'button button--primary'}>Down</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</span>
|
|
||||||
|
<div className="comment__content">{this.props.message}</div>
|
||||||
|
|
||||||
|
<div className="comment__actions card__actions--between">
|
||||||
|
<button className={'button button--primary'}>Reply</button>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<button className="comment__action button button--secondary">Up</button>
|
||||||
|
<button className="comment__action button button--secondary">Down</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
@import 'component/button';
|
@import 'component/button';
|
||||||
@import 'component/card';
|
@import 'component/card';
|
||||||
@import 'component/channel';
|
@import 'component/channel';
|
||||||
|
@import 'component/comments';
|
||||||
@import 'component/content';
|
@import 'component/content';
|
||||||
@import 'component/credit';
|
@import 'component/credit';
|
||||||
@import 'component/dat-gui';
|
@import 'component/dat-gui';
|
||||||
|
|
20
src/ui/scss/component/_comments.scss
Normal file
20
src/ui/scss/component/_comments.scss
Normal file
|
@ -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);
|
||||||
|
}
|
Loading…
Reference in a new issue