1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Form } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
6 import i18n from '../../i18n';
77 const SeedCodeInput = ({
85 if (game === 'alttpr') {
86 const code_trans = ALTTPR_CODES
87 .map(code => ({ code, label: i18n.t(`icon.zelda.${code}`)}))
88 .sort((a, b) => a.label.localeCompare(b.label));
90 className={`${className} seed-code-input game-alttpr`}
92 {[0, 1, 2, 3, 4].map(num =>
97 name={`${name}[${num}]`}
98 value={(value && value[num]) || ''}
100 <option value=""></option>
101 {code_trans.map(({ code, label }) =>
102 <option key={code} value={code}>{label}</option>
108 if (game === 'smr') {
110 className={`${className} seed-code-input game-smr`}
112 {[0, 1, 2, 3].map(num =>
117 name={`${name}[${num}]`}
118 value={(value && value[num]) || ''}
120 <option value=""></option>
121 {SMR_CODES.sort((a, b) => a.localeCompare(b)).map(code =>
122 <option key={code} value={code}>{code}</option>
129 className={`${className} seed-code-input`}
131 {[0, 1, 2, 3, 4].map(num =>
136 name={`${name}[${num}]`}
137 value={(value && value[num]) || ''}
143 SeedCodeInput.propTypes = {
144 className: PropTypes.string,
145 game: PropTypes.string,
146 name: PropTypes.string,
147 onBlur: PropTypes.func,
148 onChange: PropTypes.func,
149 value: PropTypes.arrayOf(PropTypes.string),
152 SeedCodeInput.defaultProps = {
161 export default withTranslation()(SeedCodeInput);