Remove empty wonder selection

This commit is contained in:
Kenneth Allen 2021-10-18 17:26:43 +11:00
parent d1dc1db234
commit 4d6ca264f7

View File

@ -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>
{' '}