1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Col, Form, Modal, Row } from 'react-bootstrap';
4 import { useTranslation } from 'react-i18next';
6 import LargeCheck from '../common/LargeCheck';
7 import { getConfigValue } from '../../helpers/tracker';
8 import { useTracker } from '../../hooks/tracker';
10 const ConfigDialog = ({
14 const { config, saveConfig } = useTracker();
15 const { t } = useTranslation();
17 const handleChange = React.useCallback(({ target: { name, value } }) => {
18 saveConfig({ [name]: value });
21 return <Modal className="tracker-config-dialog" onHide={onHide} show={show} size="lg">
22 <Modal.Header closeButton>
24 {t('tracker.config.title')}
30 <h3>{t('tracker.config.logic')}</h3>
32 className="d-flex justify-content-between my-2"
33 controlId="tracker.worldState"
35 <Form.Label>{t('tracker.config.worldState')}</Form.Label>
39 onChange={handleChange}
40 value={getConfigValue(config, 'world-state', 'open')}
42 {['open', 'inverted'].map(n =>
43 <option key={n} value={n}>
44 {t(`tracker.config.worldStates.${n}`)}
50 className="d-flex justify-content-between my-2"
51 controlId="tracker.glitches"
53 <Form.Label>{t('tracker.config.glitches')}</Form.Label>
57 onChange={handleChange}
58 value={getConfigValue(config, 'glitches', 'none')}
60 {['none', 'owg', 'hmg', 'mg', 'nl'].map(n =>
61 <option key={n} value={n}>
62 {t(`tracker.config.glitchRules.${n}`)}
68 className="d-flex justify-content-between my-2"
69 controlId="tracker.bossShuffle"
71 <Form.Label>{t('tracker.config.bossShuffle')}</Form.Label>
75 onChange={handleChange}
76 value={!!config.bossShuffle}
81 <h3>{t('tracker.config.goal')}</h3>
83 className="d-flex justify-content-between my-2"
84 controlId="tracker.gtCrystals"
86 <Form.Label>{t('tracker.config.gtCrystals')}</Form.Label>
90 onChange={handleChange}
91 value={getConfigValue(config, 'gt-crystals', 7)}
93 {['?', 0, 1, 2, 3, 4, 5, 6, 7].map(n =>
94 <option key={n} value={n}>
101 className="d-flex justify-content-between my-2"
102 controlId="tracker.ganonCrystals"
104 <Form.Label>{t('tracker.config.ganonCrystals')}</Form.Label>
107 name="ganon-crystals"
108 onChange={handleChange}
109 value={getConfigValue(config, 'ganon-crystals', 7)}
111 {['?', 0, 1, 2, 3, 4, 5, 6, 7].map(n =>
112 <option key={n} value={n}>
119 className="d-flex justify-content-between my-2"
120 controlId="tracker.goal"
122 <Form.Label>{t('tracker.config.goal')}</Form.Label>
126 onChange={handleChange}
127 value={getConfigValue(config, 'goal', 'ganon')}
129 {['ganon', 'fast', 'ad', 'ped', 'trinity', 'thunt', 'ghunt'].map(n =>
130 <option key={n} value={n}>
131 {t(`tracker.config.goals.${n}`)}
138 <Row className="mt-3">
140 <h3>{t('tracker.config.wildItems')}</h3>
142 className="d-flex justify-content-between my-2"
143 controlId="tracker.wildMap"
145 <Form.Label>{t('tracker.config.wildMap')}</Form.Label>
149 onChange={handleChange}
150 value={!!config.wildMap}
154 className="d-flex justify-content-between my-2"
155 controlId="tracker.wildCompass"
157 <Form.Label>{t('tracker.config.wildCompass')}</Form.Label>
161 onChange={handleChange}
162 value={!!config.wildCompass}
166 className="d-flex justify-content-between my-2"
167 controlId="tracker.wildSmall"
169 <Form.Label>{t('tracker.config.wildSmall')}</Form.Label>
173 onChange={handleChange}
174 value={!!config.wildSmall}
178 className="d-flex justify-content-between my-2"
179 controlId="tracker.wildBig"
181 <Form.Label>{t('tracker.config.wildBig')}</Form.Label>
185 onChange={handleChange}
186 value={!!config.wildBig}
191 <h3>{t('tracker.config.showItems')}</h3>
193 className="d-flex justify-content-between my-2"
194 controlId="tracker.showMap"
196 <Form.Label>{t('tracker.config.showMap')}</Form.Label>
200 onChange={handleChange}
201 value={config.showMap || 'always'}
203 <option value="never">
204 {t('tracker.config.showItemOptions.never')}
206 <option value="situational">
207 {t('tracker.config.showItemOptions.situational')}
209 <option value="always">
210 {t('tracker.config.showItemOptions.always')}
215 className="d-flex justify-content-between my-2"
216 controlId="tracker.showCompass"
218 <Form.Label>{t('tracker.config.showCompass')}</Form.Label>
222 onChange={handleChange}
223 value={config.showCompass || 'always'}
225 <option value="never">
226 {t('tracker.config.showItemOptions.never')}
228 <option value="situational">
229 {t('tracker.config.showItemOptions.situational')}
231 <option value="always">
232 {t('tracker.config.showItemOptions.always')}
237 className="d-flex justify-content-between my-2"
238 controlId="tracker.showSmall"
240 <Form.Label>{t('tracker.config.showSmall')}</Form.Label>
244 onChange={handleChange}
245 value={config.showSmall || 'always'}
247 <option value="never">
248 {t('tracker.config.showItemOptions.never')}
250 <option value="situational">
251 {t('tracker.config.showItemOptions.situational')}
253 <option value="always">
254 {t('tracker.config.showItemOptions.always')}
259 className="d-flex justify-content-between my-2"
260 controlId="tracker.showBig"
262 <Form.Label>{t('tracker.config.showBig')}</Form.Label>
266 onChange={handleChange}
267 value={config.showBig || 'always'}
269 <option value="never">
270 {t('tracker.config.showItemOptions.never')}
272 <option value="situational">
273 {t('tracker.config.showItemOptions.situational')}
275 <option value="always">
276 {t('tracker.config.showItemOptions.always')}
286 ConfigDialog.propTypes = {
287 onHide: PropTypes.func,
288 show: PropTypes.bool,
291 export default ConfigDialog;