From 97d00e95e6cb047aeefc067cda02a643438438fd Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Wed, 16 Oct 2024 06:29:29 -0600 Subject: [PATCH] Tweak ChallengeModal for optional close button and Create Game text --- .../ChallengeModal/ChallengeModal.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/ChallengeModal/ChallengeModal.tsx b/src/components/ChallengeModal/ChallengeModal.tsx index 2e0d4566a2..bc94dd8edc 100644 --- a/src/components/ChallengeModal/ChallengeModal.tsx +++ b/src/components/ChallengeModal/ChallengeModal.tsx @@ -158,7 +158,7 @@ export class ChallengeModal extends Modal export class ChallengeModalBody extends React.Component< ChallengeModalProperties & { modal: { - close: () => void; + close?: () => void; on: (event: "open" | "close", callback: () => void) => void; off: (event: "open" | "close", callback: () => void) => void; }; @@ -170,7 +170,7 @@ export class ChallengeModalBody extends React.Component< constructor( props: ChallengeModalProperties & { modal: { - close: () => void; + close?: () => void; on: (event: "open" | "close", callback: () => void) => void; off: (event: "open" | "close", callback: () => void) => void; }; @@ -320,7 +320,7 @@ export class ChallengeModalBody extends React.Component< if (this.props.autoCreate) { setTimeout(() => { this.createChallenge(); - this.props.modal.close(); + this.props.modal.close?.(); }, 1); } @@ -519,7 +519,7 @@ export class ChallengeModalBody extends React.Component< console.log("Sending", settings); this.saveSettings(); - this.props.modal.close(); + this.props.modal.close?.(); if (this.props.game_record_mode) { settings.library_collection_id = this.props.libraryCollectionId; @@ -678,7 +678,7 @@ export class ChallengeModalBody extends React.Component< */ this.saveSettings(); - this.props.modal.close(); + this.props.modal.close?.(); post(player_id ? `players/${player_id}/challenge` : "challenges", challenge) .then((res) => { @@ -1802,7 +1802,11 @@ export class ChallengeModalBody extends React.Component< )} */}
- + {this.props.modal.close ? ( + + ) : ( + + )} {mode === "demo" && ( )}