Skip to content

Commit

Permalink
Day 12.1: Post-scoring menu
Browse files Browse the repository at this point in the history
  • Loading branch information
imisaacwu committed Jul 7, 2024
1 parent 3f261ed commit 6206e37
Show file tree
Hide file tree
Showing 10 changed files with 245 additions and 45 deletions.
82 changes: 80 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ body {
border-right: 2px solid var(--small-blind-primary);
}

#blind-select-label {
#top-sidebar {
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -45,7 +45,6 @@ body {
height: 229px;
font-size: 48px;
line-height: 48px;;

}

#main {
Expand All @@ -71,6 +70,8 @@ body {
display: flex;
flex-direction: column;
height: 100%;
width: 790px;
height: 588px;
}

#blinds-container {
Expand All @@ -96,6 +97,83 @@ body {
flex: 1;
}

#post-outer {
display: flex;
background-color: var(--dark-grey);
border-radius: 8px;
margin: 32px;
}

#post-container {
display: flex;
width: 100%;
height: 85vh;
background-color: var(--grey);
border-radius: 8px;
margin: 2px;
}

#post-inner {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: min-content;
background-color: var(--dark-grey);
border-radius: 8px;
margin: 4px;
}

#cash-out {
background-color: var(--orange);
border-radius: 8px;
padding: 0 64px;
font-size: 80px;
line-height: 80px;
margin: 16px 0;
}

#post-dots {
font-size: 32px;
line-height: 32px;
}

.extra-reward {
display: flex;
flex-direction: row;
align-items: center;
font-size: 56px;
line-height: 56px;
width: 95%;
}

.num-extra {
padding: 0 0 0 3px;
}

#remaining-hands {
color: var(--blue)
}

#interest {
color: var(--yellow)
}

.extra-reward-text {
color: white;
font-size: 24px;
margin: 0 16px;
}

.reward {
display: flex;
flex: auto;
justify-content: flex-end;
color: var(--yellow);
font-size: 48px;
}

.card-area {
height: 175px;
width: 100%;
Expand Down
53 changes: 45 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Blinds } from './components/Constants'
export default function App() {
const { state: cards, dispatch: cardDispatch } = useCardState()
const { dispatch: handDispatch } = useHandState()
const { state: game } = useGameState()
const { state: game, dispatch: gameDispatch } = useGameState()
const cardsRef = useRef(cards)
cardsRef.current = cards

Expand Down Expand Up @@ -79,15 +79,17 @@ export default function App() {
})
}, [cardsRef.current.submitted])

const currBlindType = game.currBlind === 'small' ? Blinds[0] : game.currBlind === 'big' ? Blinds[1] : game.boss;

return (
<div className='container'>
<div id='sidebar'>
{game.mode === 'blind-select' &&
<div id='blind-select-label'>Choose your<br />next Blind</div>
}
{game.mode === 'scoring' &&
<Blind type='sidebar' blind={game.currBlind === 'small' ? Blinds[0] : game.currBlind === 'big' ? Blinds[1] : game.boss} />
}
<div id='top-sidebar'>
{game.mode === 'blind-select' && <div>Choose your<br />next Blind</div>}
{game.mode === 'scoring' &&
<Blind type='sidebar' blind={currBlindType} />
}
</div>
<Round />
<Calculator />
<InfoPanel />
Expand Down Expand Up @@ -124,7 +126,42 @@ export default function App() {
</div>
</>}
{game.mode === 'post-scoring' && <>

<div id='post-outer'>
<div id='post-container'>
<div id='post-inner'>
<div id='cash-out' onClick={() => {
gameDispatch({type: 'exit', payload: {reward:
currBlindType.reward +
game.hands +
Math.min(Math.floor(game.money / 5), 5)
}})
gameDispatch({type: 'next'})
cardDispatch({type: 'shuffle'})
cardDispatch({type: 'draw', payload: {draw: game.handSize}})
}}>{`Cash Out: $${
currBlindType.reward +
game.hands +
Math.min(Math.floor(game.money / 5), 5)
}`}</div>
<Blind type='post' blind={currBlindType} />
<div id='post-dots'>{'. '.repeat(49)}</div>
{game.hands > 0 &&
<div id='remaining-hands' className='extra-reward'>
<div className='num-extra'>{game.hands}</div>
<div className='extra-reward-text'>{'Remaining Hands \[$1 each\]'}</div>
<div className='reward'>{'$'.repeat(game.hands)}</div>
</div>
}
{game.money > 4 &&
<div id='interest' className='extra-reward'>
<div className='num-extra'>{Math.min(Math.floor(game.money / 5), 5)}</div>
<div className='extra-reward-text'>{'1 interest per $5 \[5 max\]'}</div>
<div className='reward'>{'$'.repeat(Math.min(Math.floor(game.money / 5), 5))}</div>
</div>
}
</div>
</div>
</div>
</>}
</div>
<Deck />
Expand Down
85 changes: 68 additions & 17 deletions src/components/Blind.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
flex-direction: column;
background-color: var(--dark-grey);
border-radius: 8px;
margin-top: 48px;
width: 100%;
}

#blind-name {
Expand Down Expand Up @@ -37,6 +37,9 @@
}

#blind-info.sidebar {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
background-color: var(--small-blind-secondary);
border-radius: 8px;
Expand All @@ -53,6 +56,13 @@
margin: 2px;
}

#blind-bio {
font-size: 24px;
line-height: 24px;
width: 200px;
margin: 8px 0 0;
}

#blind-bio.select {
width: 190px;
word-wrap: break-word;
Expand All @@ -66,15 +76,17 @@
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 175px;
margin: 16px 0;
width: 100%;
}

#blind-icon {
display: flex;
flex: initial;
width: 92px;
height: 92px;
width: 88px;
height: 88px;
margin: 0 0 0 8px;
pointer-events: none;
}

#blind-icon.select {
Expand All @@ -83,6 +95,10 @@
margin: 24px 16px 8px;
}

#blind-icon.post {
margin: 0 16px;
}

#blind-status {
display: flex;
flex: auto;
Expand All @@ -105,17 +121,27 @@
padding: 0 0 0 3px;
}

#blind-score-text.post {
font-size: 24px;
line-height: 24px;
}

#req-display {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin: 8px 0
}

#req-display.select {
margin: 0
}

#stake-icon {
width: 24px;
height: 24px;
margin: 0 8px;
scale: 1.25;
margin: 0 16px;
pointer-events: none;
}

#req-score {
Expand All @@ -125,24 +151,39 @@
color: var(--red);
}

#req-score.post {
font-size: 64px;
line-height: 48px;
}

#reward-display {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin: 4px 0 0;
margin: 4px 0;
font-size: 20px;
line-height: 16px;
}

#blind-reward {
color: var(--yellow);
font-size: 24px;
font-size: 28px;
line-height: 24px;
font-weight: bold;
margin: 0 0 0 4px;
}

#outer {
#blind-reward.post {
display: flex;
flex: auto;
justify-content: flex-end;
align-items: center;
font-size: 48px;
margin: 0 16px 0 0;
}

#blind-outer {
display: flex;
margin-right: 32px;
padding: 0;
Expand All @@ -151,29 +192,29 @@
height: 800px;
}

#outer.true {
#blind-outer.true {
margin-top: 16px;
}

#outer.false {
#blind-outer.false {
margin-top: 64px;
}

#container {
#blind-container {
display: flex;
background-color: var(--grey);
border-radius: 8px;
margin: 8px;
}

#outline {
#blind-outline {
background-color: gray;
border-radius: 8px;
margin: 8px;
height: fit-content;
}

#select {
#blind-select {
border-radius: 8px;
margin: 8px 16px 8px;
padding: 4px 0;
Expand All @@ -183,10 +224,20 @@
text-align: center;
}

#select.true {
#blind-select.true {
background-color: var(--orange);
}

#select.false {
#blind-select.true:hover {
cursor: pointer;
}

#blind-select.false {
background-color: gray;
}

#post-blind-info {
display: flex;
flex-direction: row;
width: 100%;
}
Loading

0 comments on commit 6206e37

Please sign in to comment.