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>
|
||||||
<Row>
|
<Row>
|
||||||
<Formik
|
<Formik
|
||||||
initialValues={{ wonder: player.wonder ?? '' }}
|
initialValues={{ wonder: player.wonder ?? [...wonders.keys()][0] }}
|
||||||
validate={values => {
|
validate={values => {
|
||||||
const errors: Partial<typeof values> = {}
|
const errors: Partial<typeof values> = {}
|
||||||
if (values.wonder.length === 0) {
|
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>
|
<button type="submit">Choose wonder</button>
|
||||||
{' '}
|
{' '}
|
||||||
<Field as="select" name="wonder">
|
<Field as="select" name="wonder">
|
||||||
{['', ...wonders.keys()].map(w =>
|
{[...wonders.keys()].map(w =>
|
||||||
<option key={w} disabled={w.length === 0 || isWonderInUse(w)}>{w}</option>
|
<option key={w} disabled={isWonderInUse(w)}>{w}</option>
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
{' '}
|
{' '}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user