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

Highlight timer messages below 10 seconds #2118

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dingdongg
Copy link

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.

@DaWoblefet
Copy link
Member

DaWoblefet commented May 10, 2023

We should already have a highlight class (should just be highlighted). It'd be good to use the same yellow for consistency. I also think it should only appear highlighted for the player low on time.

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 highlighted class might already do that on its own?

@dingdongg
Copy link
Author

dingdongg commented May 10, 2023

Ahh I see, I'll use the existing class instead then.

I also think it should only appear highlighted for the player low on time.

I bumped up the timer values to speed up development so ignore that, but did you mean something like this?

Screenshot 2023-05-09 at 8 55 45 PM

Screenshot 2023-05-09 at 8 55 53 PM

Do we want this to also create a browser notification, like how we do it for tournaments / start of battles?

That's a good idea, I didn't think of it but it should be super helpful for people that are navigated away from the tab. I added a call to the app.rooms[roomid].notifyOnce() function, but I couldn't actually get the notifications to pop up on the testclient.html file. I know it's not an issue with my browser settings because they pop up for things like DMs and challenges on play.pokemonshowdown.com. Are notifications not supposed to work locally or am I missing something else?

Thanks!

@dingdongg
Copy link
Author

Hey @DaWoblefet, when you have the time could you take another look at this?

divClass += ' highlighted';
if (this.scene?.battle?.roomid) {
const title = 'Make your move!';
const body = `${battle?.kickingInactive || 'Only a few'} seconds remaining!`;
Copy link
Collaborator

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.)

Copy link
Collaborator

@AnnikaCodes AnnikaCodes left a 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?

Comment on lines +1088 to +1089
currTurnTimeElapsed = 0;
timerMessageHighlighted = false;
Copy link
Member

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?

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

4 participants