-
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.
- Loading branch information
Showing
9 changed files
with
249 additions
and
48 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -141,7 +141,7 @@ | |
margin: 4px; | ||
} | ||
|
||
tr { | ||
#suits tr { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
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,17 +1,21 @@ | ||
import { useContext } from 'react' | ||
import { useContext, useState } from 'react' | ||
import stake_icon from '../assets/white_stake.webp' | ||
import { GameStateContext } from '../GameState' | ||
import './Round.css' | ||
import { ScoreLog } from './ScoreLog' | ||
|
||
export const Round = () => { | ||
const { state: game } = useContext(GameStateContext) | ||
const [ logMenu, setLogMenu ] = useState(false) | ||
|
||
return ( | ||
<div id='round-score'> | ||
<div id='round-score-text'>Round<br/>score</div> | ||
<div id='score-display'> | ||
<div id='score-display' onClick={() => setLogMenu(true)}> | ||
<img id='stake-icon' src={stake_icon} /> | ||
<div id='score'>{game.stats.score}</div> | ||
</div> | ||
{logMenu && <ScoreLog setMenu={setLogMenu} />} | ||
</div> | ||
) | ||
} |
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,41 @@ | ||
#score-log-outline { | ||
position: absolute; | ||
z-index: 1; | ||
background-color: var(--light-grey); | ||
border-radius: 8px; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
|
||
#score-log { | ||
background-color: var(--grey); | ||
border-radius: 8px; | ||
margin: 4px; | ||
width: 512px; | ||
max-height: 640px; | ||
overflow: scroll; | ||
} | ||
|
||
#score-log > table { | ||
font-size: 20px; | ||
border-collapse: collapse; | ||
} | ||
|
||
#score-log > table > tr { | ||
border-bottom: 1px solid aliceblue; | ||
} | ||
|
||
#score-log > table > tr:last-child { border: none } | ||
|
||
#score-log > table > #headings { | ||
font-size: 32px; | ||
} | ||
|
||
#score-log-back { | ||
text-align: center; | ||
font-size: 32px; | ||
background-color: var(--orange); | ||
border-radius: 8px; | ||
margin: 2px; | ||
} |
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,54 @@ | ||
import { useContext } from "react" | ||
import { GameStateContext } from "../GameState" | ||
import './ScoreLog.css' | ||
|
||
type ScoreLogProps = { | ||
setMenu: React.Dispatch<React.SetStateAction<boolean>> | ||
} | ||
|
||
export const ScoreLog = (props: ScoreLogProps) => { | ||
const { state: game } = useContext(GameStateContext) | ||
|
||
const chipFormat = (chips: number | undefined, mult: number | undefined, mult_type: string | undefined) => { | ||
if(chips !== undefined) { | ||
if(mult !== undefined && mult_type === undefined) { return <td className='blue' style={{fontSize: '24px'}}>{chips}</td>} | ||
return <td className='blue'>{`+${chips}`}</td> | ||
} | ||
return <td /> | ||
} | ||
|
||
const multFormat = (mult: number | undefined, mult_type: string | undefined) => { | ||
if(mult !== undefined) { | ||
if(mult < 0) { return <td className='red'>{mult}</td> } | ||
if(mult_type === undefined) { return <td className='red' style={{fontSize: '24px'}}>{mult}</td>} | ||
if(mult_type === '+') { return <td className='red'>{`+${mult}`}</td>} | ||
return <td className='red-invert'>{`X${mult}`}</td> | ||
} | ||
return <td /> | ||
} | ||
|
||
return ( | ||
<div id='score-log-outline'> | ||
<div id='score-log'> | ||
<table style={{width: '100%'}}> | ||
<tr id='headings'> | ||
<th style={{width: '60%'}}>Name</th> | ||
<th>Chips</th> | ||
<th>Mult</th> | ||
</tr> | ||
{game.scoreLog.map((entry, i) => ( | ||
entry.chips === undefined && entry.mult === undefined ? | ||
<tr key={i} style={{fontSize: '24px', backgroundColor: 'var(--dark-grey)'}}><td colSpan={3}>{entry.name}</td></tr> : | ||
<tr key={i}> | ||
<td>{entry.name}</td> | ||
{chipFormat(entry.chips, entry.mult, entry.mult_type)} | ||
{multFormat(entry.mult, entry.mult_type)} | ||
</tr> | ||
) | ||
)} | ||
</table> | ||
</div> | ||
<div id='score-log-back' onClick={() => props.setMenu(false)}>Back</div> | ||
</div> | ||
) | ||
} |
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