-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set more compatible with server
- Loading branch information
MohammadHossein
committed
May 26, 2021
1 parent
e54da66
commit d45d27e
Showing
31 changed files
with
803 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
export default { | ||
name: 'header', | ||
title: 'نقطهبازی', | ||
connected: 'نقطهبازی', | ||
waiting: 'در انتظار حریف...', | ||
connecting: 'در حال اتصال...', | ||
disconnected: 'اتصال قطع شد!', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './score-board' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as React from 'react' | ||
// style | ||
import useStyle from './score-board.style' | ||
import clsx from 'clsx' | ||
// localiztion | ||
import t from './score-board.local' | ||
import { useSelector } from 'react-redux' | ||
import { | ||
getPlayerHasPermission, | ||
opponentNameView, | ||
opponentScoreView, | ||
playerColorView, | ||
playerNameView, | ||
playerScoreView, | ||
} from '../../scenes/_slice/game.slice' | ||
|
||
export default function ScoreBoard(props) { | ||
const classes = useStyle() | ||
const playerColor = useSelector(playerColorView) | ||
const playerName = useSelector(playerNameView) | ||
const playerScore = useSelector(playerScoreView) | ||
const opponentName = useSelector(opponentNameView) | ||
const opponentScore = useSelector(opponentScoreView) | ||
const playerHasPermission = useSelector(getPlayerHasPermission) | ||
|
||
const blueText = | ||
playerColor === 'blue' | ||
? `${playerName}: ${playerScore}` | ||
: `${opponentName}: ${opponentScore}` | ||
const redText = | ||
playerColor === 'red' | ||
? `${playerName}: ${playerScore}` | ||
: `${opponentName}: ${opponentScore}` | ||
|
||
const isRedActive = | ||
playerColor === 'red' | ||
? playerHasPermission | ||
? true | ||
: false | ||
: playerHasPermission | ||
? false | ||
: true | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<div | ||
className={clsx( | ||
classes.score, | ||
isRedActive ? classes.blue : classes.activeBlue, | ||
)} | ||
> | ||
<span>{blueText}</span> | ||
</div> | ||
<div | ||
className={clsx( | ||
classes.score, | ||
isRedActive ? classes.activeRed : classes.red, | ||
)} | ||
> | ||
<span>{redText}</span> | ||
</div> | ||
</div> | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
frontend/game/src/components/score-board/score-board.local.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
name: 'score board', | ||
} |
43 changes: 43 additions & 0 deletions
43
frontend/game/src/components/score-board/score-board.style.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { makeStyles } from '@material-ui/core' | ||
|
||
export default makeStyles(theme => ({ | ||
root: { | ||
display: 'flex', | ||
width: '90vmin', | ||
marginBottom: '6px', | ||
}, | ||
blue: { | ||
padding: 'auto', | ||
backgroundColor: 'rgb(0, 0, 80)', | ||
boxShadow: '0 5px rgb(0, 0, 80)', | ||
transition: '2s', | ||
marginBottom: '6px', | ||
}, | ||
activeBlue: { | ||
backgroundColor: 'rgb(0, 0, 235) !important', | ||
boxShadow: '0 5px rgb(0, 0, 180) !important', | ||
transition: '2s', | ||
}, | ||
red: { | ||
padding: 'auto', | ||
|
||
backgroundColor: 'rgb(100, 0, 0)', | ||
boxShadow: '0 5px rgb(100, 0, 0)', | ||
transition: '2s', | ||
|
||
marginBottom: '6px', | ||
}, | ||
activeRed: { | ||
backgroundColor: 'red !important', | ||
boxShadow: '0 5px rgb(200, 0, 0) !important', | ||
transition: '2s', | ||
}, | ||
score: { | ||
textAlign: 'center', | ||
textShadow: 'thistle', | ||
color: 'white', | ||
fontSize: '20px', | ||
marginBottom: 0, | ||
width: '50%', | ||
}, | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.