-
Notifications
You must be signed in to change notification settings - Fork 414
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
Comment Styling #2510
Conversation
9e6909e
to
da5c17d
Compare
There was a problem hiding this 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'); |
There was a problem hiding this comment.
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't comment.</div> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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')} |
There was a problem hiding this comment.
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
src/ui/constants/settings.js
Outdated
@@ -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'; |
There was a problem hiding this comment.
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} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/ui/redux/selectors/app.js
Outdated
@@ -28,6 +28,7 @@ export const selectUpdateUrl = createSelector( | |||
} | |||
); | |||
|
|||
// HERE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here
src/ui/scss/component/_comments.scss
Outdated
width: 0; height: 0; | ||
transition: border-color 0.2s; | ||
|
||
&.downvote { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am all for const
ing all special values, but this one could probably be skipped
|
||
return ( | ||
<React.Fragment> | ||
{commentAck !== true && ( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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>} |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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/redux/actions/app.js
Outdated
@@ -373,7 +373,7 @@ export function doChangeVolume(volume) { | |||
}); | |||
}; | |||
} | |||
|
|||
// HERE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intended?
src/ui/scss/component/_comments.scss
Outdated
.comment { | ||
padding-bottom: var(--spacing-vertical-large); | ||
|
||
&.reply { |
There was a problem hiding this comment.
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
@@ -76,7 +76,7 @@ class FileViewer extends React.PureComponent<Props> { | |||
} | |||
|
|||
this.handleAutoplay(this.props); | |||
window.addEventListener('keydown', this.handleKeyDown); | |||
// window.addEventListener('keydown', this.handleKeyDown); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
PR Checklist
PR Type
What kind of change does this PR introduce?
Fixes
What is the current behavior?
Comments are not styled.
What is the new behavior?
Comments are styled.