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

Show timer also for spectator #44

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

ChristophNiehoff
Copy link
Contributor

Also the spectator should be able to see the timer.

Copy link
Contributor

@ghost91- ghost91- left a comment

Choose a reason for hiding this comment

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

Looks good, just a tiny suggestion for improvement 👍

@@ -98,6 +98,8 @@ class Board extends React.Component {
this.props.ctx.activePlayers[this.props.playerID] === 'threats'
? true
: false;
// If this.props.playerID is unset, then we are in spectator mode and check whether the first player is in threat stage.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could introduce some descriptive functions instead of the comment. Something like:

const isSpectator = () => !!this.props.playerID;
const isFirstPlayerInThreatStage = () => this.props.ctx.activePlayers?.[0] === 'threats';

const shouldShowTimer = isInThreatStage || (isSpectator() && isFirstPlayerInThreatStage());

src/client/components/timer/timer.tsx Outdated Show resolved Hide resolved
@ChristophNiehoff ChristophNiehoff merged commit fbd1d6d into master Jul 6, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants