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';
78 const SeedCodeInput = ({
86 if (game === 'alttpr') {
87 const code_trans = ALTTPR_CODES
88 .map(code => ({ code, label: i18n.t(`icon.zelda.${code}`)}))
89 .sort((a, b) => a.label.localeCompare(b.label));
91 className={`${className} seed-code-input game-alttpr`}
93 {[0, 1, 2, 3, 4].map(num =>
98 name={`${name}[${num}]`}
99 value={(value && value[num]) || ''}
101 <option value=""></option>
102 {code_trans.map(({ code, label }) =>
103 <option key={code} value={code}>{label}</option>
109 if (game === 'smr') {
111 className={`${className} seed-code-input game-smr`}
113 {[0, 1, 2, 3].map(num =>
118 name={`${name}[${num}]`}
119 value={(value && value[num]) || ''}
121 <option value=""></option>
122 {SMR_CODES.sort((a, b) => a.localeCompare(b)).map(code =>
123 <option key={code} value={code}>{code}</option>
130 className={`${className} seed-code-input`}
132 {[0, 1, 2, 3, 4].map(num =>
137 name={`${name}[${num}]`}
138 value={(value && value[num]) || ''}
144 SeedCodeInput.propTypes = {
145 className: PropTypes.string,
146 game: PropTypes.string,
147 name: PropTypes.string,
148 onBlur: PropTypes.func,
149 onChange: PropTypes.func,
150 value: PropTypes.arrayOf(PropTypes.string),
153 SeedCodeInput.defaultProps = {
162 export default withTranslation()(SeedCodeInput);