Skip to content

Commit

Permalink
fix(game-events): icon animation null instance handler (#889)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved error handling in the Game Events Monitor Footer by
preventing runtime errors related to undefined button icons.
- Updated button icon behavior to avoid animation when icons are not
defined, enhancing user experience.

- **Tests**
- Modified test cases to reflect new behavior of button icons, focusing
on animation rather than error throwing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
antoinezanardi committed Sep 18, 2024
1 parent deeb7b2 commit ee0a17e
Show file tree
Hide file tree
Showing 3 changed files with 83,704 additions and 83,796 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,20 @@ function onClickFromPreviousEventButton(): void {
if (!canGoToPreviousGameEvent.value) {
return;
}
if (!previousEventButtonIcon.value) {
throw createError("Previous Event Button Icon is not defined");
}
goToPreviousGameEvent();
void animateElementOnce(previousEventButtonIcon.value.$el as HTMLElement, "headShake");
if (previousEventButtonIcon.value) {
void animateElementOnce(previousEventButtonIcon.value.$el as HTMLElement, "headShake");
}
}
async function onClickFromSkipCurrentEventButton(): Promise<void> {
if (!canGoToNextGameEvent.value) {
return;
}
if (!skipCurrentEventButtonIcon.value) {
throw createError("Skip Current Event Button Icon is not defined");
}
await goToNextGameEvent();
void animateElementOnce(skipCurrentEventButtonIcon.value.$el as HTMLElement, "headShake");
if (skipCurrentEventButtonIcon.value) {
void animateElementOnce(skipCurrentEventButtonIcon.value.$el as HTMLElement, "headShake");
}
}
watch(() => keyboard.value.arrowRight.isPressed, (isKeyPressed: boolean) => {
Expand Down
Loading

0 comments on commit ee0a17e

Please sign in to comment.