Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment Styling #2510

Merged
merged 11 commits into from
Jun 27, 2019
Merged

Comment Styling #2510

merged 11 commits into from
Jun 27, 2019

Conversation

NetOpWibby
Copy link
Contributor

PR Checklist

  • I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
  • I have checked that this PR does not introduce a breaking change

PR Type

What kind of change does this PR introduce?

  • Feature
  • Code style update (formatting)

Fixes

What is the current behavior?

Comments are not styled.

What is the new behavior?

Comments are styled.

@jessopb jessopb force-pushed the redux-comments branch 2 times, most recently from 9e6909e to da5c17d Compare June 17, 2019 01:29
@jessopb jessopb mentioned this pull request Jun 17, 2019
@jessopb jessopb assigned jessopb and unassigned NetOpWibby Jun 17, 2019
@kauffj kauffj requested a review from neb-b June 17, 2019 19:13
@kauffj kauffj requested review from kauffj and neb-b and removed request for neb-b June 17, 2019 19:13
@lbry-bot lbry-bot assigned kauffj and neb-b and unassigned neb-b Jun 17, 2019
Copy link

@neb-b neb-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it seems to work pretty good.

const { createComment, claim } = props;
const { claim_id: claimId } = claim;
const [commentValue, setCommentValue] = usePersistedState(`comment-${claimId}`, '');
const [commentAck, setCommentAck] = usePersistedState(COMMENT_ACKNOWLEDGED, 'no');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 'no', this can just be a boolean

<div className="media__title">About comments..</div>
</div>
<div className="card__content">
<div className="media__subtitle">Seriously, don&apos;t comment.</div>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need a title along with this? I guess it depends on what that messaging ends up being.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kauffj was going to do some copy for this section.

}
}

class Comment extends React.PureComponent<CommentProps> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment should be broken into it's own file. Then in CommentsList, pass commentId that can be used to select the comment.

Then if we ever require more data to display a comment, we only have to update one place, instead of having to pass another prop to it in this file

@@ -31,14 +31,14 @@ class FileDetails extends PureComponent<Props> {
Lbryio.call('user_tag', 'edit', { add: 'comments-waitlist' });
showSnackBar(
<span>
{__('Thanks! Comments are coming soon')}
{__('Your Comment Has Been Posted')}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole thing can just be removed. We don't need to show a snackbar

@@ -17,3 +17,5 @@ export const AUTOPLAY = 'autoplay';
export const RESULT_COUNT = 'resultCount';
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
export const AUTO_DOWNLOAD = 'autoDownload';
export const COMMENT_ACKNOWLEDGED = 'comment_acknowledged';
export const COMMENT_ACKNOWLEDGED_TRUE = 'comment_acknowledged_true';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this

<h2 className="card__header">Comments</h2>
</header>
<CommentCreate uri={uri} />
<CommentsList uri={uri} />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -28,6 +28,7 @@ export const selectUpdateUrl = createSelector(
}
);

// HERE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

width: 0; height: 0;
transition: border-color 0.2s;

&.downvote {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not doing upvotes/downvotes. The only time I can see that is if when move to using claims as comments, we can count supports with say, 10 confirmations as being upvotes.

osilkin98 added a commit to osilkin98/lbry-desktop that referenced this pull request Jun 25, 2019
Copy link
Member

@kauffj kauffj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggested changes, but nothing strong.

This review was inspection only until issues introduced by rebase are addressed.

};

export function CommentCreate(props: Props) {
const COMMENT_ACKNOWLEDGED = 'COMMENT_ACKNOWLEDGED';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am all for consting all special values, but this one could probably be skipped


return (
<React.Fragment>
{commentAck !== true && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if commentAck is false it looks like this returns nothing, so this could probably be tidied down to one check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's false, it shows you the acknowledgment box.
if it's true, it shows you the commenting tool.

setCommentAck(true);
}
function handleSubmit() {
if (channel !== 'new' && commentValue.length) createComment(commentValue, claimId, channel);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new here is a value that comes from <ChannelSection>, which is the right time to use a const (otherwise, when editing ChannelSection, I'd have to check every place it is embedded and manually read all of that code to see if "new" is being used or checked against).

return (
<li className={this.props.parentId ? 'comment reply' : 'comment'}>
<div className="comment__meta card__actions--between">
{this.props.author && <strong>{this.props.author}</strong>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<strong>{this.props.author ? this.props.author : __("Anonymous") }</strong>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(note i18n call as well as simplification)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this

{this.props.author}

in place of

  <Button className="button--uri-indicator" navigate={this.props.uri}>
          {inner}
 </Button>
  );
}

The schema you're using is a little out of date, you may want to compare it with the one I have on my branch

src/ui/component/commentsList/view.jsx Outdated Show resolved Hide resolved
@@ -373,7 +373,7 @@ export function doChangeVolume(volume) {
});
};
}

// HERE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intended?

src/ui/redux/reducers/app.js Outdated Show resolved Hide resolved
.comment {
padding-bottom: var(--spacing-vertical-large);

&.reply {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be the class comment--reply and be a first-class rule (i.e. not nested) if we're following BEM

src/ui/scss/component/_comments.scss Outdated Show resolved Hide resolved
@@ -76,7 +76,7 @@ class FileViewer extends React.PureComponent<Props> {
}

this.handleAutoplay(this.props);
window.addEventListener('keydown', this.handleKeyDown);
// window.addEventListener('keydown', this.handleKeyDown);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this functionality being removed? maybe comment out the function too and explain why if it's anticipated that it returns?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jessopb I'm fixing most of my own comments but I don't know what or why this was changed, so I'm leaving as is

@lbry-bot lbry-bot assigned NetOpWibby and unassigned kauffj Jun 26, 2019
@neb-b neb-b merged commit d7b4e91 into master Jun 27, 2019
@lyoshenka lyoshenka deleted the redux-comments branch August 5, 2019 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants