Remove empty wonder selection
This commit is contained in:
parent
d1dc1db234
commit
4d6ca264f7
@ -65,7 +65,7 @@ export default function Game({ state, playerName, dispatch }: { state: State, pl
|
||||
</Row>
|
||||
<Row>
|
||||
<Formik
|
||||
initialValues={{ wonder: player.wonder ?? '' }}
|
||||
initialValues={{ wonder: player.wonder ?? [...wonders.keys()][0] }}
|
||||
validate={values => {
|
||||
const errors: Partial<typeof values> = {}
|
||||
if (values.wonder.length === 0) {
|
||||
@ -81,8 +81,8 @@ export default function Game({ state, playerName, dispatch }: { state: State, pl
|
||||
<button type="submit">Choose wonder</button>
|
||||
{' '}
|
||||
<Field as="select" name="wonder">
|
||||
{['', ...wonders.keys()].map(w =>
|
||||
<option key={w} disabled={w.length === 0 || isWonderInUse(w)}>{w}</option>
|
||||
{[...wonders.keys()].map(w =>
|
||||
<option key={w} disabled={isWonderInUse(w)}>{w}</option>
|
||||
)}
|
||||
</Field>
|
||||
{' '}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user