From 0d44529fed81b0b36b6e66cf880b27b2c8945f3c Mon Sep 17 00:00:00 2001 From: Janusz Kamienski Date: Sun, 21 May 2023 13:35:02 +0200 Subject: [PATCH 1/2] Allow user to change the character they have signed up with; move sign out from the list to the action button below the list along with the change character button --- src/pages/GameDetail.js | 84 +++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/src/pages/GameDetail.js b/src/pages/GameDetail.js index e50a167..f47c353 100644 --- a/src/pages/GameDetail.js +++ b/src/pages/GameDetail.js @@ -76,6 +76,9 @@ const styles = theme => ({ }, close: { color: '#fff', + }, + spacingRight: { + marginRight: 12, } }); @@ -136,16 +139,8 @@ class GameDetail extends Component { }; getUserListItem = (player) => { - let action = null; - if(player.profile.id === this.props.portalStore.currentUser.profileID && !this.state.game.ended){ - action = ( - this.signOut()}> - - - ) - } return + history={this.props.history}/> }; freeSpots = () => { @@ -161,14 +156,18 @@ class GameDetail extends Component { } canSignUp = () => { - const players = this.state.game.players.map(player => player.profile.id); - const player = this.props.portalStore.currentUser.profileID; const future = this.state.game.ended === false; const emptySpot = this.freeSpots() > 0; const isDM = this.state.game.dm; - return isDM && future && players.indexOf(player) === -1 && !this.userIsRunning() && emptySpot; + return isDM && future && !this.userIsRunning() && (emptySpot || this.isSignedUp()); }; + isSignedUp = () => { + const players = this.state.game.players.map(player => player.profile.id); + const player = this.props.portalStore.currentUser.profileID; + return players.indexOf(player) !== -1 + } + hasCharacters = () => { return this.state.characters.length > 0 }; @@ -338,27 +337,46 @@ class GameDetail extends Component { {!this.userIsRunning() && ( - {(this.canSignUp() && this.hasCharacters()) ? ( - - - - {this.state.characters.map(character => ( - this.handleCharacterPick(e, character.id)}>{character.name}, {character.pc_class} {character.level} - ))} - - + {this.hasCharacters() ? + this.canSignUp() && ( + + {this.isSignedUp() ? ( + + + + + ) : ( + + )} + + {this.state.characters.map(character => ( + this.handleCharacterPick(e, character.id)}>{character.name}, {character.pc_class} {character.level} + ))} + + ) : ( )} From 66048fbf8ca14ce0ebb3f2d0406aea03d041c616 Mon Sep 17 00:00:00 2001 From: Janusz Kamienski Date: Sun, 21 May 2023 13:48:24 +0200 Subject: [PATCH 2/2] do not display info about inability to sign up for already signed up players --- package.json | 2 +- src/pages/GameDetail.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b7c28d3..7c6ab5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "portAL", - "version": "1.3.4", + "version": "1.4.0", "private": true, "dependencies": { "@fortawesome/fontawesome-svg-core": "^1.2.6", diff --git a/src/pages/GameDetail.js b/src/pages/GameDetail.js index f47c353..8d6e5e9 100644 --- a/src/pages/GameDetail.js +++ b/src/pages/GameDetail.js @@ -377,9 +377,9 @@ class GameDetail extends Component { ))} - ) : ( - - )} + ) : + !this.isSignedUp() && + } ) } {!this.hasCharacters() && (