-
Notifications
You must be signed in to change notification settings - Fork 797
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
Highlight timer messages below 10 seconds #2118
base: master
Are you sure you want to change the base?
Conversation
We should already have a highlight class (should just be Do we want this to also create a browser notification, like how we do it for tournaments / start of battles? I'm not sure how much of that was part of the suggestion, but as it stands this is only a visual indicator if you're in the current tab / battle. Using our existing |
Hey @DaWoblefet, when you have the time could you take another look at this? |
src/battle-log.ts
Outdated
divClass += ' highlighted'; | ||
if (this.scene?.battle?.roomid) { | ||
const title = 'Make your move!'; | ||
const body = `${battle?.kickingInactive || 'Only a few'} seconds remaining!`; |
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.
You check battle?.kickingInactive
in the if statement, so it should always be truthy. Is the "Only a few" fallback just to satisfy TypeScript, or is there a situation where it would be used that I'm not seeing? (If kickingInactive
is 0, we won't even get 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.
This looks pretty good to me; have you tested it locally?
src/battle.ts
Outdated
currTurnTimeElapsed = 0; | ||
timerMessageHighlighted = false; |
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 don't think this needs two new properties on Battle? Like we're already displaying "User has X seconds left", we can just check how many seconds are left and use that to decide how pushy to make the message, right?
Link to suggestion thread in forum
This PR adds yellow highlighting to timer messages to make them more visually obvious, which should help indicate the urgency of timer messages at lower values.
My implementation makes it so that, if a player has not made a move for 30 seconds in the current turn AND the timer value is <= 10, all subsequent timer messages for that user are highlighted with a yellow backdrop.