Skip to content

Commit

Permalink
Add Display Name to Picked Civs, fix UnderText not being swapped
Browse files Browse the repository at this point in the history
  • Loading branch information
Coow committed Oct 9, 2023
1 parent 5c1cb11 commit ffd5186
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/dashboard/components/Aoe4CivDraft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export function Aoe4CivDraft() {
set_leftName(rightName)
set_rightName(tempName)

let tempUnderText = leftUnderText
set_leftUnderText(rightUnderText)
set_rightUnderText(tempUnderText)

let tempBans = leftBans
set_leftBans(rightBans)
set_rightBans(tempBans)
Expand Down
4 changes: 3 additions & 1 deletion src/graphics/CivDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import type { ValueLabelPair } from '../types/schemas/index';

type CivDisplayProps = {
civ: ValueLabelPair;
displayName?: boolean
banned?: boolean;
sniped?: boolean;
}

export const CivDisplay = ({ civ, banned, sniped }: CivDisplayProps) => {
export const CivDisplay = ({ civ, banned, displayName, sniped }: CivDisplayProps) => {
//TODO Implement sniped civs to differenciate between banned and sniped
return (
<div className='draft-civContainer'>
{displayName ? <h1 className='draft-civName'>{civ?.label}</h1> : '' }
<img src={civ?.value} className={banned ? 'draft-civBanned draft-civBannedFilter' : 'draft-civPicked'} />
{banned ? <div className='draft-banned'></div> : ''}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/graphics/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ export function Index() {

<div className='draft-leftPicks'>
{new Array(leftPicksCount).fill(undefined).map((_, i) => (
<CivDisplay civ={leftPicks[i]} banned={false} />
<CivDisplay civ={leftPicks[i]} banned={false} displayName/>
))}
</div>

<h1 className='draft-rightName'>{rightName}</h1>
<h1 className='draft-rightUnderText'>{rightUnderText}</h1>
<div className='draft-rightPicks'>
{new Array(rightPicksCount).fill(undefined).map((_, i) => (
<CivDisplay civ={rightPicks[i]} banned={false} />
<CivDisplay civ={rightPicks[i]} banned={false} displayName/>
))}
</div>

<div className='draft-rightBans' style={{}}>
{new Array(rightBansCount).fill(undefined).map((_, i) => (
<CivDisplay civ={rightBans[i]} banned={true} />
<CivDisplay civ={rightBans[i]} banned={true}/>
))}
</div></>)
}, [updateDraft])
Expand Down

0 comments on commit ffd5186

Please sign in to comment.