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

Issue/490 #492

Merged
merged 4 commits into from Apr 24, 2019
Merged

Issue/490 #492

merged 4 commits into from Apr 24, 2019

Conversation

zipofar
Copy link
Collaborator

@zipofar zipofar commented Apr 24, 2019

No description provided.

opponentInGame = () => {
const { opponentPlayer, chatUsers } = this.props;
const findedUser = _.find(chatUsers, user => (opponentPlayer.id === user.id));
return typeof findedUser !== 'undefined';
Copy link
Contributor

Choose a reason for hiding this comment

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

Лучше писать _.isEmpty или isUndefined

@@ -76,6 +87,12 @@ class RematchButton extends React.Component {
</button>
);

opponentInGame = () => {
const { opponentPlayer, chatUsers } = this.props;
const findedUser = _.find(chatUsers, user => (opponentPlayer.id === user.id));
Copy link
Contributor

Choose a reason for hiding this comment

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

Есть еще сокращенная форма у лодаша _.find(chatUsers, {id: opponentPlayer.id});

</button>
);
renderBtnAfterSendOffer = () => {
const text = this.opponentInGame() ? 'Wait Answer...' : 'Opponent Left Game';
Copy link
Contributor

Choose a reason for hiding this comment

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

waiting for an answer opponent left the game

const classNames = cn({
btn: true,
'btn-secondary': this.opponentInGame(),
'btn-warning': !this.opponentInGame(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Лучше вычислить один раз и в переменную положить в начале функции

@imamatory imamatory merged commit b6c21fb into master Apr 24, 2019
@imamatory imamatory deleted the issue/490 branch April 24, 2019 15:22
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.

None yet

2 participants