1 import { withFormik } from 'formik';
2 import PropTypes from 'prop-types';
3 import React from 'react';
4 import { Button, Col, Container, Form, Row } from 'react-bootstrap';
5 import { withTranslation } from 'react-i18next';
7 import i18n from '../../i18n';
32 const settingValues = {
152 <h1>{i18n.t('aosGenerate.heading')}</h1>
153 <Form noValidate onSubmit={handleSubmit}>
156 <Form.Group controlId="generate.preset">
158 {i18n.t('aosSeeds.preset')}
164 const presetName = e.target.value;
165 const preset = presets.find(p => p.value === presetName);
167 setFieldValue('settings', preset.settings);
169 return handleChange(e);
171 value={values.preset}
173 <option value="custom">{i18n.t('aosSeeds.presets.custom')}</option>
174 {presets.map(preset =>
175 <option key={preset.value} value={preset.value}>
176 {i18n.t(`aosSeeds.presets.${preset.value}`)}
183 <Form.Group controlId="generate.submit">
185 {i18n.t('button.generate')}
188 <Button type="submit">
189 {i18n.t('button.generate')}
196 {settings.map(setting =>
197 <Form.Group as={Col} md={4} key={setting} controlId={`generate.${setting}`}>
199 {i18n.t(`aosSeeds.settingName.${setting}`)}
202 name={`settings[${setting}]`}
205 setFieldValue('preset', 'custom');
206 return handleChange(e);
208 value={values.settings[setting]}
210 {settingValues[setting].map(value =>
211 <option key={value} value={value}>
212 {i18n.t(`aosSeeds.settingValue.${setting}.${value}`)}
222 Generate.propTypes = {
223 handleBlur: PropTypes.func,
224 handleChange: PropTypes.func,
225 handleSubmit: PropTypes.func,
226 presets: PropTypes.arrayOf(PropTypes.shape({
227 settings: PropTypes.shape({
229 value: PropTypes.string,
231 setFieldValue: PropTypes.func,
232 values: PropTypes.shape({
233 preset: PropTypes.string,
234 settings: PropTypes.shape({
239 export default withFormik({
240 displayName: 'AosGenerateForm',
241 mapPropsToValues: () => ({
246 doublechaos: 'false',
249 itempool: 'Standard',
252 logic: 'AreaTechTiers',
257 panther: 'Rand70Dup',
258 reqallsouls: 'false',
259 shopprice: 'Vanilla',
260 shopSouls: 'Vanilla',
261 startshop: 'Vanilla',
266 })(withTranslation()(Generate));